@@ -15,28 +15,42 @@ public BashEndToEndTests(TestFixture fixture)
1515 {
1616 }
1717
18- [ Fact ( Skip = "Flaky test. Need to fix" ) ]
18+ [ Fact ]
1919 public async Task BlobTriggerToBlobTest ( )
2020 {
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
2823 CloudBlobContainer outputContainer = Fixture . BlobClient . GetContainerReference ( "test-output-bash" ) ;
29- var resultBlob = outputContainer . GetBlockBlobReference ( name ) ;
24+ var resultBlob = outputContainer . GetBlockBlobReference ( Fixture . TestBlobName ) ;
3025 await TestHelpers . WaitForBlobAsync ( resultBlob ) ;
3126
3227 string resultContents = resultBlob . DownloadText ( ) ;
33- Assert . Equal ( blobContents , resultContents . Trim ( ) ) ;
28+ Assert . Equal ( Fixture . TestBlobContents , resultContents . Trim ( ) ) ;
3429 }
3530
3631 public class TestFixture : EndToEndTestFixture
3732 {
3833 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 ( )
3942 {
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 ) ;
4054 }
4155 }
4256 }
0 commit comments