2018-06-29 13:02:33 +03:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2018-07-09 16:47:38 +03:00
|
|
|
"net/url"
|
2018-08-30 18:54:12 +03:00
|
|
|
"os"
|
2018-06-29 13:02:33 +03:00
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/briandowns/spinner"
|
|
|
|
"github.com/hasura/graphql-engine/cli"
|
|
|
|
"github.com/sirupsen/logrus/hooks/test"
|
|
|
|
)
|
|
|
|
|
2018-07-12 15:52:25 +03:00
|
|
|
func testMetadataReset(t *testing.T, metadataFile string, endpoint *url.URL) {
|
2018-06-29 13:02:33 +03:00
|
|
|
logger, _ := test.NewNullLogger()
|
|
|
|
opts := &metadataResetOptions{
|
|
|
|
EC: &cli.ExecutionContext{
|
2018-07-12 15:52:25 +03:00
|
|
|
Logger: logger,
|
|
|
|
Spinner: spinner.New(spinner.CharSets[7], 100*time.Millisecond),
|
|
|
|
MetadataFile: metadataFile,
|
2018-06-29 13:02:33 +03:00
|
|
|
Config: &cli.HasuraGraphQLConfig{
|
2018-07-09 16:47:38 +03:00
|
|
|
Endpoint: endpoint.String(),
|
2018-08-30 18:54:12 +03:00
|
|
|
AccessKey: os.Getenv("HASURA_GRAPHQL_TEST_ACCESS_KEY"),
|
2018-07-09 16:47:38 +03:00
|
|
|
ParsedEndpoint: endpoint,
|
2018-06-29 13:02:33 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
actionType: "reset",
|
|
|
|
}
|
|
|
|
|
|
|
|
err := opts.run()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("failed exporting metadata: %v", err)
|
|
|
|
}
|
|
|
|
}
|