@@ -15,28 +15,42 @@ public BashEndToEndTests(TestFixture fixture)
15
15
{
16
16
}
17
17
18
- [ Fact ( Skip = "Flaky test. Need to fix" ) ]
18
+ [ Fact ]
19
19
public async Task BlobTriggerToBlobTest ( )
20
20
{
21
- string name = Guid . NewGuid ( ) . ToString ( ) ;
22
- string blobContents = "My Test Blob" ;
23
- CloudBlobContainer inputContainer = Fixture . BlobClient . GetContainerReference ( "test-input-bash" ) ;
24
- inputContainer . CreateIfNotExists ( ) ;
25
- CloudBlockBlob inputBlob = inputContainer . GetBlockBlobReference ( name ) ;
26
- await inputBlob . UploadTextAsync ( blobContents ) ;
27
-
21
+ // the trigger blob was written by the fixture init code
22
+ // here we just wait for the output blob
28
23
CloudBlobContainer outputContainer = Fixture . BlobClient . GetContainerReference ( "test-output-bash" ) ;
29
- var resultBlob = outputContainer . GetBlockBlobReference ( name ) ;
24
+ var resultBlob = outputContainer . GetBlockBlobReference ( Fixture . TestBlobName ) ;
30
25
await TestHelpers . WaitForBlobAsync ( resultBlob ) ;
31
26
32
27
string resultContents = resultBlob . DownloadText ( ) ;
33
- Assert . Equal ( blobContents , resultContents . Trim ( ) ) ;
28
+ Assert . Equal ( Fixture . TestBlobContents , resultContents . Trim ( ) ) ;
34
29
}
35
30
36
31
public class TestFixture : EndToEndTestFixture
37
32
{
38
33
public TestFixture ( ) : base ( @"TestScripts\Bash" , "bash" )
34
+ {
35
+ }
36
+
37
+ public string TestBlobContents { get ; private set ; }
38
+
39
+ public string TestBlobName { get ; private set ; }
40
+
41
+ protected override void CreateTestStorageEntities ( )
39
42
{
43
+ base . CreateTestStorageEntities ( ) ;
44
+
45
+ TestBlobContents = "My Test Blob" ;
46
+ TestBlobName = Guid . NewGuid ( ) . ToString ( ) ;
47
+
48
+ // write the test blob before the host starts, so it gets picked
49
+ // up relatively quickly by the blob trigger test
50
+ CloudBlobContainer inputContainer = BlobClient . GetContainerReference ( "test-input-bash" ) ;
51
+ inputContainer . CreateIfNotExists ( ) ;
52
+ CloudBlockBlob inputBlob = inputContainer . GetBlockBlobReference ( TestBlobName ) ;
53
+ inputBlob . UploadText ( TestBlobContents ) ;
40
54
}
41
55
}
42
56
}
0 commit comments