Commit 1a3a5190 authored by Aman Verma's avatar Aman Verma
Browse files

updating readme

parent d6d516aa
Pipeline #5481 passed with stages
in 11 minutes and 34 seconds
......@@ -46,6 +46,10 @@ Once the above Prerequisite are done, we can follow the below steps to run the s
You can access the service APIs by following the service contract in [schema.yaml](https://dev.azure.com/slb-des-ext-collaboration/open-data-ecosystem/_git/os-schema?path=%2Fdocs%2Fapi%2Fschema.yaml)
### 2. Azure deployment
Instructions for running the Azure implementation in the cloud can be found [here](https://community.opengroup.org/osdu/platform/system/schema-service/-/blob/master/provider/schema-azure/README.md).
## Running Automated Integration Test
DevSanity tests are located in a schema-core project in testing directory under the project root directory.
......
import os
import msal
class AzureToken(object):
def get_azure_id_token(self):
tenant_id = os.getenv('AZURE_AD_TENANT_ID')
resource_id = os.getenv('AZURE_AD_APP_RESOURCE_ID')
client_id = os.getenv('INTEGRATION_TESTER')
client_secret = os.getenv('TESTER_SERVICEPRINCIPAL_SECRET')
authority_host_uri = 'https://login.microsoftonline.com'
authority_uri = authority_host_uri + '/' + tenant_id
scopes = [resource_id + '/.default']
if tenant_id is None:
print('Please pass tenant Id to generate token')
exit(1)
if resource_id is None:
print('Please pass resource Id to generate token')
exit(1)
if client_id is None:
print('Please pass client Id to generate token')
exit(1)
if client_secret is None:
print('Please pass client secret to generate token')
exit(1)
try:
app = msal.ConfidentialClientApplication(client_id=client_id, authority=authority_uri, client_credential=client_secret)
result = app.acquire_token_for_client(scopes=scopes)
token = 'Bearer ' + result.get('access_token')
print(token)
return token
except Exception as e:
print(e)
if __name__ == '__main__':
AzureToken().get_azure_id_token()
\ No newline at end of file
os
msal
\ No newline at end of file
......@@ -52,6 +52,19 @@ az keyvault secret show --vault-name $KEY_VAULT_NAME --name $KEY_VAULT_SECRET_NA
| `AZURE_CLIENT_SECRET` | `********` | Secret for `$AZURE_CLIENT_ID` | yes | keyvault secret: `$KEYVAULT_URI/secrets/app-dev-sp-password` |
**Required to run integration tests**
| name | value | description | sensitive? | source |
| --- | --- | --- | --- | --- |
| `AZURE_AD_APP_RESOURCE_ID` | `********` | AAD client application ID | yes | output of infrastructure deployment |
| `AZURE_AD_TENANT_ID` | `********` | AD tenant to authenticate users from | yes | -- |
| `INTEGRATION_TESTER` | `********` | System identity to assume for API calls. Note: this user must have entitlements configured already | no | -- |
| `PRIVATE_TENANT1` | `opendes` | OSDU tenant used for testing | no | -- |
| `PRIVATE_TENANT2` | `tenant2` | OSDU tenant used for testing | no | -- |
| `SHARED_TENANT` | `common` | OSDU tenant used for testing | no | -- |
| `VENDOR` | `azure` | cloud provider name | no | -- |
| `HOST` | ex: `http://localhost:8080` | OSDU tenant used for testing | no | -- |
| `TESTER_SERVICEPRINCIPAL_SECRET` | `********` | Secret for `$INTEGRATION_TESTER` | yes | -- |
### Configure Maven
......@@ -109,6 +122,19 @@ After configuring your environment as specified above, you can follow these step
After the service has started it should be accessible via a web browser by visiting [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html). If the request does not fail, you can then run the integration tests.
### Running automated integration tests:
These tests validate functionality of schema service.
They can then be run/debugged directly in your IDE of choice using the GUI or via the commandline using below command from schema-core project.
Below command has to be run post building complete project.
cd testing/schema-test-core
mvn verify -DVENDOR=azure -DHOST=http://localhost:8080 -DPRIVATE_TENANT1=opendes -DPRIVATE_TENANT2=tenant2 -DSHARED_TENANT=common -Dcucumber.options="--tags @SchemaService"
Below command can be run through azure-pipeline.yml after setting environment variables in the pipeline.
verify "-Dcucumber.options=--tags @SchemaService"
## Debugging
......
......@@ -90,7 +90,7 @@ public class AzureSchemaStore implements ISchemaStore {
/**
* Delete a schema from azure Storage
* @param schemaId Id of the schema to be cleaned up.
* @param schemaId
* @return
* @throws ApplicationException
*/
......
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