Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions documentation/test-scenario/APITestErrorCode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!--
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a great starting point we have these error codes, can we add a section focus on each rule to describe how to fix? It's good to be more specific to guide service team to fix them, and it seems missing x-ms-secret or readonly are common issues spotting from the pilot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Maybe I need to write a doc about validation logic. It will be covered in next PR.

Copyright (c) 2021 Microsoft Corporation

This software is released under the MIT License.
https://opensource.org/licenses/MIT
-->

# API testing error code

OAV api testing define some rules and check whether actual service response match with example. Example is very important for downstream SDK test code generation, code samples and docs. The goal to detect example quality issues and check service behaviors consistent with example.

## Rule descriptions

#### INCORRECT_PROVISIONING_STATE

If service return 200 status code,it means the operation is succeed and finished. So the provisioning state should be one of the terminal states ["succeeded", "failed", "canceled", "ready", "created", "deleted"].

The provisioning state is very important for downstream terraform or cli to manage resource status. For more details about provisioning state, please refer to this [ARM RPC provisioning state](https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property)

#### RESPONSE_MISSING_VALUE

**Error message**: The response value is missing. Path: {}. Expected: {}. Actual: undefined

The example has defined response value, but actually the server doesn't return that value.

Example:

```diff
{
"properties":{
"targetType":"blobNfs",
"junctions":[
{
"namespacePath":"/blobnfs"
}
],
"blobNfs":{
"target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/blofnfs/blobServices/default/containers/blobnfs",
- "usageModel":"WRITE_WORKLOAD_15"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest to show what is actual response and what correct should be in 2 example

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Will be covered in next PR.

}
}
}
```

#### RESPONSE_ADDITIONAL_VALUE

**Error message** Return additional response value. Path: {}. Expected: undefined. Actual: {}

The example doesn't define the response value, but service actually return this value.

Example:

```diff
{
"properties":{
"targetType":"blobNfs",
"junctions":[
{
"namespacePath":"/blobnfs"
}
],
"blobNfs":{
"target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/blofnfs/blobServices/default/containers/blobnfs",
"usageModel":"WRITE_WORKLOAD_15"
+ "enableFeature": true
}
}
}
```

#### RESPONSE_INCONSISTENT_VALUE

**Error message** The actual response value is different from example. Path: {}. Expected: {}. Actual: {}

The service returned value is different from example value.

Example:

```diff
{
"properties":{
"targetType":"blobNfs",
"junctions":[
{
"namespacePath":"/blobnfs"
}
],
"blobNfs":{
"target":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/blofnfs/blobServices/default/containers/blobnfs",
- "usageModel":"WRITE_WORKLOAD_15"
+ "usageModel":"WORK_LOAD_14"
}
}
}
```

#### ROUNDTRIP_INCONSISTENT_PROPERTY

**Error message** The property's value in the response is different from what was set in the request. Path: {}. Request: {}. Response: {}

Example: The sku in request parameters is `default`, but actual return is `standard`.

```diff
{
"parameters":{
"properties":{
"name":"myService",
"SKU":"default"
}
},
"responses":{
"200":{
"properties":{
"name":"myService",
+ "SKU":"standard"
- "SKU":"default"

}
}
}
}

```