Skip to content

Commit

Permalink
Fix for flaky cmd starting its own server test.
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverLok committed Dec 19, 2024
1 parent df91c2c commit 0f49228
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions cmd/user-auth/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 0f49228

Please sign in to comment.