mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
bb63d7e60e
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> Co-authored-by: Aravind <aravindkp@outlook.in> Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com> Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
39 lines
996 B
Go
39 lines
996 B
Go
package v2
|
|
|
|
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
|
|
}
|