-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_test.go
48 lines (41 loc) · 986 Bytes
/
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
package kanarya
import (
"fmt"
"io/ioutil"
"log"
"os"
"testing"
"github.com/joho/godotenv"
)
// testLambdaPackage is a simple LambdaPackage instance that is used
// across the test suite.
var testLambdaPackage = LambdaPackage{
Location: "fixtures/index.zip",
Function: LambdaFunction{
Name: "test-lambda",
},
Bucket: LambdaBucket{
Name: "test-bucket",
Key: "test-lambda/1.0.0/index.zip",
},
Alias: LambdaAlias{
Name: "live", // alias used by clients
},
}
// setup runs as the first step when "go test" run. It configures the test suite
// by loading environment variables defined for the test environment, and for
// tools used for testing.
func setup() {
log.SetOutput(ioutil.Discard)
err := godotenv.Load("test.env")
if err != nil {
fmt.Println("Failed to load godotenv!")
os.Exit(1)
}
}
// TestMain is a Go 1.14 feature. See https://golang.org/pkg/testing/#hdr-Main
// for more details.
func TestMain(m *testing.M) {
setup()
os.Exit(m.Run())
}