-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{AKS} az aks stop: add warning when private link cluster is stopped (#…
- Loading branch information
Showing
11 changed files
with
2,912 additions
and
741 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
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
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
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
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
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 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 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 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 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