28
28
using Microsoft . WindowsAzure . Commands . Websites ;
29
29
using Moq ;
30
30
using Microsoft . Azure . Commands . Common . Authentication ;
31
+ using Microsoft . WindowsAzure . Commands . Common . Test ;
31
32
32
33
namespace Microsoft . WindowsAzure . Commands . Test . Websites
33
34
{
34
-
35
+
35
36
public class SaveAzureWebsiteLogTests : WebsitesTestBase
36
37
{
37
38
private Site site1 = new Site
@@ -83,13 +84,13 @@ public void SaveAzureWebsiteLogTest()
83
84
// Test
84
85
SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand ( deploymentChannel )
85
86
{
86
- Name = "website1" ,
87
+ Name = "website1" ,
87
88
ShareChannel = true ,
88
89
WebsitesClient = clientMock . Object ,
89
90
CommandRuntime = new MockCommandRuntime ( ) ,
90
91
} ;
91
92
currentProfile = new AzureSMProfile ( ) ;
92
- var subscription = new AzureSubscription { Id = new Guid ( base . subscriptionId ) } ;
93
+ var subscription = new AzureSubscription { Id = new Guid ( base . subscriptionId ) } ;
93
94
subscription . Properties [ AzureSubscription . Property . Default ] = "True" ;
94
95
currentProfile . Subscriptions [ new Guid ( base . subscriptionId ) ] = subscription ;
95
96
@@ -103,61 +104,69 @@ public void SaveAzureWebsiteLogTest()
103
104
[ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
104
105
public void SaveAzureWebsiteLogWithNoFileExtensionTest ( )
105
106
{
106
- // Setup
107
- string expectedOutput = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "file_without_ext.zip" ) ;
108
-
109
- SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement
110
- {
111
- DownloadLogsThunk = ar => new MemoryStream ( Encoding . UTF8 . GetBytes ( "test with no extension" ) )
112
- } ;
113
-
114
- // Test
115
- SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand ( deploymentChannel )
116
- {
117
- Name = "website1" ,
118
- ShareChannel = true ,
119
- WebsitesClient = clientMock . Object ,
120
- CommandRuntime = new MockCommandRuntime ( ) ,
121
- Output = "file_without_ext"
122
- } ;
123
- currentProfile = new AzureSMProfile ( ) ;
124
- var subscription = new AzureSubscription { Id = new Guid ( base . subscriptionId ) } ;
125
- subscription . Properties [ AzureSubscription . Property . Default ] = "True" ;
126
- currentProfile . Subscriptions [ new Guid ( base . subscriptionId ) ] = subscription ;
127
-
128
- getAzureWebsiteLogCommand . DefaultCurrentPath = AppDomain . CurrentDomain . BaseDirectory ;
129
- getAzureWebsiteLogCommand . ExecuteCmdlet ( ) ;
130
- Assert . Equal ( "test with no extension" , FileUtilities . DataStore . ReadFileAsText ( expectedOutput ) ) ;
107
+ TestExecutionHelpers . RetryAction (
108
+ ( ) =>
109
+ {
110
+ // Setup
111
+ string expectedOutput = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "file_without_ext.zip" ) ;
112
+
113
+ SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement
114
+ {
115
+ DownloadLogsThunk = ar => new MemoryStream ( Encoding . UTF8 . GetBytes ( "test with no extension" ) )
116
+ } ;
117
+
118
+ // Test
119
+ SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand ( deploymentChannel )
120
+ {
121
+ Name = "website1" ,
122
+ ShareChannel = true ,
123
+ WebsitesClient = clientMock . Object ,
124
+ CommandRuntime = new MockCommandRuntime ( ) ,
125
+ Output = "file_without_ext"
126
+ } ;
127
+ currentProfile = new AzureSMProfile ( ) ;
128
+ var subscription = new AzureSubscription { Id = new Guid ( base . subscriptionId ) } ;
129
+ subscription . Properties [ AzureSubscription . Property . Default ] = "True" ;
130
+ currentProfile . Subscriptions [ new Guid ( base . subscriptionId ) ] = subscription ;
131
+
132
+ getAzureWebsiteLogCommand . DefaultCurrentPath = AppDomain . CurrentDomain . BaseDirectory ;
133
+ getAzureWebsiteLogCommand . ExecuteCmdlet ( ) ;
134
+ Assert . Equal ( "test with no extension" , FileUtilities . DataStore . ReadFileAsText ( expectedOutput ) ) ;
135
+ } ) ;
131
136
}
132
137
133
- [ Fact ( Skip = "Flaky test" ) ]
138
+ [ Fact ]
134
139
[ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
135
140
public void SaveAzureWebsiteLogWithSlotTest ( )
136
141
{
137
- // Setup
138
- SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement
139
- {
140
- DownloadLogsThunk = ar => new MemoryStream ( Encoding . UTF8 . GetBytes ( "test" ) )
141
- } ;
142
-
143
- // Test
144
- SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand ( deploymentChannel )
145
- {
146
- Name = "website1" ,
147
- ShareChannel = true ,
148
- WebsitesClient = clientMock . Object ,
149
- CommandRuntime = new MockCommandRuntime ( ) ,
150
- Slot = slot
151
- } ;
152
- currentProfile = new AzureSMProfile ( ) ;
153
- var subscription = new AzureSubscription { Id = new Guid ( base . subscriptionId ) } ;
154
- subscription . Properties [ AzureSubscription . Property . Default ] = "True" ;
155
- currentProfile . Subscriptions [ new Guid ( base . subscriptionId ) ] = subscription ;
156
-
157
- getAzureWebsiteLogCommand . DefaultCurrentPath = AppDomain . CurrentDomain . BaseDirectory ;
158
- getAzureWebsiteLogCommand . ExecuteCmdlet ( ) ;
159
- Assert . Equal ( "test" , FileUtilities . DataStore . ReadFileAsText (
160
- Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , SaveAzureWebsiteLogCommand . DefaultOutput ) ) ) ;
142
+ TestExecutionHelpers . RetryAction (
143
+ ( ) =>
144
+ {
145
+ // Setup
146
+ SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement
147
+ {
148
+ DownloadLogsThunk = ar => new MemoryStream ( Encoding . UTF8 . GetBytes ( "test" ) )
149
+ } ;
150
+
151
+ // Test
152
+ SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand ( deploymentChannel )
153
+ {
154
+ Name = "website1" ,
155
+ ShareChannel = true ,
156
+ WebsitesClient = clientMock . Object ,
157
+ CommandRuntime = new MockCommandRuntime ( ) ,
158
+ Slot = slot
159
+ } ;
160
+ currentProfile = new AzureSMProfile ( ) ;
161
+ var subscription = new AzureSubscription { Id = new Guid ( base . subscriptionId ) } ;
162
+ subscription . Properties [ AzureSubscription . Property . Default ] = "True" ;
163
+ currentProfile . Subscriptions [ new Guid ( base . subscriptionId ) ] = subscription ;
164
+
165
+ getAzureWebsiteLogCommand . DefaultCurrentPath = AppDomain . CurrentDomain . BaseDirectory ;
166
+ getAzureWebsiteLogCommand . ExecuteCmdlet ( ) ;
167
+ Assert . Equal ( "test" , FileUtilities . DataStore . ReadFileAsText (
168
+ Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , SaveAzureWebsiteLogCommand . DefaultOutput ) ) ) ;
169
+ } ) ;
161
170
}
162
171
}
163
172
}
0 commit comments