-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
55 lines (44 loc) · 1.15 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package http_handlers
import (
"log"
"os"
"testing"
"github.com/surahman/mcq-platform/pkg/cassandra"
"github.com/surahman/mcq-platform/pkg/logger"
"go.uber.org/zap"
)
// zapLogger is the Zap logger used strictly for the test suite in this package.
var zapLogger *logger.Logger
// testUserData is the test user account data.
var testUserData = cassandra.GetTestUsers()
// testQuizData is the test quiz data.
var testQuizData = cassandra.GetTestQuizzes()
func TestMain(m *testing.M) {
var err error
// Configure logger.
if zapLogger, err = logger.NewTestLogger(); err != nil {
log.Printf("Test suite logger setup failed: %v\n", err)
os.Exit(1)
}
// Setup test space.
if err = setup(); err != nil {
zapLogger.Error("Test suite setup failure", zap.Error(err))
os.Exit(1)
}
// Run test suite.
exitCode := m.Run()
// Cleanup test space.
if err = tearDown(); err != nil {
zapLogger.Error("Test suite teardown failure:", zap.Error(err))
os.Exit(1)
}
os.Exit(exitCode)
}
// setup will configure the auth test object.
func setup() (err error) {
return
}
// tearDown will delete the test clusters keyspace.
func tearDown() (err error) {
return
}