disable explain end-points when metadata API is disabled, fix #3717 (#3751)

This commit is contained in:
Karthikeyan Chinnakonda 2020-01-22 16:20:49 +05:30 committed by Vamshi Surabhi
parent ce547dc341
commit b344e7f39c
2 changed files with 7 additions and 8 deletions

View File

@ -545,6 +545,10 @@ httpApp corsCfg serverCtx enableConsole consoleAssetsDir enableTelemetry = do
when enableMetadata $ do
Spock.post "v1/graphql/explain" gqlExplainAction
Spock.post "v1alpha1/graphql/explain" gqlExplainAction
Spock.post "v1/query" $ spockAction encodeQErr id $
mkPostHandler $ mkAPIRespHandler v1QueryHandler
@ -553,6 +557,7 @@ httpApp corsCfg serverCtx enableConsole consoleAssetsDir enableTelemetry = do
mkAPIRespHandler $ legacyQueryHandler (TableName tableName) queryType
when enablePGDump $
Spock.post "v1alpha1/pg_dump" $ spockAction encodeQErr id $
mkPostHandler v1Alpha1PGDumpHandler
@ -564,13 +569,9 @@ httpApp corsCfg serverCtx enableConsole consoleAssetsDir enableTelemetry = do
return $ JSONResp $ HttpResponse res Nothing
when enableGraphQL $ do
Spock.post "v1alpha1/graphql/explain" gqlExplainAction
Spock.post "v1alpha1/graphql" $ spockAction GH.encodeGQErr id $
mkPostHandler $ mkAPIRespHandler v1Alpha1GQHandler
Spock.post "v1/graphql/explain" gqlExplainAction
Spock.post "v1/graphql" $ spockAction GH.encodeGQErr allMod200 $
mkPostHandler $ mkAPIRespHandler v1GQHandler

View File

@ -27,6 +27,8 @@ class TestMetadataDisabled:
def test_metadata_api_1_disabled(self, hge_ctx):
check_post_404(hge_ctx,'/api/1/table/foo/select')
def test_graphql_explain_disabled(self, hge_ctx):
check_post_404(hge_ctx, '/v1/graphql/explain')
@pytest.mark.skipif(not graphql_api_disabled,
reason="--test-graphql-disabled is not set. Cannot run GraphQL disabled tests")
@ -35,10 +37,6 @@ class TestGraphQLDisabled:
def test_graphql_endpoint_disabled(self, hge_ctx):
check_post_404(hge_ctx, '/v1/graphql')
def test_graphql_explain_disabled(self, hge_ctx):
check_post_404(hge_ctx, '/v1/graphql/explain')
@pytest.mark.skipif(graphql_api_disabled,
reason="--test-graphql-disabled is set. Cannot run GraphQL enabled tests")
class TestGraphQLEnabled: