Skip to content

Commit

Permalink
mgmt, add a test case for deployment beginCreate (Azure#31091)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Sep 22, 2022
1 parent 078a8b9 commit a6353b4
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 65 deletions.
2 changes: 2 additions & 0 deletions sdk/resourcemanager/azure-resourcemanager-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
--add-opens com.azure.resourcemanager.resources/com.azure.resourcemanager.resources=ALL-UNNAMED
--add-opens com.azure.core/com.azure.core.http=com.azure.resourcemanager.resources
--add-opens com.azure.core/com.azure.core.http.policy=com.azure.resourcemanager.resources

--add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED
</javaModulesSurefireArgLine>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public void canUpdateVirtualNetworkDeployment() throws Exception {
public void canDeployVirtualNetworkSyncPoll() throws Exception {
final long defaultDelayInMillis = 10 * 1000;

final String dp = "dpD" + testId;
String dp = "dpD" + testId;

// Begin create
Accepted<Deployment> acceptedDeployment = resourceClient.deployments()
Expand Down Expand Up @@ -277,6 +277,24 @@ public void canDeployVirtualNetworkSyncPoll() throws Exception {
Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollStatus);
Deployment deployment = acceptedDeployment.getFinalResult();
Assertions.assertEquals("Succeeded", deployment.provisioningState());

// with a new resource group
final String newRgName = generateRandomResourceName("rg", 10);
dp = generateRandomResourceName("dp", 10);
try {
acceptedDeployment = resourceClient.deployments()
.define(dp)
.withNewResourceGroup(resourceClient.resourceGroups().define(newRgName).withRegion(Region.US_EAST2))
.withTemplateLink(TEMPLATE_URI, CONTENT_VERSION)
.withParametersLink(PARAMETERS_URI, CONTENT_VERSION)
.withMode(DeploymentMode.COMPLETE)
.beginCreate();

deployment = acceptedDeployment.getFinalResult();
Assertions.assertEquals("Succeeded", deployment.provisioningState());
} finally {
resourceClient.resourceGroups().beginDeleteByName(newRgName);
}
}

@Test
Expand Down
Loading

0 comments on commit a6353b4

Please sign in to comment.