Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encryption followup PR - separate CI #13270

Merged
merged 4 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
separate CI
  • Loading branch information
moderakh committed Jul 17, 2020
commit 09c4b10525630a2adb2d65d22d662c9175dde370
8 changes: 8 additions & 0 deletions eng/pipelines/templates/stages/cosmos-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ stages:
ProfileFlag: '-P integration-test-emulator'
DisplayName: 'Spring Emulator only Integration Tests'
AdditionalArgs: '-DargLine="-DACCOUNT_HOST=https://localhost:8081/ -DACCOUNT_KEY=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== -DSECONDARY_ACCOUNT_KEY=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="'
Encryption_Integration_Tests_Java8:
OSVmImage: 'windows-2019'
JavaTestVersion: '1.8'
ProfileFlag: '-Pencryption-integration'
DisplayName: 'Encryption Emulator only Integration Tests'
PROTOCOLS: '["Tcp"]'
DESIRED_CONSISTENCIES: '["Session"]'
AdditionalArgs: '-DargLine="-DACCOUNT_HOST=https://localhost:8081/"'

TestStepMavenInputs:
goals: 'verify'
Expand Down
162 changes: 3 additions & 159 deletions sdk/cosmos/azure-cosmos-encryption/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,167 +245,11 @@ Licensed under the MIT License.
</plugins>
</build>
</profile>
<profile>
<!-- integration tests, requires Cosmos DB endpoint -->
<id>fast</id>
<properties>
<test.groups>simple,cosmosv3</test.groups>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/fast-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- integration tests, requires Cosmos DB endpoint -->
<id>long</id>
<properties>
<test.groups>long</test.groups>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/long-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- integration tests, requires Cosmos DB endpoint -->
<id>direct</id>
<properties>
<test.groups>direct</test.groups>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/direct-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- integration tests, requires Cosmos DB endpoint with multi master support -->
<id>multi-master</id>
<properties>
<test.groups>multi-master</test.groups>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/multi-master-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- integration tests, requires Cosmos DB endpoint -->
<id>examples</id>
<properties>
<!-- reset the test group as examples have no test group -->
<test.groups>samples,examples</test.groups>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/examples-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- integration tests, requires Cosmos DB Emulator Endpoint -->
<id>emulator</id>
<properties>
<test.groups>emulator</test.groups>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/emulator-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- integration tests, requires Cosmos DB Emulator Endpoint -->
<id>non-emulator</id>
<properties>
<test.groups>non-emulator</test.groups>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/non-emulator-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- e2e integration tests, requires Cosmos DB endpoint -->
<id>e2e</id>
<id>encryption-integration</id>
<properties>
<test.groups>e2e</test.groups>
<test.groups>encryption</test.groups>
</properties>
<build>
<plugins>
Expand All @@ -415,7 +259,7 @@ Licensed under the MIT License.
<version>2.22.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/e2e-testng.xml</suiteXmlFile>
<suiteXmlFile>src/test/resources/encryption-testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ public EncryptionTest2(CosmosClientBuilder clientBuilder) {
super(CosmosBridgeInternal.setDateKeyProvider(clientBuilder, simpleInMemoryProvider));
}

@BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT)
@BeforeClass(groups = {"encryption"}, timeOut = SETUP_TIMEOUT)
public void before_CosmosItemTest() {
assertThat(this.client).isNull();
this.client = getClientBuilder().buildClient();
CosmosAsyncContainer asyncContainer = getSharedMultiPartitionCosmosContainer(this.client.asyncClient());
container = client.getDatabase(asyncContainer.getDatabase().getId()).getContainer(asyncContainer.getId());
}

@BeforeClass(groups = "emulator")
@BeforeClass(groups = "encryption")
public void beforeClass() {
TestUtils.initialized();
}

@AfterClass(groups = {"emulator"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true)
@AfterClass(groups = {"encryption"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true)
public void afterClass() {
assertThat(this.client).isNotNull();
this.client.close();
}

@Test(groups = {"emulator"}, timeOut = TIMEOUT)
@Test(groups = {"encryption"}, timeOut = TIMEOUT)
public void createItemEncrypt_readItemDecrypt() throws Exception {
CosmosItemRequestOptions requestOptions = new CosmosItemRequestOptions();
EncryptionOptions encryptionOptions = new EncryptionOptions();
Expand All @@ -88,7 +88,7 @@ public void createItemEncrypt_readItemDecrypt() throws Exception {
validateReadResponseIsValid(properties, readItem);
}

@Test(groups = {"emulator"}, timeOut = TIMEOUT)
@Test(groups = {"encryption"}, timeOut = TIMEOUT)
public void upsertItem_readItem() throws Exception {
CosmosItemRequestOptions requestOptions = new CosmosItemRequestOptions();
EncryptionOptions encryptionOptions = new EncryptionOptions();
Expand Down Expand Up @@ -135,7 +135,7 @@ private void validateQueryResponseIsValid(Pojo originalItem, Pojo result) {
assertThat(result.sensitive).isNull();
}

@Test(groups = {"emulator"}, timeOut = TIMEOUT)
@Test(groups = {"encryption"}, timeOut = TIMEOUT)
public void readItem() throws Exception {
Pojo properties = getItem(UUID.randomUUID().toString());
CosmosItemResponse<Pojo> itemResponse = container.createItem(properties);
Expand All @@ -147,7 +147,7 @@ public void readItem() throws Exception {
validateItemResponse(properties, readResponse1);
}

@Test(groups = {"emulator"}, timeOut = TIMEOUT)
@Test(groups = {"encryption"}, timeOut = TIMEOUT)
public void readAllItems() throws Exception {
Pojo properties = getItem(UUID.randomUUID().toString());
CosmosItemResponse<Pojo> itemResponse = container.createItem(properties);
Expand All @@ -160,7 +160,7 @@ public void readAllItems() throws Exception {
}


@Test(groups = {"emulator"}, timeOut = TIMEOUT)
@Test(groups = {"encryption"}, timeOut = TIMEOUT)
public void queryItems() throws Exception {
Pojo properties = getItem(UUID.randomUUID().toString());
CosmosItemResponse<Pojo> itemResponse = container.createItem(properties);
Expand All @@ -179,7 +179,7 @@ public void queryItems() throws Exception {
assertThat(feedResponseIterator3.iterator().hasNext()).isTrue();
}

@Test(groups = {"emulator"}, timeOut = TIMEOUT)
@Test(groups = {"encryption"}, timeOut = TIMEOUT)
public void queryItemsWithContinuationTokenAndPageSize() throws Exception {
List<String> actualIds = new ArrayList<>();
Pojo properties = getItem(UUID.randomUUID().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ public DecryptDataEncryptedByDotNetTest(CosmosClientBuilder clientBuilder) {
super(clientBuilder);
}

@BeforeClass(groups = "emulator")
@BeforeClass(groups = "encryption")
public void beforeClass() {
TestUtils.initialized();
}

@AfterClass(groups = "emulator")
@AfterClass(groups = "encryption")
public void afterClass() {
safeDeleteDatabase(databaseCore);
}

@AfterMethod(groups = "emulator")
@AfterMethod(groups = "encryption")
public void afterMethod() {
safeClose(client);
}

@BeforeMethod(groups = "emulator")
@BeforeMethod(groups = "encryption")
public void beforeMethod() {
keyWrapProvider = new TestKeyWrapProvider();
dekProvider = new CosmosDataEncryptionKeyProvider(keyWrapProvider);
Expand All @@ -88,7 +88,7 @@ public void beforeMethod() {
dekProvider.initialize(databaseCore, keyContainer.getId());
}

@Test(groups = "emulator")
@Test(groups = "encryption")
public void canReadKeyEncryptionKeyGeneratedByDotNet() throws Exception {
// add key generated by dotnet
ObjectNode dataEncryptionKeyProperties = TestUtils.loadPojo("./encryption/dotnet/DataEncryptionKeyProperties.json", ObjectNode.class);
Expand All @@ -106,7 +106,7 @@ public void canReadKeyEncryptionKeyGeneratedByDotNet() throws Exception {
assertThat(loadedKey.getRawKey()).isEqualTo(expectedUnWrappedKey.getDataEncryptionKey());
}

@Test(groups = "emulator")
@Test(groups = "encryption")
public void canDecryptDataEncryptedByDotNet() throws Exception {
// add key generated by dotnet
DataEncryptionKeyProperties dataEncryptionKeyProperties = TestUtils.loadPojo("./encryption/dotnet/DataEncryptionKeyProperties.json", DataEncryptionKeyProperties.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public EncryptionTests(CosmosClientBuilder clientBuilder) {
super(clientBuilder);
}

@BeforeTest(groups = {"emulator"})
@BeforeTest(groups = {"encryption"})
public void beforeTest() {
TestKeyWrapProvider keyWrapProvider = new TestKeyWrapProvider();
dekProvider = new CosmosDataEncryptionKeyProvider(keyWrapProvider);
Expand All @@ -84,18 +84,18 @@ public void beforeTest() {
EncryptionTests.dekProperties = EncryptionTests.createDek(EncryptionTests.dekProvider, dekId);
}

@BeforeClass(groups = {"emulator"})
@BeforeClass(groups = {"encryption"})
public void beforeClass() {
TestUtils.initialized();
client = getClientBuilder().buildAsyncClient();
}

@AfterMethod(groups = {"emulator"})
@AfterMethod(groups = {"encryption"})
public void afterTest() {
safeClose(client);
}

@AfterClass(groups = {"emulator"})
@AfterClass(groups = {"encryption"})
public void afterClass() {
safeDeleteDatabase(databaseCore);
}
Expand Down Expand Up @@ -138,7 +138,7 @@ public int hashCode() {
}
}

@Test(groups = {"emulator"})
@Test(groups = {"encryption"})
public void encryptionCreateDek() {
String dekId = "anotherDek";
DataEncryptionKeyProperties dekProperties = EncryptionTests.createDek(EncryptionTests.dekProvider, dekId);
Expand Down Expand Up @@ -167,7 +167,7 @@ public void encryptionCreateDek() {
assertThat(dekProperties).isEqualTo(readProperties);
}

@Test(groups = {"emulator"}, timeOut = TIMEOUT)
@Test(groups = {"encryption"}, timeOut = TIMEOUT)
public void createItemEncrypt_readItemDecrypt() throws Exception {
CosmosItemRequestOptions requestOptions = new CosmosItemRequestOptions();
EncryptionOptions encryptionOptions = new EncryptionOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public CosmosAsyncDatabase getDatabase(String id) {
}
}

@BeforeSuite(groups = {"simple", "long", "direct", "multi-master", "emulator", "non-emulator"}, timeOut = SUITE_SETUP_TIMEOUT)
@BeforeSuite(groups = {"simple", "long", "direct", "multi-master", "encryption", "non-emulator"}, timeOut = SUITE_SETUP_TIMEOUT)
public static void beforeSuite() {

logger.info("beforeSuite Started");
Expand All @@ -203,7 +203,7 @@ public static void beforeSuite() {
}
}

@AfterSuite(groups = {"simple", "long", "direct", "multi-master", "emulator", "non-emulator"}, timeOut = SUITE_SHUTDOWN_TIMEOUT)
@AfterSuite(groups = {"simple", "long", "direct", "multi-master", "encryption", "non-emulator"}, timeOut = SUITE_SHUTDOWN_TIMEOUT)
public static void afterSuite() {

logger.info("afterSuite Started");
Expand Down
Loading