Skip to content

Commit 41aa0af

Browse files
committed
Update Tests
1 parent 7bc1190 commit 41aa0af

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

examples/virtual-hard-disk/02-VirtualHardDisks.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ printf "\n=== Managing Virtual Hard Disks in Azure Compute ===\n"
55
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
66
azure group create -n "$groupName" --location "$location"
77

8-
printf "\n2. Creating a new storage account"
9-
result=`azure storage account new --resourcegroupname "$groupName" --name "$groupName" --location "$location" --type "$storageAccountType"`
8+
printf "\n2. Creating a new storage account '%s' in type '%s'" "$storageAccountName" "$storageAccountType"
9+
azure storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType"
1010

11-
printf "\n3. Uploading a virtual hard disk"
12-
result=`azure vhd add -o --resourcegroupname "$groupName" --destination https://"$groupName".blob.core.windows.net/test/test.vhd --localfilepath $BASEDIR/virtual-hard-disk/test.vhd`
11+
printf "\n3. Uploading a virtual hard disk to: %s" "$storageAccountName"
12+
azure vhd add -o --resourcegroupname "$groupName" --destination https://"$storageAccountName".blob.core.windows.net/test/test.vhd --localfilepath $BASEDIR/test.vhd
1313

1414
printf "\n4. Downloading a virtual hard disk"
1515

src/CLU/Commands.Common.ScenarioTest/ExampleScriptRunner.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class ExampleScriptRunner
3333
string _sessionId;
3434
Random _generator;
3535
string _resourceGroupName;
36+
string _storageAccountName;
3637
IClientFactory _clientFactory = new ClientFactory();
3738
TestContext _context;
3839
ResourceManagementClient _client;
@@ -41,6 +42,7 @@ public class ExampleScriptRunner
4142
const string locationKey = "location";
4243
const string SessionKey = "CmdletSessionID";
4344
const string storageAccountTypeKey = "storageAccountType";
45+
const string storageAccountNameKey = "storageAccountName";
4446
const string DefaultStorageAccountType = "Standard_GRS";
4547

4648
public ExampleScriptRunner(string sessionId) : this(new Random(), sessionId)
@@ -98,6 +100,7 @@ public string RunScript(string testName)
98100
{
99101
Trace.Listeners.Add(listener);
100102
_resourceGroupName = CreateRandomName();
103+
_storageAccountName = CreateRandomName() + "sto";
101104
if (File.Exists(deploymentTemplatePath))
102105
{
103106
DeployTemplate(deploymentTemplatePath, _resourceGroupName);
@@ -106,8 +109,8 @@ public string RunScript(string testName)
106109
process.EnvironmentVariables[SessionKey] = _sessionId;
107110
process.EnvironmentVariables[ResourceGroupNameKey] = _resourceGroupName;
108111
process.EnvironmentVariables[locationKey] = DefaultLocation;
109-
process.EnvironmentVariables[locationKey] = DefaultLocation;
110112
process.EnvironmentVariables[storageAccountTypeKey] = DefaultStorageAccountType;
113+
process.EnvironmentVariables[storageAccountNameKey] = _storageAccountName;
111114
foreach (var helper in _context.EnvironmentHelpers)
112115
{
113116
helper.TrySetupScriptEnvironment(_context, _clientFactory, process.EnvironmentVariables);

src/CLU/Microsoft.Azure.Commands.Compute/Models/VhdDownloadContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.Compute.Models
1919
{
2020
public class VhdDownloadContext
2121
{
22-
public FileInfo LocalFilePath { get; set; }
23-
public Uri Source { get; set; }
22+
public string LocalFilePath { get; set; }
23+
public string Source { get; set; }
2424
}
2525
}

src/CLU/Microsoft.Azure.Commands.Compute/Models/VhdDownloaderModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public static VhdDownloadContext Download(DownloaderParameters downloadParameter
3232

3333
return new VhdDownloadContext
3434
{
35-
LocalFilePath = new FileInfo(downloadParameters.LocalFilePath),
36-
Source = downloadParameters.BlobUri.Uri
35+
LocalFilePath = downloadParameters.LocalFilePath,
36+
Source = downloadParameters.BlobUri.Uri.ToString()
3737
};
3838
}
3939
}

src/CLU/Microsoft.Azure.Commands.Compute/Models/VhdUploadContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.Compute.Models
1919
{
2020
public class VhdUploadContext
2121
{
22-
public FileInfo LocalFilePath { get; set; }
23-
public Uri DestinationUri { get; set; }
22+
public string LocalFilePath { get; set; }
23+
public string DestinationUri { get; set; }
2424
}
2525
}

src/CLU/Microsoft.Azure.Commands.Compute/Models/VhdUploaderModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static VhdUploadContext Upload(UploadParameters uploadParameters)
3838
var synchronizer = new BlobSynchronizer(uploadContext, uploadParameters.NumberOfUploaderThreads);
3939
if (synchronizer.Synchronize())
4040
{
41-
return new VhdUploadContext { LocalFilePath = uploadParameters.LocalFilePath, DestinationUri = uploadParameters.DestinationUri.Uri };
41+
return new VhdUploadContext { LocalFilePath = uploadParameters.LocalFilePath.ToString(), DestinationUri = uploadParameters.DestinationUri.Uri.ToString() };
4242
}
4343
return null;
4444
}

0 commit comments

Comments
 (0)