diff --git a/provider/indexer-gc/docs/anthos/README.md b/provider/indexer-gc/docs/anthos/README.md index 868411924d670d8e4ea9a512b53b81d7a1f1b1a8..c1ab582eb05c57bff35be5013b3b43a9f8fe9406 100644 --- a/provider/indexer-gc/docs/anthos/README.md +++ b/provider/indexer-gc/docs/anthos/README.md @@ -240,7 +240,7 @@ You will need to have the following environment variables defined. | `ELASTIC_HOST` | ex `elastic.domain.com` | Host Elasticsearch | yes | output of infrastructure deployment | | `ELASTIC_PORT` | ex `9243` | Port Elasticsearch | yes | output of infrastructure deployment | | `INDEXER_HOST` | ex `https://os-indexer-dot-opendes.appspot.com/api/indexer/v2/` | Indexer API endpoint | no | output of infrastructure deployment | -| `ENTITLEMENTS_DOMAIN` | ex `opendes-gcp.projects.com` | OSDU R2 to run tests under | no | - | +| `GROUP_ID` | ex `opendes-gcp.projects.com` | OSDU R2 to run tests under | no | - | | `OTHER_RELEVANT_DATA_COUNTRIES` | ex `US` | valid legal tag with a other relevant data countries | no | - | | `LEGAL_TAG` | ex `opendes-demo-legaltag` | valid legal tag with a other relevant data countries from `DEFAULT_OTHER_RELEVANT_DATA_COUNTRIES` | no | - | | `DEFAULT_DATA_PARTITION_ID_TENANT1` | ex `opendes` | HTTP Header 'Data-Partition-ID' | no | - | @@ -254,9 +254,9 @@ You will need to have the following environment variables defined. **Entitlements configuration for integration accounts** -| INTEGRATION_TESTER | NO_DATA_ACCESS_TESTER | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------| -| users<br/>users.datalake.ops<br/>service.storage.creator<br/>service.entitlements.user<br/>service.search.user<br/>service.search.admin<br/>data.test1<br/>data.integration.test<br/>users@{tenant1}@{domain}.com | | +| INTEGRATION_TESTER | NO_DATA_ACCESS_TESTER | +|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------| +| users<br/>users.datalake.ops<br/>service.storage.creator<br/>service.entitlements.user<br/>service.search.user<br/>service.search.admin<br/>data.test1<br/>data.integration.test<br/>users@{tenant1}@{groupId}.com | | Execute following command to build code and run all the integration tests: diff --git a/provider/indexer-gc/docs/gc/README.md b/provider/indexer-gc/docs/gc/README.md index 11e5ce1f958906aa2ac9aca4d1f15ee88a297ea2..6a8b9e5c107f7cc4e67f482427cdb6bcee5a08a1 100644 --- a/provider/indexer-gc/docs/gc/README.md +++ b/provider/indexer-gc/docs/gc/README.md @@ -176,7 +176,7 @@ You will need to have the following environment variables defined. | `ELASTIC_PORT` | ex `9243` | Port Elasticsearch | yes | output of infrastructure deployment | | `GCLOUD_PROJECT` | ex `opendes` | Google Cloud Project Id | no | output of infrastructure deployment | | `INDEXER_HOST` | ex `https://os-indexer-dot-opendes.appspot.com/api/indexer/v2/` | Indexer API endpoint | no | output of infrastructure deployment | -| `ENTITLEMENTS_DOMAIN` | ex `opendes-gc.projects.com` | OSDU R2 to run tests under | no | - | +| `GROUP_ID` | ex `opendes-gc.projects.com` | OSDU R2 to run tests under | no | - | | `OTHER_RELEVANT_DATA_COUNTRIES` | ex `US` | valid legal tag with a other relevant data countries | no | - | | `LEGAL_TAG` | ex `opendes-demo-legaltag` | valid legal tag with a other relevant data countries from `DEFAULT_OTHER_RELEVANT_DATA_COUNTRIES` | no | - | | `DEFAULT_DATA_PARTITION_ID_TENANT1` | ex `opendes` | HTTP Header 'Data-Partition-ID' | no | - | @@ -188,9 +188,9 @@ You will need to have the following environment variables defined. **Entitlements configuration for integration accounts** -| INTEGRATION_TESTER | NO_DATA_ACCESS_TESTER | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------| -| users<br/>users.datalake.ops<br/>service.storage.creator<br/>service.entitlements.user<br/>service.search.user<br/>service.search.admin<br/>data.test1<br/>data.integration.test<br/>users@{tenant1}@{domain}.com | +| INTEGRATION_TESTER | NO_DATA_ACCESS_TESTER | +|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------| +| users<br/>users.datalake.ops<br/>service.storage.creator<br/>service.entitlements.user<br/>service.search.user<br/>service.search.admin<br/>data.test1<br/>data.integration.test<br/>users@{tenant1}@{groupId}.com | Execute following command to build code and run all the integration tests: diff --git a/testing/indexer-test-anthos/src/test/java/org/opengroup/osdu/step_definitions/record/Steps.java b/testing/indexer-test-anthos/src/test/java/org/opengroup/osdu/step_definitions/record/Steps.java index 40620fbf4a626a1eb279f28fae937a55ffdc8469..20ecbca20e53cc9a99e16f08446a0ac1d5c5a96c 100644 --- a/testing/indexer-test-anthos/src/test/java/org/opengroup/osdu/step_definitions/record/Steps.java +++ b/testing/indexer-test-anthos/src/test/java/org/opengroup/osdu/step_definitions/record/Steps.java @@ -27,6 +27,7 @@ import lombok.extern.java.Log; import org.opengroup.osdu.common.SchemaServiceRecordSteps; import org.opengroup.osdu.util.AnthosHTTPClient; import org.opengroup.osdu.util.ElasticUtils; +import org.opengroup.osdu.util.conf.AnthosConfig; @Log public class Steps extends SchemaServiceRecordSteps { @@ -37,6 +38,7 @@ public class Steps extends SchemaServiceRecordSteps { @Before public void before(Scenario scenario) { + AnthosConfig.updateEntitlementsDomainVariable(); this.scenario = scenario; this.httpClient = new AnthosHTTPClient(); } @@ -121,4 +123,4 @@ public class Steps extends SchemaServiceRecordSteps { String actualName = generateActualName(index, null); super.i_should_get_object_in_search_response_without_hints_in_schema(objectInnerField, actualName, recordFile, acl, kind); } -} \ No newline at end of file +} diff --git a/testing/indexer-test-anthos/src/test/java/org/opengroup/osdu/util/conf/AnthosConfig.java b/testing/indexer-test-anthos/src/test/java/org/opengroup/osdu/util/conf/AnthosConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..b7e332b5c7354f56d141f6880296c4cf55e88c7e --- /dev/null +++ b/testing/indexer-test-anthos/src/test/java/org/opengroup/osdu/util/conf/AnthosConfig.java @@ -0,0 +1,15 @@ +package org.opengroup.osdu.util.conf; + +import java.util.Optional; + +public class AnthosConfig { + + private static final String GROUP_ID_VARIABLE = "GROUP_ID"; + private static final String ENTITLEMENTS_DOMAIN_VARIABLE = "ENTITLEMENTS_DOMAIN"; + + public static void updateEntitlementsDomainVariable() { + String groupId = Optional.ofNullable(System.getProperty(GROUP_ID_VARIABLE, System.getenv(GROUP_ID_VARIABLE))) + .orElse("group"); + System.setProperty(ENTITLEMENTS_DOMAIN_VARIABLE, groupId); + } +} diff --git a/testing/indexer-test-gc/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java b/testing/indexer-test-gc/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java index a01ca063d369d546a19d52e69470784459f5b70c..7164300a8d7eb06c477999c8ba8bdeb3a2bc522e 100644 --- a/testing/indexer-test-gc/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java +++ b/testing/indexer-test-gc/src/test/java/org/opengroup/osdu/step_definitions/index/record/Steps.java @@ -9,6 +9,7 @@ import cucumber.api.java.en.When; import lombok.extern.java.Log; import org.opengroup.osdu.common.SchemaServiceRecordSteps; import org.opengroup.osdu.util.ElasticUtils; +import org.opengroup.osdu.util.GCConfig; import org.opengroup.osdu.util.GCPHTTPClient; @Log @@ -20,6 +21,7 @@ public class Steps extends SchemaServiceRecordSteps { @Before public void before(Scenario scenario) { + GCConfig.updateEntitlementsDomainVariable(); this.scenario = scenario; this.httpClient = new GCPHTTPClient(); } @@ -102,4 +104,4 @@ public class Steps extends SchemaServiceRecordSteps { String actualName = generateActualName(index, null); super.i_should_get_object_in_search_response_without_hints_in_schema(objectInnerField ,actualName, recordFile, acl, kind); } -} \ No newline at end of file +} diff --git a/testing/indexer-test-gc/src/test/java/org/opengroup/osdu/util/GCConfig.java b/testing/indexer-test-gc/src/test/java/org/opengroup/osdu/util/GCConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..eb78bdee6a753ba195843b86fe4fc55c2ea957ca --- /dev/null +++ b/testing/indexer-test-gc/src/test/java/org/opengroup/osdu/util/GCConfig.java @@ -0,0 +1,15 @@ +package org.opengroup.osdu.util; + +import java.util.Optional; + +public class GCConfig { + + private static final String GROUP_ID_VARIABLE = "GROUP_ID"; + private static final String ENTITLEMENTS_DOMAIN_VARIABLE = "ENTITLEMENTS_DOMAIN"; + + public static void updateEntitlementsDomainVariable() { + String groupId = Optional.ofNullable(System.getProperty(GROUP_ID_VARIABLE, System.getenv(GROUP_ID_VARIABLE))) + .orElse("group"); + System.setProperty(ENTITLEMENTS_DOMAIN_VARIABLE, groupId); + } +}