cli: fix tests failing in local dev environment (#4729)

This commit is contained in:
Aravind 2020-06-03 14:01:40 +05:30 committed by GitHub
parent daf098886b
commit 177556f441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 16 deletions

View File

@ -29,7 +29,7 @@ PID=$!
wait_for_port 8080
# test cli
HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" make test
HASURA_GRAPHQL_TEST_ENDPOINT="http://localhost:8080" HASURA_GRAPHQL_TEST_CLI_EXT_MANIFEST_FILE_PATH="/build/_cli_ext_output/manifest-dev.yaml" make test
kill -s INT $PID
# start graphql-engine with admin secret

View File

@ -77,7 +77,7 @@ type PluginInstallOptions struct {
}
func (o *PluginInstallOptions) Run() error {
plugin, err := ec.PluginsConfig.GetPlugin(o.Name, plugins.FetchOpts{
plugin, err := o.EC.PluginsConfig.GetPlugin(o.Name, plugins.FetchOpts{
ManifestFile: o.ManifestFile,
Version: o.Version.Version,
})

View File

@ -9,9 +9,10 @@ import (
"testing"
"time"
"github.com/hasura/graphql-engine/cli/commands"
"github.com/briandowns/spinner"
"github.com/hasura/graphql-engine/cli"
"github.com/hasura/graphql-engine/cli/commands"
integrationtest "github.com/hasura/graphql-engine/cli/integration_test"
"github.com/spf13/viper"
@ -90,19 +91,6 @@ func TestCommands(t *testing.T) {
integrationtest.TestPrepare(t, ec)
})
skip(t)
t.Run("cli-ext-plugin-install", func(t *testing.T) {
installOpts := &commands.PluginInstallOptions{
EC: ec,
Name: cli.CLIExtPluginName,
ManifestFile: "/build/_cli_ext_output/manifest-dev.yaml",
}
err := installOpts.Run()
if err != nil {
t.Fatalf("unable to install %s plugin, got %v", cli.CLIExtPluginName, err)
}
})
skip(t)
// This will init the project dir
t.Run("init command", func(t *testing.T) {
@ -115,6 +103,21 @@ func TestCommands(t *testing.T) {
integrationtest.TestValidate(t, ec)
})
skip(t)
if cliExtManifestFilePath := os.Getenv("HASURA_GRAPHQL_TEST_CLI_EXT_MANIFEST_FILE_PATH"); cliExtManifestFilePath != "" {
t.Run("cli-ext-plugin-install", func(t *testing.T) {
installOpts := &commands.PluginInstallOptions{
EC: ec,
Name: cli.CLIExtPluginName,
ManifestFile: cliExtManifestFilePath,
}
err := installOpts.Run()
if err != nil {
t.Fatalf("unable to install %s plugin, got %v", cli.CLIExtPluginName, err)
}
})
}
skip(t)
t.Run("console command", func(t *testing.T) {
v2.TestConsoleCmd(t, ec)