Operation checks¶
Considering an operation success or failure is not always as simple as checking an error code.
- Sometimes an operation can fail but the failure is what you expected, hence the operation should be reported as successful.
- Sometimes an operation can succeed but the result is not what you expected, in this case the operation should be reported as a failure.
To support those kind of use cases, some operations support an additional check
field to evaluate the operation result against an assertion tree.
Checked model
Different operation have a different model passed through the assertion tree.
Apply¶
apply
supports the following elements to be checked:
Name | Purpose | Type |
---|---|---|
error | The error message (if any) at the end of the operation | string |
resource | The state of the resource (if any) at the end of the operation | object |
Create¶
create
supports the following elements to be checked:
Name | Purpose | Type |
---|---|---|
error | The error message (if any) at the end of the operation | string |
resource | The state of the resource (if any) at the end of the operation | object |
Command¶
command
supports the following elements to be checked:
Name | Purpose | Type |
---|---|---|
error | The error message (if any) at the end of the operation | string |
stdout | The content of the standard console output (if any) at the end of the operation | string |
stderr | The content of the standard console error output (if any) at the end of the operation | string |
Script¶
script
supports the following elements to be checked:
Name | Purpose | Type |
---|---|---|
error | The error message (if any) at the end of the operation | string |
stdout | The content of the standard console output (if any) at the end of the operation | string |
stderr | The content of the standard console error output (if any) at the end of the operation | string |