Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add field auth e2e userpools provider #2156

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 51 additions & 33 deletions codebuild_specs/e2e_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ batch:
variables:
TEST_SUITE: >-
src/__tests__/api_6.test.ts|src/__tests__/graphql-v2/api_lambda_auth.test.ts|src/__tests__/api_9.test.ts
CLI_REGION: us-east-2
CLI_REGION: eu-west-2
depend-on:
- publish_to_local_registry
- identifier: rds_v2
Expand Down Expand Up @@ -464,13 +464,22 @@ batch:
CLI_REGION: us-east-2
depend-on:
- publish_to_local_registry
- identifier: rds_mysql_userpool_auth_fields
buildspec: codebuild_specs/run_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-mysql-userpool-auth-fields.test.ts
CLI_REGION: us-west-2
depend-on:
- publish_to_local_registry
- identifier: rds_mysql_userpool_auth
buildspec: codebuild_specs/run_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-mysql-userpool-auth.test.ts
CLI_REGION: us-west-2
CLI_REGION: eu-west-2
depend-on:
- publish_to_local_registry
- identifier: rds_mysql_v2_generate_schema
Expand All @@ -479,7 +488,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-mysql-v2-generate-schema.test.ts
CLI_REGION: eu-west-2
CLI_REGION: eu-central-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_array_objects
Expand All @@ -488,7 +497,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-array-objects.test.ts
CLI_REGION: eu-central-1
CLI_REGION: ap-northeast-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_auth_apikey_lambda
Expand All @@ -497,7 +506,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-auth-apikey-lambda.test.ts
CLI_REGION: ap-northeast-1
CLI_REGION: ap-southeast-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_auth_iam_apikey_lambda_subscription
Expand All @@ -506,7 +515,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-auth-iam-apikey-lambda-subscription.test.ts
CLI_REGION: ap-southeast-1
CLI_REGION: ap-southeast-2
depend-on:
- publish_to_local_registry
- identifier: rds_pg_auth_iam
Expand All @@ -515,7 +524,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-auth-iam.test.ts
CLI_REGION: ap-southeast-2
CLI_REGION: us-east-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_custom_claims_refersto_auth
Expand All @@ -524,7 +533,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-custom-claims-refersto-auth.test.ts
CLI_REGION: us-east-1
CLI_REGION: us-east-2
depend-on:
- publish_to_local_registry
- identifier: rds_pg_import
Expand All @@ -533,7 +542,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-import.test.ts
CLI_REGION: us-east-2
CLI_REGION: us-west-2
depend-on:
- publish_to_local_registry
- identifier: rds_pg_model_v2
Expand All @@ -542,7 +551,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-model-v2.test.ts
CLI_REGION: us-west-2
CLI_REGION: eu-west-2
depend-on:
- publish_to_local_registry
- identifier: rds_pg_oidc_auth
Expand All @@ -551,7 +560,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-oidc-auth.test.ts
CLI_REGION: eu-west-2
CLI_REGION: eu-central-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_refers_to_fields
Expand All @@ -560,7 +569,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-refers-to-fields.test.ts
CLI_REGION: eu-central-1
CLI_REGION: ap-northeast-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_refers_to
Expand All @@ -569,7 +578,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-refers-to.test.ts
CLI_REGION: ap-northeast-1
CLI_REGION: ap-southeast-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_relational_directives
Expand All @@ -578,7 +587,16 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-relational-directives.test.ts
CLI_REGION: ap-southeast-1
CLI_REGION: ap-southeast-2
depend-on:
- publish_to_local_registry
- identifier: rds_pg_userpool_auth_fields
buildspec: codebuild_specs/run_e2e_tests.yml
env:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-userpool-auth-fields.test.ts
CLI_REGION: us-east-1
depend-on:
- publish_to_local_registry
- identifier: rds_pg_userpool_auth
Expand All @@ -587,7 +605,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-userpool-auth.test.ts
CLI_REGION: ap-southeast-2
CLI_REGION: us-east-2
depend-on:
- publish_to_local_registry
- identifier: rds_pg_v2_generate_schema
Expand All @@ -596,7 +614,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-pg-v2-generate-schema.test.ts
CLI_REGION: us-east-1
CLI_REGION: us-west-2
depend-on:
- publish_to_local_registry
- identifier: rds_relational_directives
Expand All @@ -605,7 +623,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-relational-directives.test.ts
CLI_REGION: us-east-2
CLI_REGION: eu-west-2
depend-on:
- publish_to_local_registry
- identifier: rds_v2_test_utils
Expand All @@ -614,7 +632,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/rds-v2-test-utils.test.ts
CLI_REGION: us-west-2
CLI_REGION: eu-central-1
depend-on:
- publish_to_local_registry
- identifier: schema_model
Expand All @@ -623,7 +641,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-model.test.ts
CLI_REGION: eu-west-2
CLI_REGION: ap-northeast-1
depend-on:
- publish_to_local_registry
- identifier: apigw
Expand All @@ -632,7 +650,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/apigw.test.ts
CLI_REGION: eu-central-1
CLI_REGION: ap-southeast-1
depend-on:
- publish_to_local_registry
- identifier: containers_api_2
Expand All @@ -650,7 +668,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-14.test.ts
CLI_REGION: ap-southeast-1
CLI_REGION: us-east-1
depend-on:
- publish_to_local_registry
- identifier: schema_auth_7
Expand All @@ -659,7 +677,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-7.test.ts
CLI_REGION: ap-southeast-2
CLI_REGION: us-east-2
depend-on:
- publish_to_local_registry
- identifier: schema_auth_9
Expand All @@ -668,7 +686,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-9.test.ts
CLI_REGION: us-east-1
CLI_REGION: us-west-2
depend-on:
- publish_to_local_registry
- identifier: schema_auth_5
Expand All @@ -677,7 +695,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-5.test.ts
CLI_REGION: us-west-2
CLI_REGION: eu-central-1
depend-on:
- publish_to_local_registry
- identifier: searchable_datastore
Expand All @@ -686,7 +704,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/graphql-v2/searchable-datastore.test.ts
CLI_REGION: eu-west-2
CLI_REGION: ap-northeast-1
USE_PARENT_ACCOUNT: 1
depend-on:
- publish_to_local_registry
Expand All @@ -696,7 +714,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-iterative-update-4.test.ts
CLI_REGION: eu-central-1
CLI_REGION: ap-southeast-1
depend-on:
- publish_to_local_registry
- identifier: schema_searchable
Expand All @@ -705,7 +723,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-searchable.test.ts
CLI_REGION: ap-northeast-1
CLI_REGION: ap-southeast-2
USE_PARENT_ACCOUNT: 1
depend-on:
- publish_to_local_registry
Expand All @@ -715,7 +733,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-auth-6.test.ts
CLI_REGION: ap-southeast-1
CLI_REGION: us-east-1
depend-on:
- publish_to_local_registry
- identifier: schema_connection
Expand All @@ -724,7 +742,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/schema-connection.test.ts
CLI_REGION: ap-southeast-2
CLI_REGION: us-east-2
depend-on:
- publish_to_local_registry
- identifier: searchable_previous_deployment_had_node_to_node
Expand All @@ -734,7 +752,7 @@ batch:
variables:
TEST_SUITE: >-
src/__tests__/graphql-v2/searchable-node-to-node-encryption/searchable-previous-deployment-had-node-to-node.test.ts
CLI_REGION: us-east-1
CLI_REGION: us-west-2
depend-on:
- publish_to_local_registry
- identifier: searchable_previous_deployment_no_node_to_node
Expand All @@ -744,7 +762,7 @@ batch:
variables:
TEST_SUITE: >-
src/__tests__/graphql-v2/searchable-node-to-node-encryption/searchable-previous-deployment-no-node-to-node.test.ts
CLI_REGION: us-east-2
CLI_REGION: eu-west-2
depend-on:
- publish_to_local_registry
- identifier: api_2
Expand All @@ -753,7 +771,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/api_2.test.ts
CLI_REGION: us-west-2
CLI_REGION: eu-central-1
depend-on:
- publish_to_local_registry
- identifier: searchable_migration
Expand All @@ -762,7 +780,7 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
variables:
TEST_SUITE: src/__tests__/transformer-migrations/searchable-migration.test.ts
CLI_REGION: eu-west-2
CLI_REGION: ap-northeast-1
USE_PARENT_ACCOUNT: 1
depend-on:
- publish_to_local_registry
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { ImportedRDSType } from '@aws-amplify/graphql-transformer-core';
import { convertToDBSpecificGraphQLString, generateDDL } from '../../rds-v2-test-utils';

export const schema = (engine: ImportedRDSType): string => `
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is engine used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's certainly is not used here, removed.

type TodoPrivateContentVarious @model @auth(rules: [{ allow: private }]) {
id: ID! @primaryKey @auth(rules: [{ allow: private }, { allow: public }])
owner: String
authors: [String]
privateContent: String @auth(rules: [{ allow: private }])
publicContent: String @auth(rules: [{ allow: public }])
ownerContent: String @auth(rules: [{ allow: owner, operations: [create, read] }])
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors", operations: [update, read] }])
}

type TodoOwnerContentVarious @model @auth(rules: [{ allow: owner }]) {
id: ID! @primaryKey @auth(rules: [{ allow: owner }, { allow: private }, { allow: public }])
owner: String
authors: [String]
privateContent: String @auth(rules: [{ allow: private, operations: [create, update, read] }])
publicContent: String @auth(rules: [{ allow: public }])
ownerContent: String @auth(rules: [{ allow: owner, operations: [update, delete, read] }])
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors", operations: [create, read] }])
}

type TodoCustomOwnerContentVarious @model @auth(rules: [{ allow: owner, ownerField: "author" }]) {
customId: ID! @primaryKey @auth(rules: [{ allow: owner, ownerField: "author" }, { allow: private }, { allow: public }])
author: String
privateContent: String @auth(rules: [{ allow: private }, { allow: owner, ownerField: "author", operations: [delete] }])
publicContent: String @auth(rules: [{ allow: public }, { allow: owner, ownerField: "author", operations: [delete] }])
ownerContent: String @auth(rules: [{ allow: owner, ownerField: "author", operations: [create, delete, read] }])
}

type TodoCustomOwnersContentVarious @model @auth(rules: [{ allow: owner, ownerField: "authors" }]) {
customId: ID! @primaryKey @auth(rules: [{ allow: owner, ownerField: "authors" }, { allow: private }, { allow: public }])
authors: [String]
privateContent: String @auth(rules: [{ allow: private }])
publicContent: String @auth(rules: [{ allow: public }])
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors", operations: [update, read] }])
}

type TodoAdminContentVarious @model @auth(rules: [{ allow: groups, groups: ["Admin"] }]) {
id: ID! @primaryKey @auth(rules: [{ allow: groups, groups: ["Admin"] }, { allow: private }, { allow: public }])
owner: String
authors: [String]
privateContent: String @auth(rules: [{ allow: private }])
publicContent: String @auth(rules: [{ allow: public }])
ownerContent: String @auth(rules: [{ allow: owner }])
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors" }])
}

type TodoCustomGroupContentVarious @model @auth(rules: [{ allow: groups, groupsField: "customGroup" }]) {
customId: ID! @primaryKey @auth(rules: [{ allow: groups, groupsField: "customGroup" }, { allow: private }, { allow: public }])
owner: String
authors: [String]
customGroup: String
privateContent: String @auth(rules: [{ allow: private }])
publicContent: String @auth(rules: [{ allow: public }])
ownerContent: String @auth(rules: [{ allow: owner }])
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors" }])
adminContent: String @auth(rules: [{ allow: groups, groups: ["Admin"] }])
}

type TodoCustomGroupsContentVarious @model @auth(rules: [{ allow: groups, groupsField: "customGroups" }]) {
customId: ID! @primaryKey @auth(rules: [{ allow: groups, groupsField: "customGroups" }, { allow: private }, { allow: public }])
owner: String
authors: [String]
customGroups: [String]
privateContent: String @auth(rules: [{ allow: private }])
publicContent: String @auth(rules: [{ allow: public }])
ownerContent: String @auth(rules: [{ allow: owner }])
ownersContent: String @auth(rules: [{ allow: owner, ownerField: "authors" }])
adminContent: String @auth(rules: [{ allow: groups, groups: ["Admin"] }])
}
`;

export const sqlCreateStatements = (engine: ImportedRDSType): string[] => generateDDL(schema(engine), engine);
Loading