forked from protofire/integrations-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathginkgo.go
44 lines (38 loc) · 1.18 KB
/
ginkgo.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
package utils
//revive:disable:dot-imports
import (
"os"
"path/filepath"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/smartcontractkit/integrations-framework/config"
)
// GinkgoSuite provides the default setup for running a Ginkgo test suite
func GinkgoSuite(frameworkConfigFileLocation string) {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
RegisterFailHandler(Fail)
absoluteConfigFileLocation, err := filepath.Abs(frameworkConfigFileLocation)
if err != nil {
log.Fatal().
Str("Path", frameworkConfigFileLocation).
Msg("Unable to resolve path to an absolute path")
return
}
fConf, err := config.LoadFrameworkConfig(filepath.Join(absoluteConfigFileLocation, "framework.yaml"))
if err != nil {
log.Fatal().
Str("Path", absoluteConfigFileLocation).
Msg("Failed to load config")
return
}
log.Logger = log.Logger.Level(zerolog.Level(fConf.Logging.Level))
_, err = config.LoadNetworksConfig(filepath.Join(absoluteConfigFileLocation, "networks.yaml"))
if err != nil {
log.Fatal().
Str("Path", absoluteConfigFileLocation).
Msg("Failed to load config")
return
}
}