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

Kv live test config update #7672

Merged
merged 37 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6f5a68d
config update
g2vinay Dec 30, 2019
efdd70f
test config update
g2vinay Dec 31, 2019
7e80d26
tests update
g2vinay Jan 2, 2020
bea87b6
config update
g2vinay Jan 3, 2020
bf67813
KV tests update
g2vinay Jan 5, 2020
7a77f61
enable parallel runs
g2vinay Jan 5, 2020
189d8d5
duration update
g2vinay Jan 6, 2020
62a4194
update timeout
g2vinay Jan 6, 2020
9985324
update tests
g2vinay Jan 6, 2020
a6625d2
parallel update
g2vinay Jan 6, 2020
6c02719
update tests
g2vinay Jan 6, 2020
e3eb7a3
test update
g2vinay Jan 6, 2020
f5d901d
test config update
g2vinay Jan 6, 2020
8343144
tests update
g2vinay Jan 8, 2020
bab0911
test updt
g2vinay Jan 8, 2020
b8bccf1
test update
g2vinay Jan 8, 2020
bdbc461
test update
g2vinay Jan 8, 2020
3261205
time update
g2vinay Jan 8, 2020
49c21f1
Update tests.yml for Azure Pipelines
g2vinay Jan 8, 2020
e09ce75
tests update
g2vinay Jan 8, 2020
92ee894
tests update
g2vinay Jan 9, 2020
de6b4d1
Update tests.yml for Azure Pipelines
g2vinay Jan 9, 2020
2a8e8db
test update
g2vinay Jan 9, 2020
55086f8
Merge branch 'kv-live-test-config-update' of https://github.com/g2vin…
g2vinay Jan 9, 2020
9de1626
updates test logic
g2vinay Jan 9, 2020
dce6d60
test update
g2vinay Jan 9, 2020
9be618f
time change
g2vinay Jan 11, 2020
b9cafa0
test update
g2vinay Jan 11, 2020
08b545d
test updates
g2vinay Jan 15, 2020
6df4f1f
checkstyle fixes
g2vinay Jan 22, 2020
ad3ffb8
update setup
g2vinay Jan 23, 2020
d88ba2e
Merge remote-tracking branch 'upstream/master' into kv-live-test-conf…
g2vinay Jan 23, 2020
e7d2cb1
randomize resource ids
g2vinay Jan 23, 2020
54be931
update ARM permissions
g2vinay Jan 23, 2020
33e5d1f
update config
g2vinay Jan 24, 2020
8713b76
updare mode
g2vinay Jan 24, 2020
4b4b6e4
update surefire config
g2vinay Jan 24, 2020
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
13 changes: 13 additions & 0 deletions sdk/keyvault/azure-security-keyvault-certificates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
<tag>HEAD</tag>
</scm>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version> <!-- {x-version-update;org.apache.maven.plugins:maven-surefire-plugin;external_dependency} -->
<configuration>
<rerunFailingTestsCount>3</rerunFailingTestsCount>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ protected void beforeTest() {
@Test
public void createCertificate() {
createCertificateRunner((policy) -> {
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate("testCer",
String certName = generateResourceId("testCer");
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate(certName,
policy);
certPoller.waitForCompletion();
KeyVaultCertificateWithPolicy expected = certPoller.getFinalResult();
assertEquals("testCer", expected.getName());
assertEquals(certName, expected.getName());
assertNotNull(expected.getProperties().getCreatedOn());
deleteAndPurgeCertificate("testCer");
deleteAndPurgeCertificate(certName);
});
}

Expand All @@ -70,7 +71,7 @@ public void createCertificateEmptyName() {

@Test
public void createCertificateNullPolicy() {
assertRunnableThrowsException(() -> client.beginCreateCertificate("tempCert", null),
assertRunnableThrowsException(() -> client.beginCreateCertificate(generateResourceId("tempCert"), null),
NullPointerException.class);
}

Expand All @@ -83,14 +84,15 @@ public void createCertoificateNull() {
@Test
public void updateCertificate() {
updateCertificateRunner((tags, updatedTags) -> {
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate("testCertificate2",
String certName = generateResourceId("testCertificate2");
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate(certName,
CertificatePolicy.getDefault(), true, tags);
certPoller.waitForCompletion();
KeyVaultCertificateWithPolicy certificate = certPoller.getFinalResult();
KeyVaultCertificate keyVaultCertificate = client.updateCertificateProperties(certificate.getProperties().setTags(updatedTags));
Map<String, String> returnedTags = keyVaultCertificate.getProperties().getTags();
validateMapResponse(updatedTags, returnedTags);
deleteAndPurgeCertificate("testCertificate2");
deleteAndPurgeCertificate(certName);
});
}

Expand All @@ -105,15 +107,16 @@ private void validateMapResponse(Map<String, String> expected, Map<String, Strin
@Test
public void updateDisabledCertificate() {
updateDisabledCertificateRunner((tags, updatedTags) -> {
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate("testCertificate3",
String certName = generateResourceId("testCertificate3");
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate(certName,
CertificatePolicy.getDefault(), false, tags);
certPoller.waitForCompletion();
KeyVaultCertificateWithPolicy certificate = certPoller.getFinalResult();
KeyVaultCertificate keyVaultCertificate = client.updateCertificateProperties(certificate.getProperties().setTags(updatedTags));
Map<String, String> returnedTags = keyVaultCertificate.getProperties().getTags();
validateMapResponse(updatedTags, returnedTags);
assertFalse(keyVaultCertificate.getProperties().isEnabled());
deleteAndPurgeCertificate("testCertificate3");
deleteAndPurgeCertificate(certName);
});
}

Expand Down Expand Up @@ -361,6 +364,7 @@ public void listCertificates() {
certPoller.waitForCompletion();
}

sleepInRecordMode(90000);
for (CertificateProperties actualKey : client.listPropertiesOfCertificates()) {
if (certificatesToList.contains(actualKey.getName())) {
certificatesToList.remove(actualKey.getName());
Expand Down Expand Up @@ -482,7 +486,7 @@ public void getCertificatePolicyNotFound() {

@Test
public void listCertificateVersions() {
String certName = "testListCertVersion";
String certName = generateResourceId("testListCertVersion");
int counter = 5;
for (int i = 0; i < counter; i++) {
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate(certName,
Expand All @@ -505,30 +509,32 @@ public void listDeletedCertificates() {
for (String certName : certificatesToDelete) {
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = client.beginCreateCertificate(certName,
CertificatePolicy.getDefault());
certPoller.waitForCompletion();
PollResponse<CertificateOperation> pollResponse = certPoller.poll();
while (!pollResponse.getStatus().isComplete()) {
sleepInRecordMode(1000);
pollResponse = certPoller.poll();
}
}

for (String certName : certificates) {
SyncPoller<DeletedCertificate, Void> poller = client.beginDeleteCertificate(certName);
PollResponse<DeletedCertificate> pollResponse = poller.poll();
poller.waitForCompletion();
}
Iterable<DeletedCertificate> deletedCertificates = client.listDeletedCertificates();
for (DeletedCertificate deletedCertificate : deletedCertificates) {
if (certificatesToDelete.contains(deletedCertificate.getName())) {
assertNotNull(deletedCertificate.getDeletedOn());
assertNotNull(deletedCertificate.getRecoveryId());
certificatesToDelete.remove(deletedCertificate.getName());
while (!pollResponse.getStatus().isComplete()) {
sleepInRecordMode(1000);
pollResponse = poller.poll();
}
assertNotNull(pollResponse.getValue());
}

assertEquals(0, certificatesToDelete.size());
sleepInRecordMode(90000);

Iterable<DeletedCertificate> deletedCertificates = client.listDeletedCertificates();
assertTrue(deletedCertificates.iterator().hasNext());
for (DeletedCertificate deletedCertificate : deletedCertificates) {
client.purgeDeletedCertificate(deletedCertificate.getName());
pollOnCertificatePurge(deletedCertificate.getName());
assertNotNull(deletedCertificate.getDeletedOn());
assertNotNull(deletedCertificate.getRecoveryId());
certificatesToDelete.remove(deletedCertificate.getName());
}
sleepInRecordMode(10000);
});
}

Expand Down Expand Up @@ -559,7 +565,7 @@ public void importCertificate() {

@Test
public void mergeCertificateNotFound() {
assertRestException(() -> client.mergeCertificate(new MergeCertificateOptions("testCert16", Arrays.asList("test".getBytes()))),
assertRestException(() -> client.mergeCertificate(new MergeCertificateOptions(generateResourceId("testCert16"), Arrays.asList("test".getBytes()))),
HttpResponseException.class, HttpURLConnection.HTTP_NOT_FOUND);
}

Expand All @@ -583,6 +589,4 @@ private DeletedCertificate pollOnCertificatePurge(String certificateName) {
System.err.printf("Deleted Key %s was not purged \n", certificateName);
return null;
}


}
Loading