server/bigquery: fix data source references & pytest filter in CI

https://github.com/hasura/graphql-engine-mono/pull/2169

GitOrigin-RevId: a0a7190a404ee558a965e06fe1a022953f6f5a10
This commit is contained in:
Abby Sassel 2021-08-26 19:11:12 +01:00 committed by hasura-bot
parent 272e49a3c5
commit 1e7ab8665d
6 changed files with 136 additions and 279 deletions

View File

@ -1207,7 +1207,7 @@ admin_users = postgres' > pgbouncer/pgbouncer.ini
wait_for_port 8080 wait_for_port 8080
# See note [Specifying Pytests with -k flag] # See note [Specifying Pytests with -k flag]
pytest -n 1 --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --backend bigquery -k "BigQuery or Common" pytest -n 1 --hge-urls "$HGE_URL" --pg-urls "$HASURA_GRAPHQL_DATABASE_URL" --backend bigquery -k "Bigquery or Common"
kill_hge_servers kill_hge_servers
;; ;;

View File

@ -6,7 +6,7 @@
query: query:
type: bigquery_set_table_customization type: bigquery_set_table_customization
args: args:
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -49,4 +49,3 @@
} }
} }
} }

View File

@ -1,175 +1,125 @@
type: bulk type: bulk
args: args:
- type: replace_metadata
- type: bigquery_track_table
args: args:
source: hasura_global_limited version: 3
table: sources:
dataset: hasura - name: hasura_global_limited
name: LimitedAlbum kind: bigquery
configuration:
- type: bigquery_track_table service_account: {from_env: HASURA_BIGQUERY_SERVICE_ACCOUNT}
args: project_id: {from_env: HASURA_BIGQUERY_PROJECT_ID}
source: hasura_global_limited datasets:
table: - hasura
dataset: hasura global_select_limit: 1
name: LimitedArtist tables:
- table:
- type: bigquery_create_object_relationship
args:
source: hasura_global_limited
table:
dataset: hasura
name: LimitedAlbum
name: artist
using:
manual_configuration:
remote_table:
dataset: hasura
name: LimitedArtist
column_mapping:
artist_other_id: artist_self_id
- type: bigquery_create_array_relationship
args:
source: hasura_global_limited
table:
dataset: hasura
name: LimitedArtist
name: albums
using:
manual_configuration:
remote_table:
dataset: hasura
name: LimitedAlbum name: LimitedAlbum
column_mapping:
artist_self_id: artist_other_id
- type: bigquery_track_table
args:
source: bigquery
table:
dataset: hasura
name: author
- type: bigquery_track_table
args:
source: bigquery
table:
dataset: hasura
name: article
- type: bigquery_create_array_relationship
args:
source: bigquery
table:
dataset: hasura
name: author
name: articles
using:
manual_configuration:
remote_table:
dataset: hasura dataset: hasura
name: article object_relationships:
column_mapping: - name: artist
id: author_id using:
manual_configuration:
- type: bigquery_create_object_relationship remote_table:
args: name: LimitedArtist
source: bigquery dataset: hasura
table: column_mapping:
dataset: hasura artist_other_id: artist_self_id
name: article - table:
name: author name: LimitedArtist
using: dataset: hasura
manual_configuration: array_relationships:
remote_table: - name: albums
using:
manual_configuration:
remote_table:
name: LimitedAlbum
dataset: hasura
column_mapping:
artist_self_id: artist_other_id
- name: hasura
kind: bigquery
configuration:
service_account: {from_env: HASURA_BIGQUERY_SERVICE_ACCOUNT}
project_id: {from_env: HASURA_BIGQUERY_PROJECT_ID}
datasets:
- hasura
global_select_limit: 10
tables:
- table:
name: Album
dataset: hasura
object_relationships:
- name: artist
using:
manual_configuration:
remote_table:
name: Artist
dataset: hasura
column_mapping:
artist_other_id: artist_self_id
- table:
name: Artist
dataset: hasura
array_relationships:
- name: albums
using:
manual_configuration:
remote_table:
name: Album
dataset: hasura
column_mapping:
artist_self_id: artist_other_id
- table:
dataset: hasura dataset: hasura
name: author name: author
column_mapping: array_relationships:
author_id: id - using:
manual_configuration:
- type: bigquery_create_select_permission remote_table:
args: name: article
role: published_only dataset: hasura
source: bigquery column_mapping:
table: id: author_id
dataset: hasura name: articles
name: article - table:
permission: dataset: hasura
columns: name: article
- is_published object_relationships:
- id - using:
- title manual_configuration:
filter: remote_table:
is_published: true name: author
dataset: hasura
- type: bigquery_create_select_permission column_mapping:
args: author_id: id
role: exact_article_id name: author
source: bigquery select_permissions:
table: - role: published_only
dataset: hasura permission:
name: article columns: [is_published, id, title]
permission: filter:
columns: is_published: true
- id - role: exact_article_id
- title permission:
- content columns: [id, title, content]
filter: filter:
id: {'_eq': 2} id:
'_eq': 2
- type: bigquery_create_select_permission - role: empty_perms
args: permission:
role: empty_perms columns: []
source: bigquery filter: {}
table: - role: user
dataset: hasura permission:
name: article columns: [id, title, content, author_id, is_published, published_on, created_at]
permission: filter: {}
columns: [] - role: test_timestamp_perm
filter: {} permission:
columns: [id, title, content]
- type: bigquery_create_select_permission filter:
args: created_at:
role: user '_eq': '2008-12-25T07:30:02'
source: bigquery - table:
table: dataset: hasura
dataset: hasura name: all_types
name: article
permission:
columns:
- id
- title
- content
- author_id
- is_published
- published_on
- created_at
filter: {}
- type: bigquery_create_select_permission
args:
role: test_timestamp_perm
source: bigquery
table:
dataset: hasura
name: article
permission:
columns:
- id
- title
- content
filter:
created_at: {'_eq': '2008-12-25T07:30:02'}
- type: bigquery_track_table
args:
source: bigquery
table:
dataset: hasura
name: all_types

View File

@ -1,70 +1,2 @@
type: bulk type: bulk
args: args: []
- type: bigquery_untrack_table
args:
source: bigquery
table:
dataset: hasura
name: all_types
- type: bigquery_drop_relationship
args:
source: bigquery
table:
dataset: hasura
name: article
relationship: author
- type: bigquery_drop_relationship
args:
source: bigquery
table:
dataset: hasura
name: author
relationship: articles
- type: bigquery_untrack_table
args:
source: bigquery
table:
dataset: hasura
name: article
- type: bigquery_untrack_table
args:
source: bigquery
table:
dataset: hasura
name: author
- type: bigquery_drop_relationship
args:
source: hasura_global_limited
table:
dataset: hasura
name: LimitedArtist
relationship: albums
- type: bigquery_drop_relationship
args:
source: hasura_global_limited
table:
dataset: hasura
name: LimitedAlbum
relationship: artist
- type: bigquery_untrack_table
args:
source: hasura_global_limited
table:
dataset: hasura
name: LimitedArtist
- type: bigquery_untrack_table
args:
source: hasura_global_limited
table:
dataset: hasura
name: LimitedAlbum

View File

@ -19,14 +19,14 @@
# explicitly drop non-cascading dependency # explicitly drop non-cascading dependency
- type: bigquery_drop_relationship - type: bigquery_drop_relationship
args: args:
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: author name: author
relationship: articles relationship: articles
- type: bigquery_untrack_table - type: bigquery_untrack_table
args: args:
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -34,7 +34,7 @@
# track table with customizations # track table with customizations
- type: bigquery_track_table - type: bigquery_track_table
args: args:
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -51,7 +51,7 @@
# restore previously (explicitly and implicitly) dropped dependencies # restore previously (explicitly and implicitly) dropped dependencies
- type: bigquery_create_array_relationship - type: bigquery_create_array_relationship
args: args:
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: author name: author
@ -66,7 +66,7 @@
- type: bigquery_create_object_relationship - type: bigquery_create_object_relationship
args: args:
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -82,7 +82,7 @@
- type: bigquery_create_select_permission - type: bigquery_create_select_permission
args: args:
role: published_only role: published_only
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -97,7 +97,7 @@
- type: bigquery_create_select_permission - type: bigquery_create_select_permission
args: args:
role: exact_article_id role: exact_article_id
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -112,7 +112,7 @@
- type: bigquery_create_select_permission - type: bigquery_create_select_permission
args: args:
role: empty_perms role: empty_perms
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -123,7 +123,7 @@
- type: bigquery_create_select_permission - type: bigquery_create_select_permission
args: args:
role: user role: user
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -141,7 +141,7 @@
- type: bigquery_create_select_permission - type: bigquery_create_select_permission
args: args:
role: test_timestamp_perm role: test_timestamp_perm
source: bigquery source: hasura
table: table:
dataset: hasura dataset: hasura
name: article name: article
@ -183,4 +183,3 @@
} }
} }
} }

View File

@ -49,13 +49,7 @@ class TestGraphQLQueryBasicMySQL:
@pytest.mark.parametrize("transport", ['http', 'websocket']) @pytest.mark.parametrize("transport", ['http', 'websocket'])
@pytest.mark.parametrize("backend", ['bigquery']) @pytest.mark.parametrize("backend", ['bigquery'])
@usefixtures('per_class_tests_db_state') @usefixtures('per_class_tests_db_state')
class TestGraphQLQueryTableCustomizationsWithReplaceMetadataBigquery: class TestGraphQLQueryTableCustomizationsBigquery:
def test_replace_metadata_with_customization(self, hge_ctx, transport):
if transport == 'http':
check_query_f(hge_ctx, self.dir() + '/replace_metadata_with_customization_and_test_query.yaml')
# This also sets the global_select_limit for hasura_global_limited to 1
# so, having that test (and related) right after here is convenient.
def test_global_limit(self, hge_ctx, transport): def test_global_limit(self, hge_ctx, transport):
check_query_f(hge_ctx, self.dir() + "/global_limit.yaml", transport) check_query_f(hge_ctx, self.dir() + "/global_limit.yaml", transport)
@ -63,39 +57,22 @@ class TestGraphQLQueryTableCustomizationsWithReplaceMetadataBigquery:
def test_offset_regression(self, hge_ctx, transport): def test_offset_regression(self, hge_ctx, transport):
check_query_f(hge_ctx, self.dir() + "/offset_regression.yaml", transport) check_query_f(hge_ctx, self.dir() + "/offset_regression.yaml", transport)
@classmethod
def dir(cls):
return 'queries/graphql_query/bigquery'
@pytest.mark.parametrize("transport", ['http', 'websocket'])
@pytest.mark.parametrize("backend", ['bigquery'])
@usefixtures('per_class_tests_db_state')
class TestGraphQLQueryTableCustomizationsWithTrackTableBigquery:
def test_track_table_with_customization(self, hge_ctx, transport): def test_track_table_with_customization(self, hge_ctx, transport):
if transport == 'http': if transport == 'http':
check_query_f(hge_ctx, self.dir() + '/track_table_with_customization_and_test_query.yaml') check_query_f(hge_ctx, self.dir() + '/track_table_with_customization_and_test_query.yaml')
@classmethod
def dir(cls):
return 'queries/graphql_query/bigquery'
@pytest.mark.parametrize("transport", ['http', 'websocket'])
@pytest.mark.parametrize("backend", ['bigquery'])
@usefixtures('per_class_tests_db_state')
class TestGraphQLQueryCustomizationsWithSetTableCustomizationBigquery:
def test_set_table_customization(self, hge_ctx, transport): def test_set_table_customization(self, hge_ctx, transport):
if transport == 'http': if transport == 'http':
check_query_f(hge_ctx, self.dir() + '/set_table_customization_and_test_query.yaml') check_query_f(hge_ctx, self.dir() + '/set_table_customization_and_test_query.yaml')
def test_replace_metadata_with_customization(self, hge_ctx, transport):
if transport == 'http':
check_query_f(hge_ctx, self.dir() + '/replace_metadata_with_customization_and_test_query.yaml')
@classmethod @classmethod
def dir(cls): def dir(cls):
return 'queries/graphql_query/bigquery' return 'queries/graphql_query/bigquery'
@pytest.mark.parametrize("transport", ['http', 'websocket']) @pytest.mark.parametrize("transport", ['http', 'websocket'])
@pytest.mark.parametrize("backend", ['bigquery']) @pytest.mark.parametrize("backend", ['bigquery'])
@usefixtures('per_class_tests_db_state') @usefixtures('per_class_tests_db_state')