mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
ea9b187e7c
Closes #113
35 lines
787 B
Go
35 lines
787 B
Go
package commands
|
|
|
|
import (
|
|
"net/url"
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/briandowns/spinner"
|
|
"github.com/hasura/graphql-engine/cli"
|
|
"github.com/sirupsen/logrus/hooks/test"
|
|
)
|
|
|
|
func testMetadataExport(t *testing.T, metadataFile string, endpoint *url.URL) {
|
|
logger, _ := test.NewNullLogger()
|
|
opts := &metadataExportOptions{
|
|
EC: &cli.ExecutionContext{
|
|
Logger: logger,
|
|
Spinner: spinner.New(spinner.CharSets[7], 100*time.Millisecond),
|
|
MetadataFile: metadataFile,
|
|
Config: &cli.HasuraGraphQLConfig{
|
|
Endpoint: endpoint.String(),
|
|
AccessKey: os.Getenv("HASURA_GRAPHQL_TEST_ACCESS_KEY"),
|
|
ParsedEndpoint: endpoint,
|
|
},
|
|
},
|
|
actionType: "export",
|
|
}
|
|
|
|
err := opts.run()
|
|
if err != nil {
|
|
t.Fatalf("failed exporting metadata: %v", err)
|
|
}
|
|
}
|