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

test: add multi-tenancy integ tests #387

Merged
merged 2 commits into from
Jul 23, 2021

Conversation

carvantes
Copy link
Contributor

An env variable must be set to run the integ tests: MULTI_TENANCY_ENABLED=true yarn int-test.
This enables the tests specific to multi-tenancy and also slightly changes how the axios client is built on getFhirClient so that all other test suites run successfully.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

package.json Outdated Show resolved Hide resolved
integration-tests/rbac-permission.test.ts Show resolved Hide resolved
role = 'practitioner',
providedAccessToken,
tenant = 'tenant1',
}: { role?: 'auditor' | 'practitioner'; providedAccessToken?: string; tenant?: string } = {}) => {
Copy link
Contributor

@rsmayda rsmayda Jul 22, 2021

Choose a reason for hiding this comment

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

This is returning an axios instance not this custom type right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not the return type of the function. That's the type of the parameters(It gets a bit tricky due to the defaults and destructuring of params). The return type of the function is implicitly Promise<AxiosInstance>

export const getFhirClient = async ({
    role = 'practitioner',
    providedAccessToken,
    tenant = 'tenant1',
}: { role?: 'auditor' | 'practitioner'; providedAccessToken?: string; tenant?: string } = {}) => {
...

It could be specified as:

export const getFhirClient = async ({
    role = 'practitioner',
    providedAccessToken,
    tenant = 'tenant1',
}: { role?: 'auditor' | 'practitioner'; providedAccessToken?: string; tenant?: string } = {}): Promise<AxiosInstance> => {
...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh sorry yep that is right!

Copy link
Contributor

@rsmayda rsmayda left a comment

Choose a reason for hiding this comment

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

Could we add include/rev_include test cases?

@carvantes carvantes merged commit ac8ba55 into feat-multitenancy Jul 23, 2021
@carvantes carvantes deleted the dev-multitenancy-integ-tests branch July 23, 2021 09:28
carvantes added a commit that referenced this pull request Aug 18, 2021
* feat: add tenantId attribute to Cognito user pool (#348)

* feat: remove unneeded scope checks in authorizer (#347)

* feat: update lambda state machine to accommodate tenantId (#367)

* feat: add "enableMultiTenancy" CFN parameter  (#381)

* test: add multi-tenancy integ tests (#387)

* fix: remove _id, _tenantId from bulk export results (#384)

* feat: Group export scripts (#389)

* fix: add multi-tenant metadata route (#392)

* fix: allow more concurrent export jobs for multi-tenant deployments (#397)

* test: integ tests for Group export (#393)

* feat: add ES hard delete config value (#398)

* docs: update postman collection and docs to use Id token  (#399)

* docs: add multi-tenancy docs (#400)


Co-authored-by: Yanyu Zheng <yz2690@columbia.edu>

BREAKING CHANGE: The Cognito IdToken is now used instead of the accessToken to authorize requests.
carvantes added a commit that referenced this pull request Aug 19, 2021
carvantes added a commit that referenced this pull request Aug 24, 2021
* feat: update lambda state machine to accommodate tenantId (#367)

* feat: add "enableMultiTenancy" CFN parameter (#382)

* fix: pass enableMultiTenancy to ES

* fix: remove _id, _tenantId from bulk export results

* feat: Group export scripts (#389)

* chore: script generating patient compartment search params

* feat: update Glue script for group export

* Upload patient compartment jsons to S3

* fix: allow more concurrent export jobs for multi-tenant deployments (#397)

* feat: add ES hard delete config value (#398)

* docs: add multi-tenancy docs (#400)

* fix: pass enableMultiTenancy flag to s3DataService

* test: add multi-tenancy integ tests (#387)

* test: integ tests for Group export (#393)

* chore: upgrade dependencies

* add public multi-tenant routes

* add system/read and user/delete permissions to defaults

* test: fix tests for smart multi-tenancy

* test: update gh actions to also test multi-tenant environment

* docs: update bulk export docs to mention group export

Co-authored-by: Yanyu Zheng <yz2690@columbia.edu>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants