-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Monitor] Enable sovereign cloud testing (#35209)
This refactors some of the monitor ingestion/query library tests to allow for sovereign cloud testing. China cloud and Government cloud testing are also enabled on the weekly pipelines. Signed-off-by: Paul Van Eck <[email protected]>
- Loading branch information
Showing
6 changed files
with
95 additions
and
27 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
sdk/monitor/azure-monitor-ingestion/tests/base_testcase.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,28 @@ | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See LICENSE.txt in the project root for | ||
# license information. | ||
# ------------------------------------------------------------------------- | ||
import os | ||
|
||
from devtools_testutils import AzureRecordedTestCase | ||
|
||
|
||
ENV_MONITOR_ENVIRONMENT = "MONITOR_ENVIRONMENT" | ||
AUDIENCE_MAP = { | ||
"AzureCloud": "https://monitor.azure.com", | ||
"AzureChinaCloud": "https://monitor.azure.cn", | ||
"AzureUSGovernment": "https://monitor.azure.us" | ||
} | ||
|
||
|
||
class LogsIngestionClientTestCase(AzureRecordedTestCase): | ||
|
||
def get_client(self, client_class, credential, **kwargs): | ||
|
||
environment = os.getenv(ENV_MONITOR_ENVIRONMENT) | ||
if environment: | ||
audience = AUDIENCE_MAP.get(environment) | ||
kwargs["credential_scopes"] = [f"{audience}/.default"] | ||
|
||
return self.create_client_from_credential(client_class, credential, **kwargs) |
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