зеркало из https://github.com/microsoft/azure-cli.git
Compatability fixed for Python 2 and 3. Ensure lease breaking operations are not truncated.
This commit is contained in:
Родитель
2a7db5c0d5
Коммит
6b5ec97019
|
@ -1,21 +1,6 @@
|
|||
interactions:
|
||||
- request:
|
||||
body: !!binary |
|
||||
Y2xpZW50X2lkPTA0YjA3Nzk1LThkZGItNDYxYS1iYmVlLTAyZjllMWJmN2I0NiZyZWZyZXNoX3Rv
|
||||
a2VuPUFBQUJBQUFBaUw5S24yWjI3VXVidldGUGJtMGdMUW91Y3l1aFdWc0plV2xJOWRHSGNDcC1V
|
||||
RWxpR3htUGFQTWJIQUNFcmRtNEh1dzYyT1p1U0Y3SDdMTEZYTU43ZnVJUEZOcUU3Zl9RRjlRUXlE
|
||||
NVVpOEtSZmhkdVlsdWxKR1A3U1QtZGlZYnBGTklvbGVYdDRUNGlwZ3VXZVB5QVBvSW54UWFPbUZV
|
||||
SjZOeXdRYWxFcmJhRzlsZDk5eHpRLVJEbjRhb0hfR3RVeTdFNzYxZThIb2pSNDd0ZXhOcHhVVW5f
|
||||
ZlNEc2VIYU91SDdOWGpwOV81Szhzc2Rad1hBMnp1dHpGVm5mVmZyWTF0Zk8xaVhyZUJMcnVjaEE4
|
||||
aVJwUF9CLXdlc1p1d1lDWjBDVDQtbE91YVlUTzU5WWVGbjJJN1JrX3pQV2xMS1E3R1JCQWhYSGNP
|
||||
cVBqazZDcFBUZU8xcUZLSHdrWF95TVVaQVY3UXdybHhFZ2NPQVN4ZjhkdWpaS0dUWmRxRHJHa3dm
|
||||
c3RpakNDZ0drNndtTnBEVThUYVIzZ0FjOEtlT09kXzhRLVJHVW5MUnRPM3NxOGlHVVNwd3hKeGpI
|
||||
ZWZ3dFpLUm5LQkhYMnl1WlZKVVR5RUxJV0VmVU5iRlk5SWxSQ2RRZkkxcm0tbjl0ZnRVYW8taWJx
|
||||
T1VPOEU4djRzMFc3VTBYOGlRRzVoNTlGSm4wRFQ4Q1VSSnlGVXNlYXl1VkV1aTVwWjc1d0Mtd1FV
|
||||
a2t5aDd1Z0hYVTVHeWZ6RTVIZWVUVVVzSWVIRzdrNU1KaGVsWDBfVkVCQ0NGRnhIZGVlNGU3NUJV
|
||||
aHJfVHlHcVlySmF4RWRBOUdmQ0l6TjYtTkZYR2MyQV8yb1E2aTZOaGphaTVXUWlBQSZncmFudF90
|
||||
eXBlPXJlZnJlc2hfdG9rZW4mcmVzb3VyY2U9aHR0cHMlM0ElMkYlMkZtYW5hZ2VtZW50LmNvcmUu
|
||||
d2luZG93cy5uZXQlMkY=
|
||||
body: client_id=04b07795-8ddb-461a-bbee-02f9e1bf7b46&refresh_token=AAABAAAAiL9Kn2Z27UubvWFPbm0gLQoucyuhWVsJeWlI9dGHcCp-UEliGxmPaPMbHACErdm4Huw62OZuSF7H7LLFXMN7fuIPFNqE7f_QF9QQyD5Ui8KRfhduYlulJGP7ST-diYbpFNIoleXt4T4ipguWePyAPoInxQaOmFUJ6NywQalErbaG9ld99xzQ-RDn4aoH_GtUy7E761e8HojR47texNpxUUn_fSDseHaOuH7NXjp9_5K8ssdZwXA2zutzFVnfVfrY1tfO1iXreBLruchA8iRpP_B-wesZuwYCZ0CT4-lOuaYTO59YeFn2I7Rk_zPWlLKQ7GRBAhXHcOqPjk6CpPTeO1qFKHwkX_yMUZAV7QwrlxEgcOASxf8dujZKGTZdqDrGkwfstijCCgGk6wmNpDU8TaR3gAc8KeOOd_8Q-RGUnLRtO3sq8iGUSpwxJxjHefwtZKRnKBHX2yuZVJUTyELIWEfUNbFY9IlRCdQfI1rm-n9tftUao-ibqOUO8E8v4s0W7U0X8iQG5h59FJn0DT8CURJyFUseayuVEui5pZ75wC-wQUkkyh7ugHXU5GyfzE5HeeTUUsIeHG7k5MJhelX0_VEBCCFFxHdee4e75BUhr_TyGqYrJaxEdA9GfCIzN6-NFXGc2A_2oQ6i6Nhjai5WQiAA&grant_type=refresh_token&resource=https%3A%2F%2Fmanagement.core.windows.net%2F
|
||||
headers:
|
||||
Accept: ['*/*']
|
||||
Accept-Charset: [utf-8]
|
||||
|
@ -49,9 +34,7 @@ interactions:
|
|||
X-Powered-By: [ASP.NET]
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJuYW1lIjogInRlc3RzdG9yYWdlb21lZ2EiLCAidHlwZSI6ICJNaWNyb3NvZnQuU3RvcmFnZS9z
|
||||
dG9yYWdlQWNjb3VudHMifQ==
|
||||
body: '{"name": "teststorageomega", "type": "Microsoft.Storage/storageAccounts"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -81,9 +64,7 @@ interactions:
|
|||
Vary: [Accept-Encoding]
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJuYW1lIjogInRyYXZpc3Rlc3RyZXNvdXJjZWdyMzAxNCIsICJ0eXBlIjogIk1pY3Jvc29mdC5T
|
||||
dG9yYWdlL3N0b3JhZ2VBY2NvdW50cyJ9
|
||||
body: '{"name": "travistestresourcegr3014", "type": "Microsoft.Storage/storageAccounts"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -285,8 +266,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJrZXlOYW1lIjogImtleTEifQ==
|
||||
body: '{"keyName": "key1"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -320,8 +300,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJrZXlOYW1lIjogImtleTIifQ==
|
||||
body: '{"keyName": "key2"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -355,8 +334,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJrZXlOYW1lIjogImtleTIifQ==
|
||||
body: '{"keyName": "key2"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -390,8 +368,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJ0YWdzIjogeyJmb28iOiAiYmFyIiwgImNhdCI6ICIifX0=
|
||||
body: '{"tags": {"foo": "bar", "cat": ""}}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -422,8 +399,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJ0YWdzIjogeyJub25lIjogIiJ9fQ==
|
||||
body: '{"tags": {"none": ""}}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -454,8 +430,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJwcm9wZXJ0aWVzIjogeyJhY2NvdW50VHlwZSI6ICJTdGFuZGFyZF9HUlMifX0=
|
||||
body: '{"properties": {"accountType": "Standard_GRS"}}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -486,8 +461,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJwcm9wZXJ0aWVzIjogeyJhY2NvdW50VHlwZSI6ICJTdGFuZGFyZF9MUlMifX0=
|
||||
body: '{"properties": {"accountType": "Standard_LRS"}}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
|
|
@ -23,9 +23,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 204, message: No Content}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJuYW1lIjogInRlc3RjcmVhdGVkZWxldGUiLCAidHlwZSI6ICJNaWNyb3NvZnQuU3RvcmFnZS9z
|
||||
dG9yYWdlQWNjb3VudHMifQ==
|
||||
body: '{"name": "testcreatedelete", "type": "Microsoft.Storage/storageAccounts"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -55,9 +53,7 @@ interactions:
|
|||
Vary: [Accept-Encoding]
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJwcm9wZXJ0aWVzIjogeyJhY2NvdW50VHlwZSI6ICJTdGFuZGFyZF9MUlMifSwgImxvY2F0aW9u
|
||||
IjogIndlc3R1cyJ9
|
||||
body: '{"properties": {"accountType": "Standard_LRS"}, "location": "westus"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -88,9 +84,7 @@ interactions:
|
|||
Vary: [Accept-Encoding]
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJuYW1lIjogInRlc3RjcmVhdGVkZWxldGUiLCAidHlwZSI6ICJNaWNyb3NvZnQuU3RvcmFnZS9z
|
||||
dG9yYWdlQWNjb3VudHMifQ==
|
||||
body: '{"name": "testcreatedelete", "type": "Microsoft.Storage/storageAccounts"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
@ -146,9 +140,7 @@ interactions:
|
|||
x-ms-ratelimit-remaining-subscription-writes: ['1199']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
eyJuYW1lIjogInRlc3RjcmVhdGVkZWxldGUiLCAidHlwZSI6ICJNaWNyb3NvZnQuU3RvcmFnZS9z
|
||||
dG9yYWdlQWNjb3VudHMifQ==
|
||||
body: '{"name": "testcreatedelete", "type": "Microsoft.Storage/storageAccounts"}'
|
||||
headers:
|
||||
Accept: [application/json]
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
|
|
|
@ -262,9 +262,7 @@ interactions:
|
|||
x-ms-version: ['2015-04-05']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
VGhpcyBpcyBhIHRlc3QgZmlsZSBmb3IgcGVyZm9ybWFuY2Ugb2YgYXV0b21hdGVkIHRlc3RzLiBE
|
||||
TyBOT1QgTU9WRSBPUiBERUxFVEUh
|
||||
body: This is a test file for performance of automated tests. DO NOT MOVE OR DELETE!
|
||||
headers:
|
||||
Accept-Encoding: [identity]
|
||||
Connection: [keep-alive]
|
||||
|
@ -335,16 +333,19 @@ interactions:
|
|||
x-ms-version: ['2015-04-05']
|
||||
status: {code: 201, message: Created}
|
||||
- request:
|
||||
body: !!binary |
|
||||
VGhpcyBpcyBhIHRlc3QgZmlsZSBmb3IgcGVyZm9ybWFuY2Ugb2YgYXV0b21hdGVkIHRlc3RzLiBE
|
||||
TyBOT1QgTU9WRSBPUiBERUxFVEUhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
|
||||
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
|
||||
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
|
||||
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
|
||||
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
headers:
|
||||
Accept-Encoding: [identity]
|
||||
Connection: [keep-alive]
|
||||
|
@ -434,9 +435,7 @@ interactions:
|
|||
x-ms-version: ['2015-04-05']
|
||||
status: {code: 201, message: Created}
|
||||
- request:
|
||||
body: !!binary |
|
||||
VGhpcyBpcyBhIHRlc3QgZmlsZSBmb3IgcGVyZm9ybWFuY2Ugb2YgYXV0b21hdGVkIHRlc3RzLiBE
|
||||
TyBOT1QgTU9WRSBPUiBERUxFVEUh
|
||||
body: This is a test file for performance of automated tests. DO NOT MOVE OR DELETE!
|
||||
headers:
|
||||
Accept-Encoding: [identity]
|
||||
Connection: [keep-alive]
|
||||
|
@ -486,9 +485,7 @@ interactions:
|
|||
x-ms-write-protection: ['false']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: !!binary |
|
||||
VGhpcyBpcyBhIHRlc3QgZmlsZSBmb3IgcGVyZm9ybWFuY2Ugb2YgYXV0b21hdGVkIHRlc3RzLiBE
|
||||
TyBOT1QgTU9WRSBPUiBERUxFVEUh
|
||||
body: This is a test file for performance of automated tests. DO NOT MOVE OR DELETE!
|
||||
headers:
|
||||
Accept-Encoding: [identity]
|
||||
Connection: [keep-alive]
|
||||
|
|
|
@ -329,9 +329,7 @@ interactions:
|
|||
x-ms-version: ['2015-04-05']
|
||||
status: {code: 201, message: Created}
|
||||
- request:
|
||||
body: !!binary |
|
||||
VGhpcyBpcyBhIHRlc3QgZmlsZSBmb3IgcGVyZm9ybWFuY2Ugb2YgYXV0b21hdGVkIHRlc3RzLiBE
|
||||
TyBOT1QgTU9WRSBPUiBERUxFVEUh
|
||||
body: This is a test file for performance of automated tests. DO NOT MOVE OR DELETE!
|
||||
headers:
|
||||
Accept-Encoding: [identity]
|
||||
Connection: [keep-alive]
|
||||
|
@ -746,9 +744,7 @@ interactions:
|
|||
x-ms-version: ['2015-04-05']
|
||||
status: {code: 201, message: Created}
|
||||
- request:
|
||||
body: !!binary |
|
||||
VGhpcyBpcyBhIHRlc3QgZmlsZSBmb3IgcGVyZm9ybWFuY2Ugb2YgYXV0b21hdGVkIHRlc3RzLiBE
|
||||
TyBOT1QgTU9WRSBPUiBERUxFVEUh
|
||||
body: This is a test file for performance of automated tests. DO NOT MOVE OR DELETE!
|
||||
headers:
|
||||
Accept-Encoding: [identity]
|
||||
Connection: [keep-alive]
|
||||
|
|
|
@ -16,10 +16,8 @@ def _truncate_long_running_operation(data, lro_item):
|
|||
method = item['request'].get('method')
|
||||
code = item['response']['status'].get('code')
|
||||
if method == 'GET' and code == 202:
|
||||
print('\t\tMETHOD: {} CODE: {} Discarding!'.format(method, code))
|
||||
interactions.remove(item)
|
||||
elif method == 'GET' and code != 202:
|
||||
print('\t\tMETHOD: {} CODE: {} Updating LRO with eventual response.'.format(method, code))
|
||||
lro_item['response'] = item['response']
|
||||
interactions.remove(item)
|
||||
return
|
||||
|
@ -30,19 +28,18 @@ def _shorten_long_running_operations(test_name):
|
|||
yaml_path = os.path.join(recording_dir, '{}.yaml'.format(test_name))
|
||||
if not os.path.isfile(yaml_path):
|
||||
return
|
||||
print('\n** Shortening LRO for test {} **\n'.format(test_name))
|
||||
with open(yaml_path, 'r+b') as f:
|
||||
data = yaml.load(f)
|
||||
for item in data['interactions']:
|
||||
method = item['request'].get('method')
|
||||
code = item['response']['status'].get('code')
|
||||
if method == 'PUT' and code == 202:
|
||||
print('\tMETHOD: {} CODE: {} Submitted for truncation!'.format(method, code))
|
||||
# breaking a lease produces this pattern but should NOT be modified
|
||||
lease_action = item['request']['headers'].get('x-ms-lease-action')
|
||||
lease_action = lease_action[0] if lease_action else None
|
||||
if method == 'PUT' and code == 202 and lease_action != 'break':
|
||||
_truncate_long_running_operation(data, item)
|
||||
else:
|
||||
print('\tMETHOD: {} CODE: {} Keeping unaltered'.format(method, code))
|
||||
f.seek(0)
|
||||
f.write(bytes(yaml.dump(data), 'utf-8'))
|
||||
f.write(yaml.dump(data).encode('utf-8'))
|
||||
f.truncate()
|
||||
|
||||
generator = CommandTestGenerator(recording_dir, TEST_DEF, ENV_VAR)
|
||||
|
|
Загрузка…
Ссылка в новой задаче