Skip to content

Commit f2c2b0d

Browse files
committed
* 'main' of https://github.com/Azure/azure-sdk-for-python: (23 commits) make core tests offline (#19986) [translation] naming alignment (#20406) Address API view issues (#20407) skip custom translation model samples (#20414) [purview account] first release for azure-purview-account (#20335) improve docs and samples for glossaries and custom models (#18587) Sync eng/common directory with azure-sdk-tools for PR 1918 (#20342) Update .docsettings.yml (#20402) improve begin_translation docstring (#20401) [translation] fix poller.details (#20392) Chain exceptions from LibsecretPersistence (#20380) [AutoRelease] t2-datamigration-2021-08-19-04035 (#20349) [AutoRelease] t2-policyinsights-2021-08-23-78735 (#20381) [AutoRelease] t2-servicebus-2021-08-19-00756 (#20350) [AutoRelease] t2-costmanagement-2021-07-27-84467 (#19949) keyvault and storage have a conflict between mindependency and what local azure-identity requires. resolve it (#20391) Add Cloud Configuration section to Identity readme (#20373) Consistency related changes (#20385) Document Pod Identity's special use of client_id (#20377) [rest] use azure json encoder for json input bodies (#20361) ...
2 parents 622539a + 0ab3cda commit f2c2b0d

File tree

409 files changed

+63072
-5952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

409 files changed

+63072
-5952
lines changed

eng/.docsettings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ omitted_paths:
1010
- sdk/identity/azure-identity/tests/*
1111
- sdk/**/tests/perfstress_tests/*
1212
- sdk/nspkg/*
13+
- sdk/**/swagger/*
1314

1415
language: python
1516
root_check_enabled: True
@@ -91,6 +92,7 @@ known_content_issues:
9192
- ['sdk/purview/azure-purview-catalog/swagger/README.md',  '#4554']
9293
- ['sdk/purview/azure-purview-scanning/swagger/README.md',  '#4554']
9394
- ['sdk/agrifood/azure-agrifood-farming/swagger/README.md',  '#4554']
95+
- ['sdk/purview/azure-purview-account/swagger/README.md', '#4554']
9496
- ['sdk/containerregistry/azure-containerregistry/swagger/README.md', '#4554']
9597
- ['sdk/appconfiguration/azure-appconfiguration/swagger/README.md', '#4554']
9698
- ['sdk/attestation/azure-security-attestation/swagger/README.md', '#4554']

eng/common/scripts/stress-testing/deploy-stress-tests.ps1

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ $ErrorActionPreference = 'Stop'
2020
. $PSScriptRoot/find-all-stress-packages.ps1
2121
$FailedCommands = New-Object Collections.Generic.List[hashtable]
2222

23-
if (!(Get-Module powershell-yaml)) {
24-
Install-Module -Name powershell-yaml -RequiredVersion 0.4.1 -Force -Scope CurrentUser
25-
}
23+
. (Join-Path $PSScriptRoot "../Helpers" PSModule-Helpers.ps1)
24+
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module
2625

2726
# Powershell does not (at time of writing) treat exit codes from external binaries
2827
# as cause for stopping execution, so do this via a wrapper function.
@@ -51,7 +50,10 @@ function Login([string]$subscription, [string]$clusterGroup, [boolean]$pushImage
5150
RunOrExitOnFailure az login --allow-no-subscriptions
5251
}
5352

54-
$clusterName = (az aks list -g $clusterGroup -o json| ConvertFrom-Json).name
53+
# Discover cluster name, only one cluster per group is expected
54+
Write-Host "Listing AKS cluster in $subscription/$clusterGroup"
55+
$cluster = RunOrExitOnFailure az aks list -g $clusterGroup --subscription $subscription -o json
56+
$clusterName = ($cluster | ConvertFrom-Json).name
5557

5658
RunOrExitOnFailure az aks get-credentials `
5759
-n "$clusterName" `
@@ -60,8 +62,9 @@ function Login([string]$subscription, [string]$clusterGroup, [boolean]$pushImage
6062
--overwrite-existing
6163

6264
if ($pushImages) {
63-
$registry = (az acr list -g $clusterGroup -o json | ConvertFrom-Json).name
64-
RunOrExitOnFailure az acr login -n $registry
65+
$registry = RunOrExitOnFailure az acr list -g $clusterGroup --subscription $subscription -o json
66+
$registryName = ($registry | ConvertFrom-Json).name
67+
RunOrExitOnFailure az acr login -n $registryName
6568
}
6669
}
6770

@@ -110,11 +113,8 @@ function DeployStressPackage(
110113
[string]$repository,
111114
[boolean]$pushImages
112115
) {
113-
$registry = (az acr list -g $clusterGroup -o json | ConvertFrom-Json).name
114-
if (!$registry) {
115-
Write-Host "Could not find container registry in resource group $clusterGroup"
116-
exit 1
117-
}
116+
$registry = RunOrExitOnFailure az acr list -g $clusterGroup --subscription $subscription -o json
117+
$registryName = ($registry | ConvertFrom-Json).name
118118

119119
Run helm dependency update $pkg.Directory
120120
if ($LASTEXITCODE) { return }
@@ -133,7 +133,7 @@ function DeployStressPackage(
133133
if (!$imageName) {
134134
$imageName = $dockerFile.Directory.Name
135135
}
136-
$imageTag = "${registry}.azurecr.io/$($repository.ToLower())/$($imageName):$deployId"
136+
$imageTag = "${registryName}.azurecr.io/$($repository.ToLower())/$($imageName):$deployId"
137137
Write-Host "Building and pushing stress test docker image '$imageTag'"
138138
Run docker build -t $imageTag -f $dockerFile.FullName $dockerFile.DirectoryName
139139
if ($LASTEXITCODE) { return }
@@ -154,7 +154,7 @@ function DeployStressPackage(
154154
Run helm upgrade $pkg.ReleaseName $pkg.Directory `
155155
-n $pkg.Namespace `
156156
--install `
157-
--set repository=$registry.azurecr.io/$repository `
157+
--set repository=$registryName.azurecr.io/$repository `
158158
--set tag=$deployId `
159159
--set stress-test-addons.env=$environment
160160
if ($LASTEXITCODE) {
@@ -176,4 +176,7 @@ function DeployStressPackage(
176176
Run kubectl label secret -n $pkg.Namespace --overwrite $helmReleaseConfig deployId=$deployId
177177
}
178178

179-
DeployStressTests @PSBoundParameters
179+
# Don't call functions when the script is being dot sourced
180+
if ($MyInvocation.InvocationName -ne ".") {
181+
DeployStressTests @PSBoundParameters
182+
}

eng/pipelines/templates/jobs/smoke.tests.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,15 @@ jobs:
159159
timeoutInMinutes: 5
160160

161161
- pwsh: |
162-
$packages = Get-ChildItem "$(Pipeline.Workspace)/${{ parameters.ArtifactName }}/*.zip"
162+
$packages = Get-ChildItem "$(Pipeline.Workspace)/${{ parameters.ArtifactName }}/${{ parameters.Artifact.name }}/*.zip"
163163
Write-Host "Artifacts found:"
164164
$artifacts = $packages | ForEach-Object {
165165
if ($_.Name -match "([a-zA-Z\-]+)\-(.*).zip") {
166166
Write-Host "$($matches[1]): $($matches[2])"
167167
return @{ "name" = $matches[1]; "version" = $matches[2] }
168168
}
169169
}
170-
$dependencies = Get-Content $env:REQUIREMENTS | ForEach-Object {
170+
$dependencies = Get-Content $(requirements) | ForEach-Object {
171171
$line = $_
172172
if ($line -match "([a-zA-Z\-]+)(\W+)(.*)") {
173173
$override = ($artifacts | Where-Object { $_.Name -eq $matches[1] }).Version
@@ -179,36 +179,44 @@ jobs:
179179
return $line
180180
}
181181
182-
$dependencies | Out-File $env:REQUIREMENTS
182+
$dependencies | Out-File $(requirements)
183183
184184
displayName: Override requirements with pipeline build artifact versions
185-
env:
186-
REQUIREMENTS: $(requirements)
187185
188-
- pwsh: pip install -r "$env:REQUIREMENTS" --no-deps --upgrade
186+
# Retry for pip install due to delay in package availability after publish
187+
# The package is expected to be available for download/installation within 10 minutes
188+
- pwsh: |
189+
$ErrorActionPreference = "Continue"
190+
while ($retries++ -lt 15) {
191+
Write-Host "pip install -r $(requirements) --no-deps --upgrade --no-cache-dir"
192+
pip install -r "$(requirements)" --no-deps --upgrade --no-cache-dir
193+
if ($LASTEXITCODE) {
194+
if ($retries -ge 15) {
195+
exit $LASTEXITCODE
196+
}
197+
Write-Host "Installation failed, retrying in 1 minute..."
198+
sleep 60
199+
} else {
200+
break
201+
}
202+
}
189203
displayName: Install requirements without dependencies
190-
env:
191-
REQUIREMENTS: $(requirements)
192204
193205
- ${{ if eq(parameters.Daily, true) }}:
194206
- pwsh: |
195-
pip install -r "$env:REQUIREMENTS" --pre --no-deps --upgrade `
207+
pip install -r "$(requirements)" --pre --no-deps --upgrade `
196208
--index-url https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple
197209
198210
displayName: Install requirements from dev feed without dependencies
199-
env:
200-
REQUIREMENTS: $(requirements)
201211
202212
- pwsh: pip install -r $(Build.SourcesDirectory)/common/smoketest/requirements_async.txt
203213
displayName: "Install requirements_async.txt"
204214
condition: and(succeeded(), ne(variables['SkipAsyncInstall'], true))
205215

206216
- pwsh: |
207-
python $(Build.SourcesDirectory)/common/smoketest/dependencies.py -r "$env:REQUIREMENTS" `
217+
python $(Build.SourcesDirectory)/common/smoketest/dependencies.py -r "$(requirements)" `
208218
| Out-File $(Build.SourcesDirectory)/common/smoketest/requirements_dependencies.txt
209219
displayName: Create dependency list from installed packages
210-
env:
211-
REQUIREMENTS: $(requirements)
212220
213221
- script: pip install -r $(Build.SourcesDirectory)/common/smoketest/requirements_dependencies.txt
214222
displayName: Install package dependencies from PyPI

eng/tox/allowed_pylint_failures.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"azure-purview-nspkg",
5555
"azure-purview-scanning",
5656
"azure-purview-catalog",
57+
"azure-purview-account",
5758
"azure-messaging-nspkg",
5859
"azure-agrifood-farming",
5960
"azure-eventhub",

scripts/devops_tasks/test_run_samples.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@
123123
"sample_list_translations_with_filters_async.py",
124124
"sample_list_document_statuses_with_filters.py",
125125
"sample_list_translations_with_filters.py",
126+
"sample_translation_with_custom_model.py",
127+
"sample_translation_with_custom_model_async.py",
126128
]
127129
}
128130

sdk/core/azure-core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Features Added
66

7+
- We now use `azure.core.serialization.AzureJSONEncoder` to serialize `json` input to `azure.core.rest.HttpRequest`.
8+
79
### Breaking Changes in the Provisional `azure.core.rest` package
810

911
- The `text` property on `azure.core.rest.HttpResponse` and `azure.core.rest.AsyncHttpResponse` has changed to a method, which also takes

sdk/core/azure-core/azure/core/rest/_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from urlparse import urlparse # type: ignore
5151
except ImportError:
5252
from urllib.parse import urlparse
53+
from azure.core.serialization import AzureJSONEncoder
5354

5455
################################### TYPES SECTION #########################
5556

@@ -182,7 +183,7 @@ def set_content_body(content):
182183

183184
def set_json_body(json):
184185
# type: (Any) -> Tuple[Dict[str, str], Any]
185-
body = dumps(json)
186+
body = dumps(json, cls=AzureJSONEncoder)
186187
return {
187188
"Content-Type": "application/json",
188189
"Content-Length": str(len(body))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ async def __aenter__(self):
6666
return self
6767

6868
async def __aexit__(self, *exc_details) -> None:
69-
await self._client.__aexit__(*exc_details)
69+
await self._client.__aexit__(*exc_details)

sdk/core/azure-core/tests/async_tests/test_basic_transport_async.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
# Licensed under the MIT License. See LICENSE.txt in the project root for
44
# license information.
55
# -------------------------------------------------------------------------
6-
from six.moves.http_client import HTTPConnection
7-
import time
8-
9-
try:
10-
from unittest import mock
11-
except ImportError:
12-
import mock
13-
146
from azure.core.pipeline.transport import HttpRequest, AsyncHttpResponse, AsyncHttpTransport, AioHttpTransport
157
from azure.core.pipeline.policies import HeadersPolicy
168
from azure.core.pipeline import AsyncPipeline
@@ -42,9 +34,9 @@ def body(self):
4234

4335

4436
@pytest.mark.asyncio
45-
async def test_basic_options_aiohttp():
37+
async def test_basic_options_aiohttp(port):
4638

47-
request = HttpRequest("OPTIONS", "https://httpbin.org")
39+
request = HttpRequest("OPTIONS", "http://localhost:{}/basic/string".format(port))
4840
async with AsyncPipeline(AioHttpTransport(), policies=[]) as pipeline:
4941
response = await pipeline.run(request)
5042

0 commit comments

Comments
 (0)