Skip to content

Commit 7119e23

Browse files
rnpmsftgapra-msft
andauthored
Refactored test header logic into a global spock extension (Azure#22573)
* Setup packages for the data movement library (Azure#22303) * Removed blob data movement package, renamed common data movement to d… (Azure#22430) * Refactored test header logic into a global spock extension * Added version tag for assembly dependency * Resolved infinite recursion on self-dependency in generate_from_source_pom.py * Changed infinite recursion fix to @alzimmermsft implementation from Azure#22583 * Created TestNameProvider, decoupled TestHeaderExtension/StorageSpec * Removed duplicate header print, changed maven execution id's to prevent overriding parent POM + better relay execution goals, removed maven self-dependency (now using surefire classpath dependency) * Changed surefire dependency to local repository (resists edge case user changes to target path), fixed assembly paths for *nix-compatibility * Removed DMLib WIP files to merge into main * Changed TestHeaderExtension from groovy to java for consistency, renamed variables/class names for clarity, final on new classes Co-authored-by: Gauri Prasad <51212198+gapra-msft@users.noreply.github.com>
1 parent bb94d10 commit 7119e23

File tree

25 files changed

+109
-141
lines changed

25 files changed

+109
-141
lines changed

sdk/storage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/OptionsBagTest.groovy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ import spock.lang.Specification
99

1010
class OptionsBagTest extends Specification {
1111

12-
def setup() {
13-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
14-
String className = specificationContext.getCurrentSpec().getName()
15-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
16-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
17-
}
18-
1912
def "SetAccessTier constructor"() {
2013
setup:
2114
def url = "https://account.blob.core.windows.net/container/blob"

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/BlobChangefeedPagedFluxTest.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ class BlobChangefeedPagedFluxTest extends Specification {
2727
List<BlobChangefeedEventWrapper> mockEventWrappers
2828

2929
def setup() {
30-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
31-
String className = specificationContext.getCurrentSpec().getName()
32-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
33-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
3430
setupEvents()
3531
mockContainer = mock(BlobContainerAsyncClient.class)
3632
mockChangefeedFactory = mock(ChangefeedFactory.class)

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/BlobChunkedDownloaderTest.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ class BlobChunkedDownloaderTest extends APISpec {
1515
BlobChunkedDownloaderFactory factory
1616

1717
def setup() {
18-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
19-
String className = specificationContext.getCurrentSpec().getName()
20-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
21-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
2218
def cc = primaryBlobServiceAsyncClient.getBlobContainerAsyncClient(generateContainerName())
2319
cc.create().block()
2420
bc = Spy(cc.getBlobAsyncClient(generateBlobName()))

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/ChangefeedCursorTest.groovy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ import java.time.OffsetDateTime
1212

1313
class ChangefeedCursorTest extends Specification {
1414

15-
def setup() {
16-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
17-
String className = specificationContext.getCurrentSpec().getName()
18-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
19-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
20-
}
21-
2215
String urlHost = 'testaccount.blob.core.windows.net'
2316
OffsetDateTime endTime = OffsetDateTime.MAX
2417

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/ChangefeedTest.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ class ChangefeedTest extends Specification {
3737
String urlHost = 'testaccount.blob.core.windows.net'
3838

3939
def setup() {
40-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
41-
String className = specificationContext.getCurrentSpec().getName()
42-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
43-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
4440
mockContainer = mock(BlobContainerAsyncClient.class)
4541
mockSegmentFactory = mock(SegmentFactory.class)
4642

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/ChunkTest.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ class ChunkTest extends Specification {
4444
List<AvroObject> mockAvroObjects
4545

4646
def setup() {
47-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
48-
String className = specificationContext.getCurrentSpec().getName()
49-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
50-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
5147
setupEvents()
5248

5349
mockContainer = mock(BlobContainerAsyncClient.class)

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/SegmentTest.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ class SegmentTest extends Specification {
3838
ChangefeedCursor cfCursor
3939

4040
def setup() {
41-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
42-
String className = specificationContext.getCurrentSpec().getName()
43-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
44-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
4541
mockContainer = mock(BlobContainerAsyncClient.class)
4642
mockBlob = mock(BlobAsyncClient.class)
4743
mockShardFactory = mock(ShardFactory.class)

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/ShardTest.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ class ShardTest extends Specification {
4444
ChangefeedCursor segmentCursor
4545

4646
def setup() {
47-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
48-
String className = specificationContext.getCurrentSpec().getName()
49-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
50-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
5147
mockContainer = mock(BlobContainerAsyncClient.class)
5248
mockChunkFactory = mock(ChunkFactory.class)
5349
mockChunk0 = mock(Chunk.class)

sdk/storage/azure-storage-blob-changefeed/src/test/java/com/azure/storage/blob/changefeed/TimeUtilsTest.groovy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ import java.time.ZoneOffset
99

1010
class TimeUtilsTest extends Specification {
1111

12-
def setup() {
13-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
14-
String className = specificationContext.getCurrentSpec().getName()
15-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
16-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
17-
}
18-
1912
@Unroll
2013
def "convertPathToTime"() {
2114
expect:

sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobServiceSasModelsTest.groovy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ import java.time.ZoneOffset
1717

1818
class BlobServiceSasModelsTest extends Specification {
1919

20-
def setup() {
21-
String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase()
22-
String className = specificationContext.getCurrentSpec().getName()
23-
// Print out the test name to create breadcrumbs in our test logging in case anything hangs.
24-
System.out.printf("========================= %s.%s =========================%n", className, fullTestName)
25-
}
26-
2720
@Unroll
2821
def "BlobSASPermissions toString"() {
2922
setup:

0 commit comments

Comments
 (0)