-
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.
Add command to show the configurations pulled by Application Configur…
…ation Service from upstream Git repositories. (#7296)
- Loading branch information
Showing
10 changed files
with
248 additions
and
2 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
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
5 changes: 5 additions & 0 deletions
5
src/spring/azext_spring/tests/latest/application_configuration_service/__init__.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,5 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# ----------------------------------------------------------------------------- |
66 changes: 66 additions & 0 deletions
66
...spring/azext_spring/tests/latest/application_configuration_service/test_acs_validators.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,66 @@ | ||
# ----------------------------------------------------------------------------- | ||
# 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 argparse import Namespace | ||
from azure.cli.core.azclierror import InvalidArgumentValueError | ||
from ...._validators_enterprise import (validate_pattern_for_show_acs_configs) | ||
|
||
valid_pattern_dict = { | ||
"ASfefsdeDfWeb/azdit": "ASfefsdeDfWeb/azdit", | ||
"ASfefsdeDfWeb/*": "ASfefsdeDfWeb/default", | ||
"ASfefsdeDfWeb/default": "ASfefsdeDfWeb/default", | ||
"admin-application": "admin-application/default", | ||
"admin-application/*": "admin-application/default", | ||
"admin-application/default": "admin-application/default", | ||
"application/default": "application/default", | ||
"application/*": "application/default", | ||
"application": "application/default", | ||
"a": "a/default", | ||
"application/b": "application/b", | ||
"a/b": "a/b", | ||
"a/*": "a/default" | ||
} | ||
|
||
invalid_pattern_list = [ | ||
"admin-application/", | ||
"admin-application/default/default", | ||
"admin-application//my-profile", | ||
"admin-application///my-profile", | ||
"admin-application/**", | ||
"/*", | ||
"/*//", | ||
"/default", | ||
"//default", | ||
" /default", | ||
" /default", | ||
"application/default ", | ||
"application/ default", | ||
"application /default", | ||
" application/default", | ||
"application/ ", | ||
"application/ " | ||
] | ||
|
||
|
||
class TestAcsValidators(unittest.TestCase): | ||
def test_valid_pattern_for_show_acs_configs(self): | ||
for pattern in valid_pattern_dict.keys(): | ||
ns = Namespace(resource_group="group", | ||
service="service", | ||
config_file_pattern=pattern) | ||
validate_pattern_for_show_acs_configs(ns) | ||
self.assertEquals(valid_pattern_dict[pattern], ns.config_file_pattern) | ||
|
||
def test_invalid_pattern_for_show_acs_configs(self): | ||
expectedErr = "Pattern should be in the format of 'application' or 'application/profile'" | ||
for pattern in invalid_pattern_list: | ||
with self.assertRaises(InvalidArgumentValueError) as context: | ||
ns = Namespace(resource_group="group", | ||
service="service", | ||
config_file_pattern=pattern) | ||
validate_pattern_for_show_acs_configs(ns) | ||
self.assertTrue(expectedErr in str(context.exception)) |
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