Skip to content

Commit 173db13

Browse files
author
Hovsep
committed
Merge pull request #1532 from huangpf/clu
AzureRT - VHD Commands & Tests
2 parents c7bb764 + a877182 commit 173db13

File tree

103 files changed

+11171
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+11171
-390
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Param(
2+
[string]$resourceGroupName,
3+
[string]$resourceGroupLocation
4+
)
5+
6+
Write-Host "Skip"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -e
3+
printf "\n=== Managing Virtual Hard Disks in Azure Compute ===\n"
4+
5+
printf "\n1. Creating a new resource group: %s and location: %s.\n" "$groupName" "$location"
6+
azure group create -n "$groupName" --location "$location"
7+
8+
printf "\n2. Creating a new storage account '%s' in type '%s'.\n" "$storageAccountName" "$storageAccountType"
9+
azure storage account new --resourcegroupname "$groupName" --name "$storageAccountName" --location "$location" --type "$storageAccountType"
10+
11+
printf "\n3. Uploading a virtual hard disk to: %s.\n" "$storageAccountName"
12+
azure vhd add -o --resourcegroupname "$groupName" --destination https://"$storageAccountName".blob.core.windows.net/test/test.vhd --localfilepath $BASEDIR/test.vhd
13+
14+
printf "\n4. Downloading a virtual hard disk"
15+
azure vhd save -o --resourcegroupname "$groupName" --sourceuri https://"$storageAccountName".blob.core.windows.net/test/test.vhd --localfilepath ./test_downloaded_by_clu.vhd
16+
17+
printf "\n5. Validating the downloaded file is the same.\n"
18+
diffResult=`diff ./test_downloaded_by_clu.vhd $BASEDIR/test_uploaded_byps.vhd`
19+
if [ "$diffResult" = "" ]; then
20+
echo "Checked"
21+
else
22+
echo "Different!" 1>&2
23+
exit 1
24+
fi
25+
26+
printf "\n6. Removing resource group: %s.\n" "$groupName"
27+
azure group remove -n "$groupName" -f

examples/virtual-hard-disk/test.vhd

26.1 MB
Binary file not shown.
Binary file not shown.

src/CLU/CLUCoreCLR.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Co
5757
EndProject
5858
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.ScenarioTest.CLU", "Microsoft.ScenarioTests.CLU\Microsoft.ScenarioTest.CLU.xproj", "{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}"
5959
EndProject
60+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "VhdManagement", "VhdManagement\VhdManagement.xproj", "{094A32EA-BABC-4A0C-9B6C-3CF7F6EABEC9}"
61+
EndProject
62+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Sync", "Sync\Sync.xproj", "{6EDCB32A-8420-48FC-99CE-94BEA12D2FD2}"
63+
ProjectSection(ProjectDependencies) = postProject
64+
{094A32EA-BABC-4A0C-9B6C-3CF7F6EABEC9} = {094A32EA-BABC-4A0C-9B6C-3CF7F6EABEC9}
65+
EndProjectSection
66+
EndProject
6067
Global
6168
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6269
Debug|Any CPU = Debug|Any CPU
@@ -147,6 +154,14 @@ Global
147154
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
148155
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
149156
{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.Build.0 = Release|Any CPU
157+
{094A32EA-BABC-4A0C-9B6C-3CF7F6EABEC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
158+
{094A32EA-BABC-4A0C-9B6C-3CF7F6EABEC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
159+
{094A32EA-BABC-4A0C-9B6C-3CF7F6EABEC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
160+
{094A32EA-BABC-4A0C-9B6C-3CF7F6EABEC9}.Release|Any CPU.Build.0 = Release|Any CPU
161+
{6EDCB32A-8420-48FC-99CE-94BEA12D2FD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
162+
{6EDCB32A-8420-48FC-99CE-94BEA12D2FD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
163+
{6EDCB32A-8420-48FC-99CE-94BEA12D2FD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
164+
{6EDCB32A-8420-48FC-99CE-94BEA12D2FD2}.Release|Any CPU.Build.0 = Release|Any CPU
150165
EndGlobalSection
151166
GlobalSection(SolutionProperties) = preSolution
152167
HideSolutionNode = FALSE

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ 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;
3940
const string DefaultLocation = "westus";
4041
const string ResourceGroupNameKey = "groupName";
4142
const string locationKey = "location";
4243
const string SessionKey = "CmdletSessionID";
44+
const string storageAccountTypeKey = "storageAccountType";
45+
const string storageAccountNameKey = "storageAccountName";
46+
const string DefaultStorageAccountType = "Standard_GRS";
4347

4448
public ExampleScriptRunner(string sessionId) : this(new Random(), sessionId)
4549
{
@@ -96,6 +100,7 @@ public string RunScript(string testName)
96100
{
97101
Trace.Listeners.Add(listener);
98102
_resourceGroupName = CreateRandomName();
103+
_storageAccountName = CreateRandomName() + "sto";
99104
if (File.Exists(deploymentTemplatePath))
100105
{
101106
DeployTemplate(deploymentTemplatePath, _resourceGroupName);
@@ -104,6 +109,8 @@ public string RunScript(string testName)
104109
process.EnvironmentVariables[SessionKey] = _sessionId;
105110
process.EnvironmentVariables[ResourceGroupNameKey] = _resourceGroupName;
106111
process.EnvironmentVariables[locationKey] = DefaultLocation;
112+
process.EnvironmentVariables[storageAccountTypeKey] = DefaultStorageAccountType;
113+
process.EnvironmentVariables[storageAccountNameKey] = _storageAccountName;
107114
foreach (var helper in _context.EnvironmentHelpers)
108115
{
109116
helper.TrySetupScriptEnvironment(_context, _clientFactory, process.EnvironmentVariables);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,19 @@ public SampleTest(ScenarioTestFixture fixture)
3131
{
3232
_collectionState = fixture;
3333
}
34+
3435
[Fact]
3536
public void RunSampleTest()
3637
{
3738
var helper = _collectionState.GetRunner("resource-management");
3839
helper.RunScript("01-ResourceGroups");
3940
}
4041

42+
[Fact]
43+
public void RunVirtualHardDiskTest()
44+
{
45+
var helper = _collectionState.GetRunner("virtual-hard-disk");
46+
helper.RunScript("01-VirtualHardDisks");
47+
}
4148
}
4249
}

src/CLU/Microsoft.Azure.Commands.Compute/Microsoft.Azure.Commands.Compute.xproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
<PropertyGroup>
1515
<SchemaVersion>2.0</SchemaVersion>
1616
</PropertyGroup>
17+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
18+
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
19+
</PropertyGroup>
1720
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
1821
</Project>

0 commit comments

Comments
 (0)