graphql-engine/cli/integration_test/v3/console.go
hasura-bot a398d3b190 cli: support datasources
GITHUB_PR_NUMBER: 6111
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6111

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 1f6517acfacb58c566bb5e48f74ea0dfa5c6f063
2021-01-18 17:12:09 +00:00

39 lines
996 B
Go

package v3
import (
"os"
"testing"
"time"
"github.com/hasura/graphql-engine/cli"
"github.com/hasura/graphql-engine/cli/commands"
)
func TestConsoleCmd(t *testing.T, ec *cli.ExecutionContext) {
opts := &commands.ConsoleOptions{
EC: ec,
APIPort: "9693",
ConsolePort: "9695",
Address: "localhost",
DontOpenBrowser: true,
APIServerInterruptSignal: make(chan os.Signal),
ConsoleServerInterruptSignal: make(chan os.Signal),
}
go func() {
t.Log("waiting for console to start")
for opts.WG == nil {
time.Sleep(1 * time.Second)
}
opts.APIServerInterruptSignal <- os.Interrupt
opts.ConsoleServerInterruptSignal <- os.Interrupt
close(opts.APIServerInterruptSignal)
close(opts.ConsoleServerInterruptSignal)
}()
err := opts.Run()
if err != nil {
t.Fatalf("failed running console: %v", err)
}
// TODO: (shahidhk) curl the console endpoint for 200 response
}