mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-23 23:43:44 +03:00
3136ffad1b
> ### Description Update `go.mod` to allow other packages to import [v2.0.0 versions](https://blog.golang.org/v2-go-modules). ### Changelog - [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label. ### Affected components - [x] CLI https://github.com/hasura/graphql-engine-mono/pull/1584 GitOrigin-RevId: a5d17ad20289d1cd7217763f56ef3ba6552d69c4
46 lines
1010 B
Go
46 lines
1010 B
Go
package integrationtest
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/hasura/graphql-engine/cli/v2"
|
|
)
|
|
|
|
func init() {
|
|
rand.Seed(time.Now().UTC().UnixNano())
|
|
}
|
|
|
|
func TestPrepare(t *testing.T, ec *cli.ExecutionContext) {
|
|
err := ec.Prepare()
|
|
if err != nil {
|
|
t.Fatalf("prepare failed: %v", err)
|
|
}
|
|
if ec.CMDName == "" {
|
|
t.Fatalf("expected CMDName, got: %v", ec.CMDName)
|
|
}
|
|
if ec.Spinner == nil {
|
|
t.Fatal("got spinner empty")
|
|
}
|
|
if ec.Logger == nil {
|
|
t.Fatal("got empty logger")
|
|
}
|
|
if ec.GlobalConfigDir == "" {
|
|
t.Fatalf("global config dir: expected $HOME/%s, got %s", cli.GlobalConfigDirName, ec.GlobalConfigDir)
|
|
}
|
|
if ec.GlobalConfigFile == "" {
|
|
t.Fatalf("global config file: expected $HOME/%s/%s, got %s", cli.GlobalConfigDirName, cli.GlobalConfigFileName, ec.GlobalConfigFile)
|
|
}
|
|
if ec.Config == nil {
|
|
t.Fatal("got empty Config")
|
|
}
|
|
}
|
|
|
|
func TestValidate(t *testing.T, ec *cli.ExecutionContext) {
|
|
err := ec.Validate()
|
|
if err != nil {
|
|
t.Fatalf("validate failed: %v", err)
|
|
}
|
|
}
|