Skip to content

Commit

Permalink
Add an extra mocking test for what happens if running under windows w…
Browse files Browse the repository at this point in the history
…here no signals are supported.

Revert this commit when we have actual CI tests running under windows.

Signed-off-by: Ying Li <ying.li@docker.com>
  • Loading branch information
cyli committed Sep 22, 2016
1 parent 89acf3b commit 2f99270
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion utils/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ func TestAdjustLogLevel(t *testing.T) {
}
}

func TestSetSignalTrap(t *testing.T) {
func testSetSignalTrap(t *testing.T) {
var signalsPassedOn map[string]struct{}

signalHandler := func(s os.Signal) {
Expand All @@ -560,3 +560,18 @@ func TestSetSignalTrap(t *testing.T) {
require.NotNil(t, signalsPassedOn[s.String()])
}
}

// TODO: undo this extra indirection, needed for mocking notary.NotarySupportedSignals being empty, when we have
// a windows CI system running
func TestSetSignalTrap(t *testing.T) {
testSetSignalTrap(t)
}

func TestSetSignalTrapMockWindows(t *testing.T) {
old := notary.NotarySupportedSignals
notary.NotarySupportedSignals = nil
defer func() {
notary.NotarySupportedSignals = old
}()
testSetSignalTrap(t)
}

0 comments on commit 2f99270

Please sign in to comment.