forked from buildkite-plugins/monorepo-diff-buildkite-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_test.go
More file actions
32 lines (25 loc) · 687 Bytes
/
main_test.go
File metadata and controls
32 lines (25 loc) · 687 Bytes
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
package main
import (
"os"
"testing"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
log.SetLevel(log.DebugLevel)
// set some env variables for using in tests
os.Setenv("BUILDKITE_COMMIT", "123")
os.Setenv("BUILDKITE_MESSAGE", "fix: temp file not correctly deleted")
os.Setenv("BUILDKITE_BRANCH", "go-rewrite")
os.Setenv("env3", "env-3")
os.Setenv("env4", "env-4")
os.Setenv("TEST_MODE", "true")
run := m.Run()
os.Exit(run)
}
func TestSetupLogger(t *testing.T) {
setupLogger("debug")
assert.Equal(t, log.GetLevel(), log.DebugLevel)
setupLogger("weird level")
assert.Equal(t, log.GetLevel(), log.InfoLevel)
}