mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
1998e211af
* remove docker from migrate cmd test * export migration status * [cli] add fake writer for spinner * Update console.go * Update migrate_test.go
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/briandowns/spinner"
|
|
"github.com/hasura/graphql-engine/cli"
|
|
"github.com/hasura/graphql-engine/cli/util/fake"
|
|
"github.com/hasura/graphql-engine/cli/version"
|
|
"github.com/sirupsen/logrus/hooks/test"
|
|
)
|
|
|
|
func TestConsoleCmd(t *testing.T) {
|
|
logger, _ := test.NewNullLogger()
|
|
opts := &consoleOptions{
|
|
EC: &cli.ExecutionContext{
|
|
Logger: logger,
|
|
Spinner: spinner.New(spinner.CharSets[7], 100*time.Millisecond),
|
|
Config: &cli.HasuraGraphQLConfig{
|
|
Endpoint: "http://localhost:8080",
|
|
AccessKey: "",
|
|
},
|
|
Version: version.New(),
|
|
},
|
|
APIPort: "9693",
|
|
ConsolePort: "9695",
|
|
Address: "localhost",
|
|
DontOpenBrowser: true,
|
|
}
|
|
opts.EC.Spinner.Writer = &fake.FakeWriter{}
|
|
|
|
go func() {
|
|
t.Log("waiting for console to start")
|
|
for opts.WG == nil {
|
|
time.Sleep(1 * time.Second)
|
|
}
|
|
opts.WG.Done()
|
|
opts.WG.Done()
|
|
}()
|
|
err := opts.run()
|
|
if err != nil {
|
|
t.Fatalf("failed running console: %v", err)
|
|
}
|
|
// TODO: (shahidhk) curl the console endpoint for 200 response
|
|
}
|