Commit 07ca836b authored by Riabokon Stanislav(EPAM)[GCP]'s avatar Riabokon Stanislav(EPAM)[GCP]
Browse files

Merge branch 'feature/GONRG-843-Fix_int_tests_config' into 'integration-master'

GONRG-843 , GONRG-847

Closes GONRG-843

See merge request go3-nrg/platform/System/notification!1
parents 22fedb47 845d526c
......@@ -40,3 +40,6 @@ Notification integration tests are refactored so that the business logic for int
###Commands to run tests
* Integration tests are refactored into two pieces: Core and Provider. Core contains business logic for tests and is a dependency for executing the tests from provider module. To build the core module, simply navigate to `notification-test-core` directory and run `mvn clean install`. This will build the core module
* Next, to execute the integration tests, navigate to the provider module and execute `mvn test`
### GCP
Instructions for running the GCP integration tests can be found [here](./notification-test-gcp/README.md).
\ No newline at end of file
......@@ -33,10 +33,10 @@ public class Config {
public static Config Instance() {
String env = getEnvironment();
config.ClientTenant = "nonexistenttenant";
config.IntegrationAudience = "245464679631-ktfdfpl147m1mjpbutl00b3cmffissgq.apps.googleusercontent.com";
config.OsduTenant = "opendes";
config.Topic = "records-changed";
config.ClientTenant = getEnvironmentVariableOrDefaultValue("CLIENT_TENANT","nonexistenttenant");
config.IntegrationAudience = getEnvironmentVariableOrDefaultValue("INTEGRATION_TEST_AUDIENCE","245464679631-ktfdfpl147m1mjpbutl00b3cmffissgq.apps.googleusercontent.com");
config.OsduTenant = getEnvironmentVariableOrDefaultValue("OSDU_TENANT","opendes");
config.Topic = getEnvironmentVariableOrDefaultValue("TOPIC_ID","records-changed");
config.hmacSecretValue = System.getProperty("HMAC_SECRET", System.getenv("HMAC_SECRET"));
if (env.equalsIgnoreCase("LOCAL")) {
......@@ -71,4 +71,16 @@ public class Config {
private static String getEnvironment() {
return System.getProperty("ENVIRONMENT", System.getenv("ENVIRONMENT"));
}
private static String getEnvironmentVariableOrDefaultValue(String key, String defaultValue) {
String environmentVariable = getEnvironmentVariable(key);
if (environmentVariable == null) {
environmentVariable = defaultValue;
}
return environmentVariable;
}
private static String getEnvironmentVariable(String propertyKey) {
return System.getProperty(propertyKey, System.getenv(propertyKey));
}
}
###Dependencies needed to run the integration tests
* JDK11
* Maven
* Values for the following environment variables in Config.java
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `DE_OPS_TESTER` | `*****` | Service account base64 encoded string for API calls. Note: this user must have entitlements configured already | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
| `DE_ADMIN_TESTER` | `*****` | Service account base64 encoded string for API calls. Note: this user must have entitlements configured already | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
| `DE_EDITOR_TESTER` | `*****` | Service account base64 encoded string for API calls. Note: this user must have entitlements configured already | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
| `DE_NO_ACCESS_TESTER` | `*****` | Service account base64 encoded string for API calls. Note: this user must have entitlements configured already | yes | https://console.cloud.google.com/iam-admin/serviceaccounts |
| `ENVIRONMENT` | `dev` OR `local` | Local for running locally with services url's predefined as http://localhost , Dev is configurable environment | no | - |
| `HMAC_SECRET` | `*****` | sensitive secret to run HMAC tests | yes | - |
| `REGISTER_BASE_URL` | `http://localhost:8081/api/register/v1` | Register service url | no | - |
| `NOTIFICATION_BASE_URL` | `http://localhost:8080/` | Notification service url | no | - |
| `INTEGRATION_TEST_AUDIENCE` | `********` | Client application ID | yes | https://console.cloud.google.com/apis/credentials |
| `CLIENT_TENANT` | ex `opendes` | Client tenant | no | - |
| `OSDU_TENANT` | ex `osdu` | Osdu tenant | no | - |
| `TOPIC_ID` | ex `records-changed` | PubSub topic id | no | https://console.cloud.google.com/cloudpubsub/topic |
**Entitlements configuration for integration accounts**
| DE_OPS_TESTER | DE_ADMIN_TESTER | DE_EDITOR_TESTER | DE_NO_ACCESS_TESTER |
| --- | --- | --- | --- |
|notification.pubsub<br/>service.entitlements.user<br/>users<br/>| service.entitlements.user<br/>users<br/> | service.entitlements.user<br/>users<br/> | service.entitlements.user<br/>users<br/>|
Above variables should be configured in the release pipeline to run integration tests. You should also replace them with proper values if you wish to run tests locally.
###Commands to run tests
* Integration tests are refactored into two pieces: Core and Provider. Core contains business logic for tests and is a dependency for executing the tests from provider module. To build the core module, simply navigate to `notification-test-core` directory and run `mvn clean install`. This will build the core module
* Next, to execute the integration tests, navigate to the provider module and execute `mvn test`
## License
Copyright © Google LLC
Copyright © EPAM Systems
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment