Skip to content

Commit 94916b9

Browse files
committed
Fix AzureRT test issues due to the storage cmdlet name changes
1 parent dd2b55a commit 94916b9

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/CredentialHelper.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.VisualStudio.TestTools.UnitTesting;
16+
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.Properties;
17+
using Microsoft.WindowsAzure.Commands.Storage.Common;
18+
using Microsoft.WindowsAzure.Storage.Auth;
19+
using Microsoft.WindowsAzure.Storage.Blob;
1520
using System;
1621
using System.Collections.Generic;
1722
using System.Collections.Specialized;
1823
using System.Diagnostics;
1924
using System.IO;
20-
using Microsoft.VisualStudio.TestTools.UnitTesting;
21-
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.Properties;
22-
using Microsoft.WindowsAzure.Storage.Auth;
23-
using Microsoft.WindowsAzure.Storage.Blob;
25+
using System.Management.Automation;
2426

2527
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests
2628
{
@@ -263,25 +265,29 @@ public static void CopyTestData(string srcContainer, string srcBlob, string dest
263265
// Create a container
264266
try
265267
{
266-
vmPowershellCmdlets.RunPSScript("Get-AzureStorageContainer -Name " + destContainer);
268+
vmPowershellCmdlets.RunPSScript(String.Format("{0}-{1} -Name {2}",
269+
VerbsCommon.Get, StorageNouns.Container, destContainer));
267270
}
268271
catch
269272
{
270273
// Create a container.
271-
vmPowershellCmdlets.RunPSScript("New-AzureStorageContainer -Name " + destContainer);
274+
vmPowershellCmdlets.RunPSScript(String.Format("{0}-{1} -Name {2}",
275+
VerbsCommon.New, StorageNouns.Container, destContainer));
272276
}
273277

274278
// Make SAS Uri for the source blob.
275279
string srcSasUri = Utilities.GenerateSasUri(CredentialHelper.CredentialBlobUriFormat, storageAccount, storageAccountKey, srcContainer, srcBlob);
276280

277281
if (string.IsNullOrEmpty(destBlob))
278282
{
279-
vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcContainer {0} -SrcBlob {1} -DestContainer {2} -Force", srcContainer, srcBlob, destContainer));
283+
vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcContainer {2} -SrcBlob {3} -DestContainer {4} -Force",
284+
VerbsLifecycle.Start, StorageNouns.CopyBlob, srcContainer, srcBlob, destContainer));
280285
destBlob = srcBlob;
281286
}
282287
else
283288
{
284-
vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));
289+
vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcUri \"{2}\" -DestContainer {3} -DestBlob {4} -Force",
290+
VerbsLifecycle.Start, StorageNouns.CopyBlob, srcSasUri, destContainer, destBlob));
285291
}
286292

287293
for (int i = 0; i < 60; i++)

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTestCommonVhd.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
15+
using Microsoft.VisualStudio.TestTools.UnitTesting;
16+
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
17+
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
18+
using Microsoft.WindowsAzure.Commands.Storage.Common;
1619
using System;
1720
using System.IO;
1821
using System.Linq;
22+
using System.Management.Automation;
1923
using System.Reflection;
20-
using Microsoft.VisualStudio.TestTools.UnitTesting;
21-
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
22-
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
2324

2425
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests
2526
{
@@ -166,7 +167,8 @@ public void AzureDiskTest()
166167

167168
private void CopyCommonVhd(string vhdContainerName, string vhdName, string myVhdName)
168169
{
169-
vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcContainer {0} -SrcBlob {1} -DestContainer {2} -DestBlob {3}", vhdContainerName, vhdName, vhdContainerName, myVhdName));
170+
vmPowershellCmdlets.RunPSScript(string.Format("{0}-{1} -SrcContainer {2} -SrcBlob {3} -DestContainer {4} -DestBlob {5}",
171+
VerbsLifecycle.Start, StorageNouns.CopyBlob, vhdContainerName, vhdName, vhdContainerName, myVhdName));
170172
}
171173

172174
[TestMethod(), TestCategory(Category.Functional), TestCategory(Category.BVT), TestProperty("Feature", "IAAS"), Priority(1), Owner("hylee"), Description("Test the cmdlet ((Add,Get,Save,Update,Remove)-AzureVMImage)")]

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PIRCmdletInfo;
3434
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.NetworkCmdletInfo;
3535
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.SubscriptionCmdletInfo;
36+
using Microsoft.WindowsAzure.Commands.Storage.Common;
3637
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3738
using Microsoft.WindowsAzure.Management.Network.Models;
3839
using Microsoft.WindowsAzure.Storage.Blob;
@@ -176,7 +177,8 @@ private Collection<T> RunPSCmdletAndReturnAllHelper<T>(PowershellCore.CmdletsInf
176177
public CopyState CheckCopyBlobStatus(string destContainer, string destBlob, bool debug = false)
177178
{
178179
List<string> st = new List<string>();
179-
st.Add(string.Format("Get-AzureStorageBlobCopyState -Container {0} -Blob {1}", destContainer, destBlob));
180+
st.Add(string.Format("{0}-{1} -Container {2} -Blob {3}",
181+
VerbsCommon.Get, StorageNouns.CopyBlobStatus, destContainer, destBlob));
180182

181183
WindowsAzurePowershellScript azurePowershellCmdlet = new WindowsAzurePowershellScript(st);
182184
return (CopyState)azurePowershellCmdlet.Run(debug)[0].BaseObject;

0 commit comments

Comments
 (0)