forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
43 lines (35 loc) · 917 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
package main
import (
"os"
"testing"
"github.com/rogpeppe/go-internal/testscript"
"github.com/stretchr/testify/require"
"github.com/smartcontractkit/chainlink/v2/core"
"github.com/smartcontractkit/chainlink/v2/core/static"
"github.com/smartcontractkit/chainlink/v2/tools/txtar"
)
func TestMain(m *testing.M) {
os.Exit(testscript.RunMain(m, map[string]func() int{
"chainlink": core.Main,
}))
}
func TestScripts(t *testing.T) {
t.Parallel()
visitor := txtar.NewDirVisitor("testdata/scripts", txtar.Recurse, func(path string) error {
t.Run(path, func(t *testing.T) {
t.Parallel()
testscript.Run(t, testscript.Params{
Dir: path,
Setup: commonEnv,
})
})
return nil
})
require.NoError(t, visitor.Walk())
}
func commonEnv(env *testscript.Env) error {
env.Setenv("HOME", "$WORK/home")
env.Setenv("VERSION", static.Version)
env.Setenv("COMMIT_SHA", static.Sha)
return nil
}