-
Notifications
You must be signed in to change notification settings - Fork 1.5k
{AKS} az aks stop: add warning when private link cluster is stopped #7019
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
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
03e7e45
add prompt
8f82221
bump
5101887
fix comment
a3056f7
add recoding
4ffa07e
add ut
2a3bfbf
remove recording
ad801f6
fix
12a929b
add recording
bec3b6b
add command help
8be4ccf
Update src/aks-preview/azext_aks_preview/_help.py
FumingZhang 4dd2455
use warning instead of prompt
6ac3623
lint
e98ecd7
remove extra line
fec04e1
remove whitespace
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
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
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
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
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
1,092 changes: 353 additions & 739 deletions
1,092
src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_stop_and_start.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
2,418 changes: 2,418 additions & 0 deletions
2,418
...ew/azext_aks_preview/tests/latest/recordings/test_aks_stop_and_start_private_cluster.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
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
54 changes: 54 additions & 0 deletions
54
src/aks-preview/azext_aks_preview/tests/latest/test_custom.py
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,54 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| import unittest | ||
| from unittest.mock import Mock, patch | ||
|
|
||
| from azext_aks_preview.__init__ import register_aks_preview_resource_type | ||
| from azext_aks_preview._client_factory import CUSTOM_MGMT_AKS_PREVIEW | ||
| from azext_aks_preview.managed_cluster_decorator import ( | ||
| AKSPreviewManagedClusterModels, | ||
| ) | ||
| from azext_aks_preview.custom import ( | ||
| aks_stop, | ||
| ) | ||
| from azext_aks_preview.tests.latest.mocks import MockCLI, MockClient, MockCmd | ||
|
|
||
|
|
||
| class TestCustomCommand(unittest.TestCase): | ||
| def setUp(self): | ||
| # manually register CUSTOM_MGMT_AKS_PREVIEW | ||
| register_aks_preview_resource_type() | ||
| self.cli_ctx = MockCLI() | ||
| self.cmd = MockCmd(self.cli_ctx) | ||
| self.models = AKSPreviewManagedClusterModels(self.cmd, CUSTOM_MGMT_AKS_PREVIEW) | ||
| self.client = MockClient() | ||
|
|
||
| def test_aks_stop(self): | ||
| # public cluster: call begin_stop | ||
| mc_1 = self.models.ManagedCluster(location="test_location") | ||
| self.client.get = Mock( | ||
| return_value=mc_1 | ||
| ) | ||
| self.client.begin_stop = Mock( | ||
| return_value=None | ||
| ) | ||
| self.assertEqual(aks_stop(self.cmd, self.client, "rg", "name"), None) | ||
|
|
||
| # private cluster: call begin_stop | ||
| mc_3 = self.models.ManagedCluster(location="test_location") | ||
| api_server_access_profile = self.models.ManagedClusterAPIServerAccessProfile() | ||
| api_server_access_profile.enable_private_cluster = True | ||
| mc_3.api_server_access_profile = api_server_access_profile | ||
| self.client.get = Mock( | ||
| return_value=mc_3 | ||
| ) | ||
| self.client.begin_stop = Mock( | ||
| return_value=None | ||
| ) | ||
| self.assertEqual(aks_stop(self.cmd, self.client, "rg", "name", False), None) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() |
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
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
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.