Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
test: fix subscriptions integ tests (#589)
Browse files Browse the repository at this point in the history
* test: fix subscriptions integ tests

- set required ENV API_AWS_REGION
- pass scopes arg to client constructor
- simplify test allow-list
- pass credentials to integ tests

* chore: upgrade persistence and routing
  • Loading branch information
carvantes authored Mar 8, 2022
1 parent c3972e3 commit 4004b67
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/deploy-smart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ jobs:
SUBSCRIPTIONS_NOTIFICATIONS_TABLE: ${{ secrets[matrix.subscriptionsNotificationsTableSecretName] }}
SUBSCRIPTIONS_ENDPOINT: ${{ secrets[matrix.subscriptionsEndpointSecretName] }}
SUBSCRIPTIONS_API_KEY: ${{ secrets[matrix.subscriptionsApiKeySecretName] }}
AWS_ACCESS_KEY_ID: ${{ secrets.SMART_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SMART_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ matrix.region }}
API_AWS_REGION: ${{ matrix.region }}
run: yarn int-test
merge-develop-to-mainline:
needs: custom-integration-tests
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/infrastructure/allowList-integTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import { SubscriptionEndpoint } from 'fhir-works-on-aws-routing/lib/router/validation/subscriptionValidator';

const getAllowListedSubscriptionEndpoints = async (): Promise<SubscriptionEndpoint[]> => {
const testEndpoint: RegExp = new RegExp(`^${process.env.SUBSCRIPTIONS_ENDPOINT!}`);
// any API Gateway endpoint
const testEndpoint: RegExp = /^https:\/\/\w+\.execute-api\.[\w-]+\.amazonaws.com\/\w+/;
return [
{
tenantId: 'tenant1',
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/subscriptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ if (SUBSCRIPTIONS_ENABLED === 'true') {

beforeAll(async () => {
subscriptionsHelper = new SubscriptionsHelper(SUBSCRIPTIONS_NOTIFICATIONS_TABLE);
client = await getFhirClient();
client = await getFhirClient('fhirUser user/*.*', true);
});

if (MULTI_TENANCY_ENABLED === 'true') {
test('tenant isolation', async () => {
const clientAnotherTenant = await getFhirClient({ tenant: 'tenant2' });
const clientAnotherTenant = await getFhirClient('fhirUser user/*.*', true, { tenant: 'tenant2' });
// tenant 1 creates a subscription
const uuid = v4();
const subResource = randomSubscription(uuid);
Expand Down Expand Up @@ -218,7 +218,7 @@ if (SUBSCRIPTIONS_ENABLED === 'true') {

describe('test subscription creation and deletion', () => {
beforeAll(async () => {
client = await getFhirClient();
client = await getFhirClient('fhirUser user/*.*', true);
});

test('creation of almost expiring subscription should be deleted by reaper', async () => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"escape-string-regexp": "^4.0.0",
"fhir-works-on-aws-authz-smart": "3.1.0",
"fhir-works-on-aws-interface": "12.0.0",
"fhir-works-on-aws-persistence-ddb": "3.10.0",
"fhir-works-on-aws-routing": "6.4.0",
"fhir-works-on-aws-persistence-ddb": "3.10.1",
"fhir-works-on-aws-routing": "6.4.1",
"fhir-works-on-aws-search-es": "3.11.0",
"lodash": "^4.17.21",
"p-settle": "^4.1.1",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6270,10 +6270,10 @@ fhir-works-on-aws-interface@^11.1.0:
winston "^3.3.3"
winston-transport "^4.4.0"

[email protected].0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/fhir-works-on-aws-persistence-ddb/-/fhir-works-on-aws-persistence-ddb-3.10.0.tgz#9625acc1160ae84e7ff574bb0e44405d4adf3e48"
integrity sha512-wgOdG74TA3zhw0ax91MbSm61hlZSVuzBSP2KuYSyKBcFYeLBRfDtx+aNHr2eQEaMEu6DyfJKXktq4/SZ5R9FZg==
[email protected].1:
version "3.10.1"
resolved "https://registry.yarnpkg.com/fhir-works-on-aws-persistence-ddb/-/fhir-works-on-aws-persistence-ddb-3.10.1.tgz#1bcfa13a8ba791e6904b1c8a0a57169254e3b3a9"
integrity sha512-ry0qivUYVXM+0e3xMsRN193+eFkw0fnir1qNhXKwwiOs953pDIzlG6MB7Er5OiHnvOL8KaqM/QRSgUdujsc9dw==
dependencies:
"@elastic/elasticsearch" "7.13.0"
"@types/aws-lambda" "^8.10.83"
Expand All @@ -6287,10 +6287,10 @@ [email protected]:
promise.allsettled "^1.0.2"
uuid "^3.4.0"

[email protected].0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/fhir-works-on-aws-routing/-/fhir-works-on-aws-routing-6.4.0.tgz#85adf06b19a2223debc4705ba07ea0638338d2a1"
integrity sha512-jQjW7mUvUs0PCBV8IaDD6jwkgNJ28WpDVFpscvBLN19faiPSGFQR0taOLuWU6Eh3WNpVVOjaK8kv6kKvh0PQYQ==
[email protected].1:
version "6.4.1"
resolved "https://registry.yarnpkg.com/fhir-works-on-aws-routing/-/fhir-works-on-aws-routing-6.4.1.tgz#f2fcdc031015b2fc67f6284995b34c72fc3f030e"
integrity sha512-j4CxZQ7tB11QXqSVClGv2qsAORYlQmNl5OIC1G3m2zUR/XQ877tOBaxvXuJoQowQm86dCMTp2GAZprBU/NBirw==
dependencies:
"@types/cors" "^2.8.7"
"@types/express-serve-static-core" "^4.17.2"
Expand Down

0 comments on commit 4004b67

Please sign in to comment.