You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
adds a few retry mechanisms to the `imagetest_tests` resource:
- a "resource" scoped one, that'll just recreate the entire resource
- a "step" scoped one, that'll just retry the step itself
both of which are opt-in
Copy file name to clipboardExpand all lines: docs/resources/tests.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ description: |-
26
26
-`labels` (Map of String) Metadata to attach to the tests resource. Used for filtering and grouping.
27
27
-`name` (String) The name of the test. If one is not provided, a random name will be generated.
28
28
-`repo` (String) The target repository the provider will use for pushing/pulling dynamically built images, overriding provider config.
29
+
-`retry` (Attributes) On failure, tears down the driver completely, creates a fresh one, and re-runs all tests from scratch. This gives each attempt a clean driver, but external side effects from previous attempts are not rolled back: pushed images, written files, cloud resources created outside the driver (e.g. IAM roles, DNS records), and any other out-of-band mutations will still exist. All per-test retry blocks also reset — every test runs from its first attempt on each resource-level retry. (see [below for nested schema](#nestedatt--retry))
29
30
-`skipped` (Boolean) Whether or not the tests were skipped. This is set to true if the tests were skipped, and false otherwise.
30
31
-`tests` (Attributes List) An ordered list of test suites to run (see [below for nested schema](#nestedatt--tests))
31
32
-`timeout` (String) The maximum amount of time to wait for all tests to complete. This includes the time it takes to start and destroy the driver.
@@ -231,6 +232,18 @@ Optional:
231
232
232
233
233
234
235
+
<aid="nestedatt--retry"></a>
236
+
### Nested Schema for `retry`
237
+
238
+
Required:
239
+
240
+
-`attempts` (Number) Total number of attempts including the initial run. Must be >= 1.
241
+
242
+
Optional:
243
+
244
+
-`delay` (String) Delay between retry attempts as a Go duration string (e.g. "5s", "1m"). Defaults to 5s.
245
+
246
+
234
247
<aid="nestedatt--tests"></a>
235
248
### Nested Schema for `tests`
236
249
@@ -246,6 +259,7 @@ Optional:
246
259
-`content` (Attributes List) The content to use for the test (see [below for nested schema](#nestedatt--tests--content))
247
260
-`envs` (Map of String) Environment variables to set on the test container. These will overwrite the environment variables set in the image's config on conflicts.
248
261
-`on_failure` (List of String) Commands to run in the sandbox on test failure for diagnostic collection. Each command runs independently (best-effort); failures do not prevent subsequent commands from executing.
262
+
-`retry` (Attributes) Re-runs this individual test within the same driver instance. Each retry launches a fresh test sandbox container, but all driver-level state persists: for Kubernetes-based drivers (k3s_in_docker, EKS, AKS) this means the cluster, namespace, RBAC, secrets, and any objects created by previous attempts are still present. For EC2, the instance filesystem and Docker daemon state carry over. Tests must be idempotent — use create-or-update patterns, unique names, or explicit cleanup to avoid conflicts with leftover state from failed attempts. (see [below for nested schema](#nestedatt--tests--retry))
249
263
-`timeout` (String) The maximum amount of time to wait for the individual test to complete. This is encompassed by the overall timeout of the parent tests resource.
250
264
251
265
<aid="nestedatt--tests--artifact"></a>
@@ -267,3 +281,15 @@ Required:
267
281
Optional:
268
282
269
283
-`target` (String) The target path to use for the test
284
+
285
+
286
+
<aid="nestedatt--tests--retry"></a>
287
+
### Nested Schema for `tests.retry`
288
+
289
+
Required:
290
+
291
+
-`attempts` (Number) Total number of attempts including the initial run. Must be >= 1.
292
+
293
+
Optional:
294
+
295
+
-`delay` (String) Delay between retry attempts as a Go duration string (e.g. "5s", "1m"). Defaults to 5s.
"retry": retrySchema("Re-runs this individual test within the same driver instance. "+
248
+
"Each retry launches a fresh test sandbox container, but all driver-level state persists: "+
249
+
"for Kubernetes-based drivers (k3s_in_docker, EKS, AKS) this means the cluster, namespace, RBAC, secrets, and any objects created by previous attempts are still present. "+
250
+
"For EC2, the instance filesystem and Docker daemon state carry over. "+
251
+
"Tests must be idempotent — use create-or-update patterns, unique names, or explicit cleanup to avoid conflicts with leftover state from failed attempts."),
209
252
"artifact": schema.SingleNestedAttribute{
210
253
Description: "The bundled artifact generated by the test.",
"retry": retrySchema("On failure, tears down the driver completely, creates a fresh one, and re-runs all tests from scratch. "+
287
+
"This gives each attempt a clean driver, but external side effects from previous attempts are not rolled back: "+
288
+
"pushed images, written files, cloud resources created outside the driver (e.g. IAM roles, DNS records), and any other out-of-band mutations will still exist. "+
289
+
"All per-test retry blocks also reset — every test runs from its first attempt on each resource-level retry."),
0 commit comments