-
Notifications
You must be signed in to change notification settings - Fork 5.1k
AKS updates to latest REST ContainerService specification #5114
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
Closed
Closed
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5ae5194
Add generated SDK files from `autorest --csharp`
mboersma 6dc0182
Removal of preview objects and replacment of of objects from 2018-03-…
ca74945
Skeleton VS solution, projects, and tests
d812113
Created compiling test harness
9ad8b8e
Test proj compiling, need JSON payloads for testing
9d1541f
Regenerate classes without deprecated ACS service endpoints
mboersma ce6bf5e
Orchestrator list and create tests complete:
81f63f8
Adding session records and passing tests
4dc6e41
Moving SPID to environment variable
dd4e7b4
Refactoring for more forthcoming tests
81f2a82
Completing tests for initial PR
806d3eb
Removal of service principal reference
95740f9
Repairing dependencies
75eed68
Projects rebuilt
44f3b83
Helper and test refactoring along with test cleanup
787f206
Fixing unit tests, refactoring utilities, and addressing required ser…
97fad77
Updte minor version of Media Services SDK in Management.Media/Microso…
74f551b
Add ignore scopes to props file for local builds (#5074)
weshaggard 27d6315
Add generated SDK files from `autorest --csharp`
mboersma e685ba8
Removal of preview objects and replacment of of objects from 2018-03-…
d6c0777
Regenerate classes without deprecated ACS service endpoints
mboersma 1fe592f
Recorded and passing tests
e4c0bcd
Updating test agentpool name
efc4d09
Proper code-gen completed
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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_2018-08-31;</AzureApiTag> | ||
| <PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags> | ||
| </PropertyGroup> | ||
| </Project> |
25 changes: 25 additions & 0 deletions
25
...erService/ContainerService.Tests/Microsoft.Azure.Management.ContainerService.Tests.csproj
This file contains hidden or 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,25 @@ | ||
| <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> | ||
3,055 changes: 3,055 additions & 0 deletions
3,055
...ontainerService.Tests.ContainerServiceTests/ContainerServiceCreateManagedServiceTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,816 changes: 1,816 additions & 0 deletions
1,816
...ement.ContainerService.Tests.ContainerServiceTests/ContainerServiceDeleteServiceTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
2,497 changes: 2,497 additions & 0 deletions
2,497
...ment.ContainerService.Tests.ContainerServiceTests/ContainerServiceGetCredentialsTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
3,289 changes: 3,289 additions & 0 deletions
3,289
...t.ContainerService.Tests.ContainerServiceTests/ContainerServiceGetUpgradeProfileTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
201 changes: 201 additions & 0 deletions
201
...t.ContainerService.Tests.ContainerServiceTests/ContainerServiceListOrchestratorsTest.json
Large diffs are not rendered by default.
Oops, something went wrong.
4,324 changes: 4,324 additions & 0 deletions
4,324
...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 hidden or 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 = "aksdotnetagent"; | ||
| 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.