cli(test): fix cli init test to use initDir from subtest group (#4490)

This commit is contained in:
Aravind Shankar 2020-04-22 15:54:24 +05:30 committed by GitHub
parent 0513fd39bf
commit 2a693be553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 19 deletions

View File

@ -29,7 +29,7 @@ PID=$!
wait_for_port 8080
# test cli
HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" TEST_TAGS="test_plugins" make test
HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" make test
kill -s INT $PID
# start graphql-engine with admin secret

View File

@ -1,21 +1,13 @@
package v1
import (
"math/rand"
"os"
"path/filepath"
"strconv"
"testing"
"time"
"github.com/hasura/graphql-engine/cli"
"github.com/hasura/graphql-engine/cli/commands"
)
func init() {
rand.Seed(time.Now().UTC().UnixNano())
}
func TestInitCmd(t *testing.T, ec *cli.ExecutionContext, initDir string) {
tt := []struct {
name string
@ -27,7 +19,7 @@ func TestInitCmd(t *testing.T, ec *cli.ExecutionContext, initDir string) {
Version: cli.V1,
Endpoint: os.Getenv("HASURA_GRAPHQL_TEST_ENDPOINT"),
AdminSecret: os.Getenv("HASURA_GRAPHQL_TEST_ADMIN_SECRET"),
InitDir: filepath.Join(os.TempDir(), "hasura-cli-test-"+strconv.Itoa(rand.Intn(1000))),
InitDir: initDir,
}, nil},
}

View File

@ -1,21 +1,13 @@
package v2
import (
"math/rand"
"os"
"path/filepath"
"strconv"
"testing"
"time"
"github.com/hasura/graphql-engine/cli"
"github.com/hasura/graphql-engine/cli/commands"
)
func init() {
rand.Seed(time.Now().UTC().UnixNano())
}
func TestInitCmd(t *testing.T, ec *cli.ExecutionContext, initDir string) {
tt := []struct {
name string
@ -27,7 +19,7 @@ func TestInitCmd(t *testing.T, ec *cli.ExecutionContext, initDir string) {
Version: cli.V2,
Endpoint: os.Getenv("HASURA_GRAPHQL_TEST_ENDPOINT"),
AdminSecret: os.Getenv("HASURA_GRAPHQL_TEST_ADMIN_SECRET"),
InitDir: filepath.Join(os.TempDir(), "hasura-cli-test-"+strconv.Itoa(rand.Intn(1000))),
InitDir: initDir,
}, nil},
}