From 0f49228b50dcc96237208b811becb9c4f21d8ad7 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 19 Dec 2024 11:05:09 -0800 Subject: [PATCH] Fix for flaky cmd starting its own server test. --- cmd/user-auth/main_test.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/cmd/user-auth/main_test.go b/cmd/user-auth/main_test.go index 255aa4a4..458bc6bc 100644 --- a/cmd/user-auth/main_test.go +++ b/cmd/user-auth/main_test.go @@ -5,25 +5,15 @@ import ( "github.com/edulinq/autograder/internal/cmd" "github.com/edulinq/autograder/internal/db" - "github.com/edulinq/autograder/internal/exit" ) -func TestMain(suite *testing.M) { - // Run inside a func so defers will run before exit.Exit(). - code := func() int { - db.PrepForTestingMain() - defer db.CleanupTestingMain() - - return suite.Run() - }() - - exit.Exit(code) -} - // This test ensures a CMD can start its own server. // Since this is the only test that ensures a CMD can start its own server, // it must remain or be replaced with an equivalent test if removed. -func TestUserAuthBase(test *testing.T) { +func TestCMDStartsOwnServer(test *testing.T) { + db.PrepForTestingMain() + defer db.CleanupTestingMain() + commonTestCase := cmd.CommonCMDTestCase{ ExpectedStdout: expected_auth_output, }