Skip to content

Commit

Permalink
Merge pull request #2767 from aws-amplify/data-api-support-check
Browse files Browse the repository at this point in the history
chore: add additional regions where data API is not supported
  • Loading branch information
phani-srikar authored Aug 14, 2024
2 parents 3d02301 + 7a42189 commit 8e116c3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
10 changes: 10 additions & 0 deletions packages/amplify-e2e-core/src/utils/test-regions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fs from 'fs-extra';

type TestRegion = {
name: string;
dataAPISupported: boolean;
optIn: boolean;
};

Expand All @@ -14,3 +15,12 @@ export const isOptInRegion = (region: string): boolean => {

return specificRegion.optIn;
};

export const isDataAPISupported = (region: string): boolean => {
const repoRoot = path.join(__dirname, '..', '..', '..', '..');
const supportedRegionsPath = path.join(repoRoot, 'scripts', 'e2e-test-regions.json');
const supportedRegions: TestRegion[] = JSON.parse(fs.readFileSync(supportedRegionsPath, 'utf-8'));
const specificRegion = supportedRegions.find((testRegion) => testRegion.name == region);

return specificRegion.dataAPISupported;
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
storeDbConnectionConfigWithSecretsManager,
deleteDBCluster,
isOptInRegion,
isDataAPISupported,
} from 'amplify-category-api-e2e-core';
import { SecretsManagerClient, CreateSecretCommand, DeleteSecretCommand, GetSecretValueCommand } from '@aws-sdk/client-secrets-manager';
import {
Expand Down Expand Up @@ -53,7 +54,7 @@ export class SqlDatatabaseController {

constructor(private readonly setupQueries: Array<string>, private readonly options: RDSConfig) {
// Data API is not supported in opted-in regions
if (options.engine === 'postgres' && !isOptInRegion(options.region)) {
if (options.engine === 'postgres' && isDataAPISupported(options.region)) {
this.useDataAPI = true;
} else {
this.useDataAPI = false;
Expand Down
38 changes: 19 additions & 19 deletions scripts/e2e-test-regions.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[
{ "name": "ap-east-1", "optIn": true, "cognitoSupported": false, "betaLayerDeployed": true },
{ "name": "ap-northeast-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-northeast-2", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-south-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-southeast-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-southeast-2", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ca-central-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-central-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-north-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-south-1", "optIn": true, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-west-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-west-2", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-west-3", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "me-south-1", "optIn": true, "cognitoSupported": true, "betaLayerDeployed": false },
{ "name": "sa-east-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-east-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-east-2", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-west-1", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-west-2", "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true }
{ "name": "ap-east-1", "dataAPISupported": false, "optIn": true, "cognitoSupported": false, "betaLayerDeployed": true },
{ "name": "ap-northeast-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-northeast-2", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-south-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-southeast-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ap-southeast-2", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "ca-central-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-central-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-north-1", "dataAPISupported": false, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-south-1", "dataAPISupported": false, "optIn": true, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-west-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-west-2", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "eu-west-3", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "me-south-1", "dataAPISupported": false, "optIn": true, "cognitoSupported": true, "betaLayerDeployed": false },
{ "name": "sa-east-1", "dataAPISupported": false, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-east-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-east-2", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-west-1", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true },
{ "name": "us-west-2", "dataAPISupported": true, "optIn": false, "cognitoSupported": true, "betaLayerDeployed": true }
]

0 comments on commit 8e116c3

Please sign in to comment.