-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
507d071
commit a0c1636
Showing
2 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package shutdown | ||
|
||
import "testing" | ||
|
||
func TestShutdownPriority(t *testing.T) { | ||
var lastClosed int | ||
|
||
add := func(label string, priority int) { | ||
AddHookWithPriority(label, priority, func() { | ||
if lastClosed > priority { | ||
t.Fatalf("something higher priority (%d) was closed earlier than (%d)", lastClosed, priority) | ||
} else { | ||
lastClosed = priority | ||
} | ||
}) | ||
} | ||
|
||
add("database", PriorityCritical) | ||
add("gRPC", PriorityIngress) | ||
add("checkJob", PriorityJobs) | ||
add("echo", PriorityIngress) | ||
add("topologyJob", PriorityJobs) | ||
|
||
Shutdown() | ||
} |