Skip to content

Commit

Permalink
Smoke Tests: enable using other clouds (Azure#10200)
Browse files Browse the repository at this point in the history
* fix async tests and install async requirements

* fix Identity for KV to support AZURE_AUTHORITY_HOST with a hostname (requires hostname without protocol wrapping)

* add AZURE_AUTHORITY_HOST to tests.yml (this one uses a python-specific value because python uses just the host and doesn't use the URL like other languages)

* update naming for authority host variable

* add ability to use gov cloud

* public -> gov for gov cloud instances, tweaks to async event hubs
  • Loading branch information
danieljurek authored Mar 14, 2020
1 parent c36a95b commit d320a5a
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 24 deletions.
1 change: 0 additions & 1 deletion common/smoketest/event_hubs_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ async def send_and_receive_events(self, partition_id):
# on_event will close the consumer_client which resumes execution
on_event=self.on_event,
on_error=self.on_error,
timeout=RECEIVE_TIMEOUT,
starting_position=STARTING_POSITION
)

Expand Down
3 changes: 2 additions & 1 deletion common/smoketest/key_vault_certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self):
# * AZURE_CLIENT_ID
# * AZURE_CLIENT_SECRET
# * AZURE_TENANT_ID
credential = DefaultAzureCredential()
authority_host = os.environ.get('AZURE_AUTHORITY_HOST') or KnownAuthorities.AZURE_PUBLIC_CLOUD
credential = DefaultAzureCredential(authority=authority_host)
self.certificate_client = CertificateClient(
vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential
)
Expand Down
3 changes: 2 additions & 1 deletion common/smoketest/key_vault_certificates_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self):
# * AZURE_CLIENT_ID
# * AZURE_CLIENT_SECRET
# * AZURE_TENANT_ID
credential = DefaultAzureCredential()
authority_host = os.environ.get('AZURE_AUTHORITY_HOST') or KnownAuthorities.AZURE_PUBLIC_CLOUD
credential = DefaultAzureCredential(authority=authority_host)
self.certificate_client = CertificateClient(
vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential
)
Expand Down
3 changes: 2 additions & 1 deletion common/smoketest/key_vault_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self):
# * AZURE_CLIENT_ID
# * AZURE_CLIENT_SECRET
# * AZURE_TENANT_ID
credential = DefaultAzureCredential()
authority_host = os.environ.get('AZURE_AUTHORITY_HOST') or KnownAuthorities.AZURE_PUBLIC_CLOUD
credential = DefaultAzureCredential(authority=authority_host)
self.key_client = KeyClient(
vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential
)
Expand Down
3 changes: 2 additions & 1 deletion common/smoketest/key_vault_keys_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self):
# * AZURE_CLIENT_ID
# * AZURE_CLIENT_SECRET
# * AZURE_TENANT_ID
credential = DefaultAzureCredential()
authority_host = os.environ.get('AZURE_AUTHORITY_HOST') or KnownAuthorities.AZURE_PUBLIC_CLOUD
credential = DefaultAzureCredential(authority=authority_host)
self.key_client = KeyClient(
vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential
)
Expand Down
3 changes: 2 additions & 1 deletion common/smoketest/key_vault_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self):
# * AZURE_CLIENT_ID
# * AZURE_CLIENT_SECRET
# * AZURE_TENANT_ID
credential = DefaultAzureCredential()
authority_host = os.environ.get('AZURE_AUTHORITY_HOST') or KnownAuthorities.AZURE_PUBLIC_CLOUD
credential = DefaultAzureCredential(authority=authority_host)
self.secret_client = SecretClient(
vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential
)
Expand Down
3 changes: 2 additions & 1 deletion common/smoketest/key_vault_secrets_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self):
# * AZURE_CLIENT_ID
# * AZURE_CLIENT_SECRET
# * AZURE_TENANT_ID
credential = DefaultAzureCredential()
authority_host = os.environ.get('AZURE_AUTHORITY_HOST') or KnownAuthorities.AZURE_PUBLIC_CLOUD
credential = DefaultAzureCredential(authority=authority_host)
self.secret_client = SecretClient(
vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential
)
Expand Down
2 changes: 1 addition & 1 deletion common/smoketest/smoke_test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from storage_blob_async import StorageBlobAsync


def execute_async_smoke_tests:
def execute_async_smoke_tests():
print("")
print("==========================================")
print(" AZURE TRACK 2 SDKs SMOKE TEST ASYNC")
Expand Down
83 changes: 67 additions & 16 deletions eng/pipelines/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,43 @@ jobs:
- job:
strategy:
matrix:
Python_27_Linux:
Python_27_Linux (Public):
PythonVersion: '2.7'
InstallAsyncRequirements: false
OSVmImage: ubuntu-18.04
Python_37_Linux:
CloudType: public
Python_37_Linux (Public):
PythonVersion: '3.7'
OSVmImage: ubuntu-18.04
Python_38_Linux:
CloudType: public
Python_38_Linux (Public):
PythonVersion: '3.8'
OSVmImage: ubuntu-18.04
Python_37_Windows:
CloudType: public
Python_37_Windows (Public):
PythonVersion: '3.7'
OSVmImage: windows-2019
Python_38_Windows:
CloudType: public
Python_38_Windows (Public):
PythonVersion: '3.8'
OSVmImage: windows-2019
Python_37_Mac:
CloudType: public
Python_37_Mac (Public):
PythonVersion: '3.7'
OSVmImage: macOS-10.15
Python_38_Mac:
CloudType: public
Python_38_Mac (Public):
PythonVersion: '3.8'
OSVmImage: macOS-10.15
CloudType: public
Python_38_Linux (Gov):
PythonVersion: '3.8'
OSVmImage: ubuntu-18.04
CloudType: gov
Python_37_Windows (Gov):
PythonVersion: '3.7'
OSVmImage: windows-2019
CloudType: gov

pool:
vmImage: $(OSVmImage)
Expand All @@ -46,17 +61,53 @@ jobs:
- script: pip install -r ./common/smoketest/requirements.txt
displayName: "Install requirements.txt"

- script: pip install -r ./common/smoketest/requirements_async.txt
displayName: "Install requirements_async.txt"
condition: and(succeeded(), eq(variables['InstallAsyncRequirements'], 'true'))

- script: python ./eng/tox/install_dev_build_dependency.py -r ./common/smoketest/requirements.txt
displayName: "Install dev dependencies from feed"

# Set secret environment variables for different clouds
- pwsh: |
$variables = @{
AZURE_CLIENT_ID='$(aad-azure-sdk-test-client-id)'
AZURE_CLIENT_SECRET='$(aad-azure-sdk-test-client-secret)'
AZURE_TENANT_ID='$(aad-azure-sdk-test-tenant-id)'
AZURE_AUTHORITY_HOST='$(aad-azure-sdk-test-authority-host)'
AZURE_PROJECT_URL='$(smoke-tests-key-vault-project-url)'
EVENT_HUBS_CONNECTION_STRING='$(smoke-tests-event-hubs-connection-string)'
COSMOS_ENDPOINT='$(smoke-tests-cosmos-endpoint)'
COSMOS_KEY='$(smoke-tests-cosmos-key)'
STORAGE_CONNECTION_STRING='$(smoke-tests-storage-connection-string)'
};
foreach ($key in $variables.Keys) {
Write-Host "Setting variable '$key'"
Write-Host "##vso[task.setvariable variable=_$key;issecret=true;]$($variables[$key])"
Write-Host "##vso[task.setvariable variable=$key;]$($variables[$key])"
}
displayName: Set secrets for public cloud
condition: and(succeeded(), eq(variables['CloudType'], 'public'))
- pwsh: |
$variables = @{
AZURE_CLIENT_ID='$(aad-azure-sdk-test-client-id-gov)'
AZURE_CLIENT_SECRET='$(aad-azure-sdk-test-client-secret-gov)'
AZURE_TENANT_ID='$(aad-azure-sdk-test-tenant-id-gov)'
AZURE_AUTHORITY_HOST='$(aad-azure-sdk-test-authority-host-gov)'
AZURE_PROJECT_URL='$(smoke-tests-key-vault-project-url-gov)'
EVENT_HUBS_CONNECTION_STRING='$(smoke-tests-event-hubs-connection-string-gov)'
COSMOS_ENDPOINT='$(smoke-tests-cosmos-endpoint-gov)'
COSMOS_KEY='$(smoke-tests-cosmos-key-gov)'
STORAGE_CONNECTION_STRING='$(smoke-tests-storage-connection-string-gov)'
};
foreach ($key in $variables.Keys) {
Write-Host "Setting variable '$key'"
Write-Host "##vso[task.setvariable variable=_$key;issecret=true;]$($variables[$key])"
Write-Host "##vso[task.setvariable variable=$key;]$($variables[$key])"
}
displayName: Set secrets for public cloud
condition: and(succeeded(), eq(variables['CloudType'], 'gov'))
- script: python ./common/smoketest/program.py
displayName: "Run Smoke Test"
env:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_PROJECT_URL: $(smoke-tests-key-vault-project-url)
EVENT_HUBS_CONNECTION_STRING: $(smoke-tests-event-hubs-connection-string)
COSMOS_ENDPOINT: $(smoke-tests-cosmos-endpoint)
COSMOS_KEY: $(smoke-tests-cosmos-key)
STORAGE_CONNECTION_STRING: $(smoke-tests-storage-connection-string)

0 comments on commit d320a5a

Please sign in to comment.