2021-04-05 17:00:21 +03:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
"github.com/hasura/graphql-engine/cli/internal/testutil"
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
. "github.com/onsi/gomega/gexec"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("metadata_inconsistency_status", func() {
|
|
|
|
|
|
|
|
var dirName string
|
|
|
|
var session *Session
|
|
|
|
var teardown func()
|
|
|
|
BeforeEach(func() {
|
|
|
|
dirName = testutil.RandDirName()
|
|
|
|
hgeEndPort, teardownHGE := testutil.StartHasura(GinkgoT(), testutil.HasuraVersion)
|
|
|
|
hgeEndpoint := fmt.Sprintf("http://0.0.0.0:%s", hgeEndPort)
|
|
|
|
testutil.RunCommandAndSucceed(testutil.CmdOpts{
|
|
|
|
Args: []string{"init", dirName},
|
|
|
|
})
|
|
|
|
editEndpointInConfig(filepath.Join(dirName, defaultConfigFilename), hgeEndpoint)
|
|
|
|
|
|
|
|
teardown = func() {
|
|
|
|
session.Kill()
|
|
|
|
os.RemoveAll(dirName)
|
|
|
|
teardownHGE()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
AfterEach(func() {
|
|
|
|
teardown()
|
|
|
|
})
|
|
|
|
|
|
|
|
Context("metadata inconsistency status test", func() {
|
|
|
|
It("Checks if the metadata is inconsistent or not", func() {
|
|
|
|
session = testutil.Hasura(testutil.CmdOpts{
|
|
|
|
Args: []string{"metadata", "inconsistency", "status"},
|
|
|
|
WorkingDirectory: dirName,
|
|
|
|
})
|
2021-05-14 22:09:01 +03:00
|
|
|
want := `metadata is consistent`
|
2021-04-05 17:00:21 +03:00
|
|
|
Eventually(session, 60*40).Should(Exit(0))
|
2021-05-14 22:09:01 +03:00
|
|
|
Eventually(session.Wait().Err.Contents()).Should(ContainSubstring(want))
|
2021-04-05 17:00:21 +03:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|