Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added x-ms-client-request-id #1271

Merged
merged 5 commits into from
Jul 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/ResourceManagement/Compute/Compute.Tests/Compute.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,18 @@
<HintPath>..\..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Microsoft.Rest.ClientRuntime.1.0.3\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.1.0.12\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit">
<HintPath>$(LibraryNugetPackageFolder)\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public static ComputeManagementClient GetComputeManagementClient(TestEnvironment
{
handler.IsPassThrough = true;
var client = TestBase.GetServiceClient<ComputeManagementClient>(factory, handler);
client.LongRunningOperationRetryTimeout = 0;
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
{
client.LongRunningOperationRetryTimeout = 0;
}
client.SubscriptionId = factory.GetTestEnvironment().SubscriptionId;
return client;
}
Expand All @@ -48,7 +51,10 @@ public static ResourceManagementClient GetResourceManagementClient(RecordedDeleg
handler.IsPassThrough = true;
var factory = new CSMTestEnvironmentFactory();
var client = TestBase.GetServiceClient<ResourceManagementClient>(factory, handler);
client.LongRunningOperationRetryTimeout = 0;
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
{
client.LongRunningOperationRetryTimeout = 0;
}
client.SubscriptionId = factory.GetTestEnvironment().SubscriptionId;
return client;
}
Expand All @@ -58,16 +64,24 @@ public static NetworkResourceProviderClient GetNetworkResourceProviderClient(Rec
handler.IsPassThrough = true;
var factory = new CSMTestEnvironmentFactory();
var client = TestBase.GetServiceClient<NetworkResourceProviderClient>(factory, handler);
client.LongRunningOperationRetryTimeout = 0;
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
{
client.LongRunningOperationRetryTimeout = 0;
}
client.SubscriptionId = factory.GetTestEnvironment().SubscriptionId;
return client;
}

public static StorageManagementClient GetStorageManagementClient(RecordedDelegatingHandler handler)
{
handler.IsPassThrough = true;
var client = TestBase.GetServiceClient<StorageManagementClient>(new CSMTestEnvironmentFactory(), handler);
client.LongRunningOperationRetryTimeout = 0;
var factory = new CSMTestEnvironmentFactory();
var client = TestBase.GetServiceClient<StorageManagementClient>(factory, handler);
if (HttpMockServer.Mode == HttpRecorderMode.Playback)
{
client.LongRunningOperationRetryTimeout = 0;
}
client.SubscriptionId = factory.GetTestEnvironment().SubscriptionId;
return client;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private void VerifyInvalidFDUDValuesFail()
{"testTag", "1"},
},
};
typeof(Resource).GetProperty("ProvisioningState").SetValue(inputAvailabilitySet, "InProgress");
typeof(AvailabilitySet).GetProperty("ProvisioningState").SetValue(inputAvailabilitySet, "InProgress");

// function to test the limits available.
inputAvailabilitySet.PlatformFaultDomainCount = FDTooLow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ExtImgTests
// 2- Put a VM Image Extension
//PUT http://localhost:449/providers/Microsoft.Compute/locations/westus/publishers/Microsoft.Windows/artifacttypes/vmextension/types/vmaccess/versions/1.1.0?api-version=2014-12-01-preview HTTP/1.1
//{
// "name": "1.1.0",
// "name": "2.0",
// "location": "westus",

// "properties": {
Expand All @@ -75,8 +75,8 @@ public class ExtImgTests
private class VirtualMachineExtensionImageGetParameters
{
public string Location = "westus";
public string PublisherName = "Microsoft.Windows";
public string Type = "vmaccess";
public string PublisherName = "Microsoft.Compute";
public string Type = "VMAccessAgent";
public string FilterExpression = "";
}

Expand All @@ -97,14 +97,14 @@ public void TestExtImgGet()
parameters.Location,
parameters.PublisherName,
parameters.Type,
"1.1.0");
"2.0");

Assert.True(vmimageext.Name == "1.1.0");
Assert.True(vmimageext.Name == "2.0");
Assert.True(vmimageext.Location == "westus");

Assert.True(vmimageext.OperatingSystem == "Windows");
Assert.True(vmimageext.ComputeRole == "PaaS");
Assert.True(vmimageext.HandlerSchema == "");
Assert.True(vmimageext.ComputeRole == "IaaS");
Assert.True(vmimageext.HandlerSchema == null);
Assert.True(vmimageext.VmScaleSetEnabled == false);
Assert.True(vmimageext.SupportsMultipleExtensions == false);
}
Expand All @@ -125,7 +125,7 @@ public void TestExtImgListTypes()
parameters.PublisherName);

Assert.True(vmextimg.Count > 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "vmaccess") != 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "VMAccessAgent") != 0);
}
}

Expand All @@ -145,7 +145,7 @@ public void TestExtImgListVersionsNoFilter()
parameters.Type);

Assert.True(vmextimg.Count > 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "1.1.0") != 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "2.0") != 0);
}
}

Expand All @@ -167,7 +167,7 @@ public void TestExtImgListVersionsFilters()
parameters.Type,
f => f.Name.StartsWith("1.1"));
Assert.True(vmextimg.Count > 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "1.1.0") != 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "2.0") != 0);

// Filter: startswith - Negative Test
parameters.FilterExpression = "$filter=startswith(name,'1.0')";
Expand All @@ -177,7 +177,7 @@ public void TestExtImgListVersionsFilters()
parameters.Type,
f => f.Name.StartsWith("1.0"));
Assert.True(vmextimg.Count == 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "1.1.0") == 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "2.0") == 0);

// Filter: top - Positive Test
parameters.FilterExpression = "$top=1";
Expand All @@ -187,7 +187,7 @@ public void TestExtImgListVersionsFilters()
parameters.Type,
top: 1);
Assert.True(vmextimg.Count == 1);
Assert.True(vmextimg.Count(vmi => vmi.Name == "1.1.0") != 0);
Assert.True(vmextimg.Count(vmi => vmi.Name == "2.0") != 0);

// Filter: top - Negative Test
parameters.FilterExpression = "$top=0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ VirtualMachineExtension GetTestVMExtension()
Settings = "{}",
ProtectedSettings = "{}"
};
typeof(VirtualMachineExtension).GetProperty("Name").SetValue(vmExtension, "vmext01");
typeof(VirtualMachineExtension).GetProperty("Type").SetValue(vmExtension, "Microsoft.Compute/virtualMachines/extensions");
typeof(Resource).GetProperty("Name").SetValue(vmExtension, "vmext01");
typeof(Resource).GetProperty("Type").SetValue(vmExtension, "Microsoft.Compute/virtualMachines/extensions");

return vmExtension;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ private void ValidateVMExtension(VirtualMachineExtension vmExtExpected, VirtualM
Assert.True(vmExtExpected.VirtualMachineExtensionType == vmExtReturned.VirtualMachineExtensionType);
Assert.True(vmExtExpected.AutoUpgradeMinorVersion == vmExtReturned.AutoUpgradeMinorVersion);
Assert.True(vmExtExpected.TypeHandlerVersion == vmExtReturned.TypeHandlerVersion);
Assert.True(vmExtExpected.Settings == vmExtReturned.Settings);
Assert.True(vmExtExpected.Settings.ToString() == vmExtReturned.Settings.ToString());
}

private void ValidateVMExtensionInstanceView(VirtualMachineExtensionInstanceView vmExtInstanceView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
//

using System;
using Microsoft.Azure;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
Expand Down Expand Up @@ -66,6 +67,10 @@ public void TestListUsages()

m_CrpClient.VirtualMachines.Delete(rgName, inputVM.Name);
}
catch (Exception e)
{
Assert.Null(e);
}
finally
{
m_ResourcesClient.ResourceGroups.Delete(rgName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void TestVMImageListFilters()
"MicrosoftWindowsServer",
"WindowsServer",
"2012-R2-Datacenter",
top: 1);
top: 0);
Assert.True(vmimages.Count == 0);

// Filter: top - Positive Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected StorageAccount CreateStorageAccount(string rgName, string storageAccou
StringComparer.OrdinalIgnoreCase.Equals(t.Name, storageAccountName));
}

return storageAccountOutput;
return m_SrpClient.StorageAccounts.GetProperties(rgName, storageAccountName);
}
catch
{
Expand Down Expand Up @@ -376,8 +376,8 @@ protected VirtualMachine CreateDefaultVMInput(string rgName, string storageAccou
}
};

typeof(VirtualMachine).GetProperty("Name").SetValue(vm, TestUtilities.GenerateName("vm"));
typeof(VirtualMachine).GetProperty("Type").SetValue(vm, TestUtilities.GenerateName("Microsoft.Compute/virtualMachines"));
typeof(Resource).GetProperty("Name").SetValue(vm, TestUtilities.GenerateName("vm"));
typeof(Resource).GetProperty("Type").SetValue(vm, TestUtilities.GenerateName("Microsoft.Compute/virtualMachines"));
return vm;
}

Expand Down
Loading