mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
ca567bf8cb
- actions use-codegen - Assert if starter kit files are created - metadata apply - Assert server metadata after apply - assert that --dry-run flag will not modify metadata on server - metadata clear - Assert with server metadata that operation was successful. - metadata inconsistency drop - Assert with server metadata that operation was successful. - metadata inconsistency status - Assert for all possible states - metadata reload - Assert effect of operation with server - migrate and seed subcommands - Add tests for MSSQL sources - Structure tests in such a way that it’s easy to add tests for new sources https://github.com/hasura/graphql-engine-mono/pull/1693 Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com> GitOrigin-RevId: fcdbb806d105978a07487a40f7fa6e16b3ab8816
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/hasura/graphql-engine/cli/v2/internal/testutil"
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/gomega"
|
|
. "github.com/onsi/gomega/gexec"
|
|
)
|
|
|
|
var _ = Describe("hasura metadata clear", func() {
|
|
|
|
var projectDirectory string
|
|
var teardown func()
|
|
BeforeEach(func() {
|
|
projectDirectory = testutil.RandDirName()
|
|
hgeEndPort, teardownHGE := testutil.StartHasura(GinkgoT(), testutil.HasuraDockerImage)
|
|
hgeEndpoint := fmt.Sprintf("http://0.0.0.0:%s", hgeEndPort)
|
|
copyTestConfigV3Project(projectDirectory)
|
|
editEndpointInConfig(filepath.Join(projectDirectory, defaultConfigFilename), hgeEndpoint)
|
|
|
|
teardown = func() {
|
|
os.RemoveAll(projectDirectory)
|
|
teardownHGE()
|
|
}
|
|
})
|
|
|
|
AfterEach(func() {
|
|
teardown()
|
|
})
|
|
|
|
Context("metadata clear test", func() {
|
|
It("should clear metadata on server", func() {
|
|
testutil.RunCommandAndSucceed(testutil.CmdOpts{
|
|
Args: []string{"metadata", "apply"},
|
|
WorkingDirectory: projectDirectory,
|
|
})
|
|
session := testutil.Hasura(testutil.CmdOpts{
|
|
Args: []string{"metadata", "clear"},
|
|
WorkingDirectory: projectDirectory,
|
|
})
|
|
Eventually(session, timeout).Should(Exit(0))
|
|
Expect(session.Err.Contents()).Should(ContainSubstring("Metadata cleared"))
|
|
|
|
session = testutil.Hasura(testutil.CmdOpts{
|
|
Args: []string{"metadata", "diff"},
|
|
WorkingDirectory: projectDirectory,
|
|
})
|
|
Eventually(session, timeout).Should(Exit(0))
|
|
stdout := session.Out.Contents()
|
|
Expect(stdout).Should(ContainSubstring("tables"))
|
|
|
|
})
|
|
})
|
|
})
|