Commit dcacc57f authored by Sutton's avatar Sutton
Browse files

Merge remote-tracking branch 'origin/master' into dev

parents b2ee3bd3 77038442
Pipeline #27291 failed with stages
in 131 minutes and 43 seconds
......@@ -34,6 +34,7 @@ variables:
OSDU_GCP_SERVICE: schema
OSDU_GCP_VENDOR: gcp
OSDU_GCP_APPLICATION_NAME: os-schema
OSDU_GCP_TESTS_SUBDIR: testing/schema-test-core
OSDU_GCP_ENV_VARS: AUTHORIZE_API=$OSDU_GCP_ENTITLEMENTS_URL,AUTHORIZE_API_KEY=$OSDU_GCP_AUTHORIZE_API_KEY,LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WEB=DEBUG,SHARED_TENANT_NAME=$TENANT --vpc-connector=$OSDU_GCP_VPC_CONNECTOR
include:
......@@ -44,10 +45,7 @@ include:
file: "build/maven.yml"
- project: "osdu/platform/ci-cd-pipelines"
file: "scanners/fossa.yml"
# - project: "osdu/platform/ci-cd-pipelines"
# file: "cloud-providers/gcp.yml"
file: "scanners/fossa-maven.yml"
- project: 'osdu/platform/ci-cd-pipelines'
file: 'cloud-providers/aws.yml'
......@@ -67,3 +65,22 @@ include:
- local: "/devops/azure/gitlab-bootstrap.yml"
- local: "/devops/aws/bootstrap.yaml"
osdu-gcp-test:
image: maven:3.6.3-jdk-8
script:
- >
mvn verify
--batch-mode
--quiet
-s $CI_PROJECT_DIR/.mvn/community-maven.settings.xml
-f $OSDU_GCP_TESTS_SUBDIR/pom.xml
> test-results.log
artifacts:
when: always
paths:
- test-results.log
- $OSDU_GCP_TESTS_SUBDIR/target/*/TEST-*.xml
reports:
junit:
- $OSDU_GCP_TESTS_SUBDIR/target/*/TEST-*.xml
\ No newline at end of file
......@@ -385,9 +385,13 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
for (String tenant : tenantList) {
String id = tenant + ":" + schemaId;
String partitionKey = createSchemaInfoPartitionKey(schemaKindToSchemaIdentity(schemaId));
Boolean exists = cosmosStore.findItem(tenant, cosmosDBName, schemaInfoContainer, id, partitionKey, SchemaInfoDoc.class).isPresent();
if (exists) {
return false;
try {
Boolean exists = cosmosStore.findItem(tenant, cosmosDBName, schemaInfoContainer, id, partitionKey, SchemaInfoDoc.class).isPresent();
if (exists) {
return false;
}
} catch (AppException ex) {
log.warning(String.format("Error occurred while performing uniqueness check in tenant '%s'", tenant), ex);
}
}
return true;
......
......@@ -256,6 +256,31 @@ public class AzureSchemaInfoStoreTest {
}
}
@Test
public void testIsUnique_ApplicationException() throws ApplicationException {
TenantInfo tenant1 = new TenantInfo();
tenant1.setName(commonTenantId);
tenant1.setDataPartitionId(commonTenantId);
TenantInfo tenant2 = new TenantInfo();
tenant2.setName(dataPartitionId);
tenant2.setDataPartitionId(dataPartitionId);
Collection<TenantInfo> tenants = Lists.newArrayList(tenant1, tenant2);
when(this.tenantFactory.listTenantInfo()).thenReturn(tenants);
Optional<SchemaInfoDoc> cosmosItem = Optional.of(schemaInfoDoc);
// An error is encountered while checking uniqueness in one tenant.
doThrow(AppException.class)
.when(cosmosStore)
.findItem(
eq(dataPartitionId),
any(),
any(),
eq(dataPartitionId + ":" + schemaId),
eq(partitionKey),
any());
assertTrue(schemaInfoStore.isUnique(schemaId, commonTenantId));
}
@Test
public void testIsUnique_True() 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