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 <[email protected]>
  • Loading branch information
cyli committed Sep 23, 2016
1 parent 89acf3b commit eb802aa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 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,16 @@ 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
testSetSignalTrap(t)
notary.NotarySupportedSignals = old
}

0 comments on commit eb802aa

Please sign in to comment.