summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api4/apitestlib.go6
-rw-r--r--api4/websocket_test.go9
2 files changed, 15 insertions, 0 deletions
diff --git a/api4/apitestlib.go b/api4/apitestlib.go
index ef200bf2f..537d8610c 100644
--- a/api4/apitestlib.go
+++ b/api4/apitestlib.go
@@ -105,6 +105,12 @@ func Setup() *TestHelper {
return th
}
+func StopServer() {
+ if app.Srv != nil {
+ app.StopServer()
+ }
+}
+
func TearDown() {
utils.DisableDebugLogForTest()
diff --git a/api4/websocket_test.go b/api4/websocket_test.go
index 1098f4759..5266e30a2 100644
--- a/api4/websocket_test.go
+++ b/api4/websocket_test.go
@@ -71,3 +71,12 @@ func TestWebSocket(t *testing.T) {
}
}
}
+
+func TestZZWebSocketTearDown(t *testing.T) {
+ // *IMPORTANT* - Kind of hacky
+ // This should be the last function in any test file
+ // that calls Setup()
+ // Should be in the last file too sorted by name
+ time.Sleep(2 * time.Second)
+ StopServer()
+}