Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit a1e7012

Browse files
mikeharderrickle-msft
authored andcommitted
Fix failing unit tests (#381)
Fix some unit tests to no longer depend on specific test environment.
1 parent ebdc214 commit a1e7012

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/test/java/com/microsoft/azure/storage/ContainerAPITest.groovy

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,15 @@ class ContainerAPITest extends APISpec {
16271627
def "Root explicit"() {
16281628
setup:
16291629
cu = primaryServiceURL.createContainerURL(ContainerURL.ROOT_CONTAINER_NAME)
1630+
// Create root container if not exist.
1631+
try {
1632+
cu.create(null, null, null).blockingGet()
1633+
}
1634+
catch (StorageException se) {
1635+
if (se.errorCode() != StorageErrorCode.CONTAINER_ALREADY_EXISTS) {
1636+
throw se
1637+
}
1638+
}
16301639
BlobURL bu = cu.createAppendBlobURL("rootblob")
16311640

16321641
expect:
@@ -1638,7 +1647,7 @@ class ContainerAPITest extends APISpec {
16381647
PipelineOptions po = new PipelineOptions()
16391648
po.withClient(getHttpClient())
16401649
HttpPipeline pipeline = StorageURL.createPipeline(primaryCreds, po)
1641-
AppendBlobURL bu = new AppendBlobURL(new URL("http://xclientdev3.blob.core.windows.net/rootblob"),
1650+
AppendBlobURL bu = new AppendBlobURL(new URL("http://" + primaryCreds.getAccountName() + ".blob.core.windows.net/rootblob"),
16421651
pipeline)
16431652

16441653
when:

src/test/java/com/microsoft/azure/storage/ServiceAPITest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class ServiceAPITest extends APISpec {
298298
def "Get stats"() {
299299
setup:
300300
BlobURLParts parts = URLParser.parse(primaryServiceURL.toURL())
301-
parts.withHost("xclientdev3-secondary.blob.core.windows.net")
301+
parts.withHost(primaryCreds.getAccountName() + "-secondary.blob.core.windows.net")
302302
ServiceURL secondary = new ServiceURL(parts.toURL(),
303303
StorageURL.createPipeline(primaryCreds, new PipelineOptions()))
304304
ServiceGetStatisticsResponse response = secondary.getStatistics(null).blockingGet()

0 commit comments

Comments
 (0)