-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AKS (ContainerService) update to reflect latest AKS API (#5182)
* Adding ContainerService * Completed tests * Adding session records * SessionRecords directory rename * SessionRecords directory rename * Added package release notes
- Loading branch information
Showing
82 changed files
with
41,910 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file--> | ||
<PropertyGroup> | ||
<AzureApiTag>ContainerService_2017-07-01;ContainerService_2017-09-30;ContainerService_2018-08-01-preview;ContainerService_2018-09-30-preview;</AzureApiTag> | ||
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags> | ||
</PropertyGroup> | ||
</Project> |
24 changes: 24 additions & 0 deletions
24
...erService/ContainerService.Tests/Microsoft.Azure.Management.ContainerService.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.test.reference.props'))" /> | ||
<PropertyGroup> | ||
<PackageId>Microsoft.Azure.Management.ContainerService.Tests</PackageId> | ||
<Version>1.0.0</Version> | ||
<Description>ContainerService.Tests Class Library</Description> | ||
<Authors>Microsoft Corporation</Authors> | ||
<AssemblyName>Microsoft.Azure.Management.ContainerService.Tests</AssemblyName> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Management.ContainerService\Microsoft.Azure.Management.ContainerService.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="SessionRecords\**\*.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
</ItemGroup> | ||
</Project> |
6,082 changes: 6,082 additions & 0 deletions
6,082
...ontainerService.Tests.ContainerServiceTests/ContainerListClusterAdminCredentialsTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
4,195 changes: 4,195 additions & 0 deletions
4,195
...ontainerService.Tests.ContainerServiceTests/ContainerServiceCreateManagedServiceTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
2,098 changes: 2,098 additions & 0 deletions
2,098
...ement.ContainerService.Tests.ContainerServiceTests/ContainerServiceDeleteServiceTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
6,658 changes: 6,658 additions & 0 deletions
6,658
...ment.ContainerService.Tests.ContainerServiceTests/ContainerServiceGetCredentialsTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
...t.ContainerService.Tests.ContainerServiceTests/ContainerServiceListOrchestratorsTest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"Entries": [ | ||
{ | ||
"RequestUri": "/subscriptions/c1089427-83d3-4286-9f35-5af546a6eb67/providers/Microsoft.ContainerService/locations/westus2/orchestrators?api-version=2017-09-30", | ||
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYzEwODk0MjctODNkMy00Mjg2LTlmMzUtNWFmNTQ2YTZlYjY3L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29udGFpbmVyU2VydmljZS9sb2NhdGlvbnMvd2VzdHVzMi9vcmNoZXN0cmF0b3JzP2FwaS12ZXJzaW9uPTIwMTctMDktMzA=", | ||
"RequestMethod": "GET", | ||
"RequestBody": "", | ||
"RequestHeaders": { | ||
"x-ms-client-request-id": [ | ||
"a43eceda-7c38-4e62-9243-10d452144cf9" | ||
], | ||
"accept-language": [ | ||
"en-US" | ||
], | ||
"User-Agent": [ | ||
"FxVersion/4.6.26614.01", | ||
"OSName/Windows", | ||
"OSVersion/Microsoft.Windows.10.0.18290.", | ||
"Microsoft.Azure.Management.ContainerService.ContainerServiceClient/1.0.0" | ||
] | ||
}, | ||
"ResponseHeaders": { | ||
"Cache-Control": [ | ||
"no-cache" | ||
], | ||
"Date": [ | ||
"Mon, 28 Jan 2019 20:48:20 GMT" | ||
], | ||
"Pragma": [ | ||
"no-cache" | ||
], | ||
"Server": [ | ||
"nginx" | ||
], | ||
"x-ms-routing-request-id": [ | ||
"WESTCENTRALUS:20190128T204821Z:03660401-442e-41d7-85e6-3341a2c586bf" | ||
], | ||
"x-ms-ratelimit-remaining-subscription-reads": [ | ||
"11999" | ||
], | ||
"x-ms-correlation-request-id": [ | ||
"03660401-442e-41d7-85e6-3341a2c586bf" | ||
], | ||
"x-ms-request-id": [ | ||
"39445047-df7e-4d7c-aee0-e431eafeca35" | ||
], | ||
"Strict-Transport-Security": [ | ||
"max-age=31536000; includeSubDomains" | ||
], | ||
"X-Content-Type-Options": [ | ||
"nosniff" | ||
], | ||
"Content-Length": [ | ||
"3982" | ||
], | ||
"Content-Type": [ | ||
"application/json" | ||
], | ||
"Expires": [ | ||
"-1" | ||
] | ||
}, | ||
"ResponseBody": "{\r\n \"id\": \"/subscriptions/c1089427-83d3-4286-9f35-5af546a6eb67/providers/Microsoft.ContainerService/locations/westus2/orchestrators\",\r\n \"name\": \"default\",\r\n \"type\": \"Microsoft.ContainerService/locations/orchestrators\",\r\n \"properties\": {\r\n \"orchestrators\": [\r\n {\r\n \"orchestratorType\": \"Swarm\",\r\n \"orchestratorVersion\": \"swarm:1.1.0\"\r\n },\r\n {\r\n \"orchestratorType\": \"DockerCE\",\r\n \"orchestratorVersion\": \"17.03.*\"\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.6.9\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.7.15\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.7.16\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.7.15\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.7.16\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.8.14\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.8.15\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.7.16\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.8.14\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.8.15\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.8.14\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.8.15\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.9.10\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.9.11\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.8.15\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.9.10\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.9.11\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.9.10\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.9.11\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.10.9\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.10.12\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.9.11\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.10.9\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.10.12\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.10.9\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.10.12\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.11.5\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.11.6\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.10.12\",\r\n \"default\": true,\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.11.5\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.11.6\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.11.5\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.11.6\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.12.2\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.12.4\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.11.6\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.12.2\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.12.4\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.12.2\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.12.4\"\r\n },\r\n {\r\n \"orchestratorVersion\": \"1.13.1\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.12.4\",\r\n \"upgrades\": [\r\n {\r\n \"orchestratorVersion\": \"1.13.1\"\r\n }\r\n ]\r\n },\r\n {\r\n \"orchestratorType\": \"Kubernetes\",\r\n \"orchestratorVersion\": \"1.13.1\"\r\n },\r\n {\r\n \"orchestratorType\": \"DCOS\",\r\n \"orchestratorVersion\": \"1.10.0\"\r\n },\r\n {\r\n \"orchestratorType\": \"DCOS\",\r\n \"orchestratorVersion\": \"1.9.0\"\r\n },\r\n {\r\n \"orchestratorType\": \"DCOS\",\r\n \"orchestratorVersion\": \"1.8.8\"\r\n }\r\n ]\r\n }\r\n}", | ||
"StatusCode": 200 | ||
} | ||
], | ||
"Names": {}, | ||
"Variables": { | ||
"SubscriptionId": "c1089427-83d3-4286-9f35-5af546a6eb67" | ||
} | ||
} |
6,832 changes: 6,832 additions & 0 deletions
6,832
...ement.ContainerService.Tests.ContainerServiceTests/ContainerServiceUpdateServiceTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
109 changes: 109 additions & 0 deletions
109
...Ks/ContainerService/ContainerService.Tests/Tests/Helpers/ContainerServiceTestUtilities.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Linq; | ||
using ContainerService.Tests; | ||
using Microsoft.Azure.Management.ContainerService.Models; | ||
using Microsoft.Azure.Management.Resources; | ||
using Microsoft.Rest.ClientRuntime.Azure.TestFramework; | ||
using Microsoft.Azure.Management.Resources.Models; | ||
using System.Threading.Tasks; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Azure.Management.ContainerService.Tests | ||
{ | ||
public static class ContainerServiceTestUtilities | ||
{ | ||
internal const string DnsPrefix = "aksdotnetsdk"; | ||
internal const string ResourceGroupPrefix = "aks-dotnet-sdk-RG-"; | ||
internal const string AgentPoolProfileName = "aksagent"; | ||
internal const string VMSize = "Standard_A1"; | ||
|
||
public static ResourceManagementClient GetResourceManagementClient(MockContext context, RecordedDelegatingHandler handler) | ||
{ | ||
handler.IsPassThrough = true; | ||
ResourceManagementClient resourceManagementClient = context.GetServiceClient<ResourceManagementClient>(handlers: handler); | ||
return resourceManagementClient; | ||
} | ||
|
||
internal static ContainerServiceClient GetContainerServiceManagementClient(MockContext context, RecordedDelegatingHandler handler) | ||
{ | ||
handler.IsPassThrough = true; | ||
ContainerServiceClient containerServiceClient = context.GetServiceClient<ContainerServiceClient>(handlers: handler); | ||
return containerServiceClient; | ||
} | ||
|
||
public static string GetLocationFromProvider(this ResourceManagementClient resourceManagementClient) | ||
{ | ||
return "westus2"; | ||
} | ||
|
||
public static void TryRegisterResourceGroup(this ResourceManagementClient resourceManagementClient, string location, string resourceGroupName) | ||
{ | ||
resourceManagementClient.ResourceGroups.CreateOrUpdate(resourceGroupName, new ResourceGroup(location)); | ||
} | ||
|
||
public static string TryGetResourceGroup(this ResourceManagementClient resourceManagementClient, string location) | ||
{ | ||
const string DefaultResourceGroupName = "AKSTests"; | ||
|
||
var resourceGroup = resourceManagementClient.ResourceGroups | ||
.List().Where(group => string.IsNullOrWhiteSpace(location) || group.Location.Equals(location.Replace(" ", string.Empty), StringComparison.OrdinalIgnoreCase)) | ||
.FirstOrDefault(group => group.Name.Contains(DefaultResourceGroupName)); | ||
|
||
return resourceGroup != null | ||
? resourceGroup.Name | ||
: string.Empty; | ||
} | ||
|
||
/// <summary> | ||
/// CreateManagedCluster creates an AKS managed cluster | ||
/// </summary> | ||
/// <param name="resourceManagementClient"></param> | ||
/// <param name="containerServiceClient"></param> | ||
/// <param name="location"></param> | ||
/// <param name="clusterName"></param> | ||
/// <param name="resourceGroupName"></param> | ||
/// <returns></returns> | ||
internal async static Task<ManagedCluster> CreateManagedCluster( | ||
MockContext context, | ||
ResourceManagementClient resourceManagementClient, | ||
ContainerServiceClient containerServiceClient, | ||
string location, | ||
string clusterName, | ||
string resourceGroupName) | ||
{ | ||
|
||
TestEnvironment testEnvironment = TestEnvironmentFactory.GetTestEnvironment(); | ||
string authClientId = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalKey]; | ||
string authSecret = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalSecretKey]; | ||
|
||
var agentPoolProfiles = new List<ManagedClusterAgentPoolProfile> | ||
{ | ||
new ManagedClusterAgentPoolProfile | ||
{ | ||
Name = AgentPoolProfileName, | ||
VmSize = VMSize, | ||
Count = 1 | ||
} | ||
}; | ||
|
||
ManagedCluster desiredManagedCluster = new ManagedCluster | ||
{ | ||
DnsPrefix = DnsPrefix, | ||
Location = location, | ||
AgentPoolProfiles = agentPoolProfiles, | ||
ServicePrincipalProfile = new ManagedClusterServicePrincipalProfile | ||
{ | ||
ClientId = authClientId, | ||
Secret = authSecret | ||
} | ||
}; | ||
|
||
var cluster = await containerServiceClient.ManagedClusters.CreateOrUpdateAsync(resourceGroupName, clusterName, desiredManagedCluster); | ||
|
||
return cluster; | ||
} | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
src/SDKs/ContainerService/ContainerService.Tests/Tests/Helpers/RecordedDelegatingHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Threading.Tasks; | ||
|
||
namespace ContainerService.Tests | ||
{ | ||
public class RecordedDelegatingHandler : DelegatingHandler | ||
{ | ||
private HttpResponseMessage _response; | ||
|
||
public RecordedDelegatingHandler() | ||
{ | ||
StatusCodeToReturn = HttpStatusCode.Created; | ||
SubsequentStatusCodeToReturn = StatusCodeToReturn; | ||
} | ||
|
||
public RecordedDelegatingHandler(HttpResponseMessage response) | ||
{ | ||
StatusCodeToReturn = HttpStatusCode.Created; | ||
SubsequentStatusCodeToReturn = StatusCodeToReturn; | ||
_response = response; | ||
} | ||
|
||
public HttpStatusCode StatusCodeToReturn { get; set; } | ||
|
||
public HttpStatusCode SubsequentStatusCodeToReturn { get; set; } | ||
|
||
public string Request { get; private set; } | ||
|
||
public HttpRequestHeaders RequestHeaders { get; private set; } | ||
|
||
public HttpContentHeaders ContentHeaders { get; private set; } | ||
|
||
public HttpMethod Method { get; private set; } | ||
|
||
public Uri Uri { get; private set; } | ||
|
||
public bool IsPassThrough { get; set; } | ||
|
||
private int counter; | ||
|
||
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) | ||
{ | ||
counter++; | ||
// Save request | ||
if (request.Content == null) | ||
{ | ||
Request = string.Empty; | ||
} | ||
else | ||
{ | ||
Request = await request.Content.ReadAsStringAsync(); | ||
} | ||
RequestHeaders = request.Headers; | ||
if (request.Content != null) | ||
{ | ||
ContentHeaders = request.Content.Headers; | ||
} | ||
Method = request.Method; | ||
Uri = request.RequestUri; | ||
|
||
// Prepare response | ||
if (IsPassThrough) | ||
{ | ||
return await base.SendAsync(request, cancellationToken); | ||
} | ||
else | ||
{ | ||
if (_response != null && counter == 1) | ||
{ | ||
return _response; | ||
} | ||
else | ||
{ | ||
var statusCode = StatusCodeToReturn; | ||
if (counter > 1) | ||
statusCode = SubsequentStatusCodeToReturn; | ||
HttpResponseMessage response = new HttpResponseMessage(statusCode); | ||
response.Content = new StringContent(""); | ||
return response; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.