graphql-engine/cli/commands/commands_test.go
Kali Vara Purushotham Santhati 379b812674 cli: add e2e tests for metadata and migrate commands
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: d63e0452fdb97a8f6c4e921467fc2a1de50639a1
2021-04-05 14:01:35 +00:00

46 lines
901 B
Go

package commands
import (
"github.com/hasura/graphql-engine/cli"
"github.com/hasura/graphql-engine/cli/internal/testutil"
"gopkg.in/yaml.v2"
"io/ioutil"
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
const (
defaultConfigFilename = "config.yaml"
)
func TestE2e(t *testing.T) {
BeforeSuite(func() {
if testutil.SkipDockerTests {
t.Skip()
}
})
RegisterFailHandler(Fail)
RunSpecs(t, "e2e testsuite")
}
// EditEndpoint in config
func editEndpointInConfig(configFilePath, endpoint string) {
var config cli.Config
b, err := ioutil.ReadFile(configFilePath)
Expect(err).ShouldNot(HaveOccurred())
err = yaml.Unmarshal(b, &config)
Expect(err).ShouldNot(HaveOccurred())
config.Endpoint = endpoint
b, err = yaml.Marshal(&config)
Expect(err).ShouldNot(HaveOccurred())
err = ioutil.WriteFile(configFilePath, b, 0655)
Expect(err).ShouldNot(HaveOccurred())
}