Skip to content

Compute help file update and test fix #2866

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

Merged
merged 4 commits into from
Sep 2, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,6 @@ public void ExecuteRunnerTests()
return;
}

Assert.False(string.IsNullOrEmpty(csmAuth));
Assert.True(csmAuth.Contains("AADTenant"));

var envDictionary = TestUtilities.ParseConnectionString(csmAuth);
var testEnv = new TestEnvironment(envDictionary);
Assert.NotNull(testEnv.Tenant);
Assert.NotNull(testEnv.SubscriptionId);
Assert.NotNull(testEnv.ClientId);
Assert.True(envDictionary.ContainsKey("ApplicationSecret"));

var authenticationContext = new AuthenticationContext("https://login.windows.net/" + testEnv.Tenant);
var credential = new ClientCredential(testEnv.ClientId, envDictionary["ApplicationSecret"]);

var result = authenticationContext.AcquireToken("https://management.core.windows.net/", clientCredential: credential);

Assert.NotNull(result.AccessToken);
envDictionary["RawToken"] = result.AccessToken;

FixCSMAuthEnvVariable(envDictionary);

Console.WriteLine(Environment.GetEnvironmentVariable("TEST_CSM_ORGID_AUTHENTICATION"));

var testFile = File.ReadAllLines("ScenarioTests\\RunnerTests.csv");
foreach (var line in testFile)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
{
public partial class VMDynamicTests
{
public VMDynamicTests() { }

public VMDynamicTests(Xunit.Abstractions.ITestOutputHelper output)
{
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@

function get_all_vm_locations
{
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
{
$namespace = "Microsoft.Compute"
$type = "virtualMachines"
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
{
$namespace = "Microsoft.Compute"
$type = "virtualMachines"
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}

if ($location -eq $null)
{
$st = Write-Verbose 'Getting all Azure location - End';
return @("West US", "East US")
} else
{
$st = Write-Verbose 'Getting all Azure location - End';
return $location.Locations
}
}
if ($location -eq $null)
{
$st = Write-Verbose 'Getting all Azure location - End';
return @("West US", "East US")
}
else
{
$st = Write-Verbose 'Getting all Azure location - End';
return $location.Locations
}
}

$st = Write-Verbose 'Getting all Azure location - End';
return @("West US", "East US")
return @("West US", "East US")
}

function get_all_standard_vm_sizes
Expand Down Expand Up @@ -336,7 +337,14 @@ function Run-VMDynamicTests
$st = (func_create_and_setup_nic_ids $random_seed) | Out-File -Encoding ASCII -Append -FilePath $generated_file_name -Force;
$st = $func_create_and_setup_vm_config_object | Out-File -Encoding ASCII -Append -FilePath $generated_file_name -Force;

$loc_name_str = $locations[$i % $locations.Count];
if ($locations.Count -eq 1)
{
$loc_name_str = $locations
}
else
{
$loc_name_str = $locations[$i % $locations.Count];
}

if ($target_location -ne $null -and $target_location -ne '')
{
Expand Down
Loading