Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine CRDs for TestAssert and TestStep #426

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
52 changes: 52 additions & 0 deletions crds/testassert-json-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,55 @@ properties:
description: Number of seconds that the test is allowed to run for
type: integer
default: 30
collectors:
type: object
properties:
type:
type: string
description: Type of collector to run. Values are one of `pod`, `command`, or `events`. If the field named `command` is specified, `type` is assumed to be `command`. If the field named `pod` is specified, `type` is assumed to be `pod`.
default: pod
pod:
type: string
description: The pod name from which to access logs.
namespace:
type: string
description: Namespace in which the pod or events can be located.
container:
type: string
description: Container name inside the pod from which to fetch logs. If empty assumes all containers.
selector:
type: string
description: Label query to select a pod.
tail:
type: integer
description: The number of last lines to collect from a pod. If omitted or zero, then the default is 10 if you use a selector, or -1 (all) if you use a pod name. This matches default behavior of `kubectl logs`.
command:
type: string
description: Command to run. Requires an empty type or type `command`. Must not specify fields `pod`, `namespace`, `container`, or `selector` if present.
commands:
description: Commands is a set of commands to be run as assertions for the current step
type: array
items:
description: The TestAssertCommand object is used by TestAssert to enable running arbitrary commands in asserts
type: object
properties:
command:
description: The command and argument to run as a string.
type: string
script:
description: |
Allows a shell script to run
- namespaced and command should not be used with script.
- namespaced is ignored and command is an error.
- env expansion is depended upon the shell but ENV is passed to the runtime env.
type: string
namespaced:
description: |
If set, the --namespace flag will be appended to the command with the namespace to use
(the test namespace).
type: boolean
skipLogOutput:
description: |
If set, the output from the command is not logged.
Useful for sensitive logs or to reduce noise.
type: boolean
52 changes: 52 additions & 0 deletions crds/testassert_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,55 @@ spec:
description: Number of seconds that the test is allowed to run for
type: integer
default: 30
collectors:
type: object
properties:
type:
type: string
description: Type of collector to run. Values are one of `pod`, `command`, or `events`. If the field named `command` is specified, `type` is assumed to be `command`. If the field named `pod` is specified, `type` is assumed to be `pod`.
default: pod
pod:
type: string
description: The pod name from which to access logs.
namespace:
type: string
description: Namespace in which the pod or events can be located.
container:
type: string
description: Container name inside the pod from which to fetch logs. If empty assumes all containers.
selector:
type: string
description: Label query to select a pod.
tail:
type: integer
description: The number of last lines to collect from a pod. If omitted or zero, then the default is 10 if you use a selector, or -1 (all) if you use a pod name. This matches default behavior of `kubectl logs`.
command:
type: string
description: Command to run. Requires an empty type or type `command`. Must not specify fields `pod`, `namespace`, `container`, or `selector` if present.
commands:
description: Commands is a set of commands to be run as assertions for the current step
type: array
items:
description: The TestAssertCommand object is used by TestAssert to enable running arbitrary commands in asserts
type: object
properties:
command:
description: The command and argument to run as a string.
type: string
script:
description: |
Allows a shell script to run
- namespaced and command should not be used with script.
- namespaced is ignored and command is an error.
- env expansion is depended upon the shell but ENV is passed to the runtime env.
type: string
namespaced:
description: |
If set, the --namespace flag will be appended to the command with the namespace to use
(the test namespace).
type: boolean
skipLogOutput:
description: |
If set, the output from the command is not logged.
Useful for sensitive logs or to reduce noise.
type: boolean
23 changes: 21 additions & 2 deletions crds/teststep-json-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,28 @@ properties:
If specified, a label selector to use when looking up objects to delete.
If both labels and name are unspecified, then all resources of the specified kind in the namespace will be deleted.
type: object


apply:
type: array
description: A list of files to apply as part of this step. Specified path is relative to that in which the step occurs.
items:
type: string
assert:
type: array
description: A list of files to assert as part of this step. See documentation for [asserts and errors](asserts-errors.md) for more information. Specified path is relative to that in which the step occurs.
items:
type: string
error:
type: array
description: A list of files to error as part of this step. See documentation for [asserts and errors](asserts-errors.md) for more information. Specified path is relative to that in which the step occurs.
items:
type: string

index:
description: Override the test step's index.
type: integer
unitTest:
type: boolean
description: Indicates that this is a unit test - safe to run without a real Kubernetes cluster.
commands:
description: Commands to run prior at the beginning of the test step.
type: array
Expand Down Expand Up @@ -71,3 +87,6 @@ properties:
timeout:
description: Override the TestSuite timeout for this command (in seconds).
type: integer
kubeconfig:
type: string
description: Kubeconfig to use when applying and asserting for this step. Optional.
22 changes: 22 additions & 0 deletions crds/teststep_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,28 @@ spec:
If specified, a label selector to use when looking up objects to delete.
If both labels and name are unspecified, then all resources of the specified kind in the namespace will be deleted.
type: object
apply:
type: array
description: A list of files to apply as part of this step. Specified path is relative to that in which the step occurs.
items:
type: string
assert:
type: array
description: A list of files to assert as part of this step. See documentation for [asserts and errors](asserts-errors.md) for more information. Specified path is relative to that in which the step occurs.
items:
type: string
error:
type: array
description: A list of files to error as part of this step. See documentation for [asserts and errors](asserts-errors.md) for more information. Specified path is relative to that in which the step occurs.
items:
type: string

index:
description: Override the test step's index.
type: integer
unitTest:
type: boolean
description: Indicates that this is a unit test - safe to run without a real Kubernetes cluster.
commands:
description: Commands to run prior at the beginning of the test step.
type: array
Expand Down Expand Up @@ -84,3 +103,6 @@ spec:
timeout:
description: Override the TestSuite timeout for this command (in seconds).
type: integer
kubeconfig:
type: string
description: Kubeconfig to use when applying and asserting for this step. Optional.