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
Copy file name to clipboardExpand all lines: docs/devel_guidelines.md
+46-3
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,52 @@ Each validation test has a `.go` file in the `validation/` directory and can be
7
7
### TAP output
8
8
9
9
Each validation test prints TAP output.
10
-
So far, we have two kinds of validation tests and they print the TAP output differently:
11
-
* tests using `util.RuntimeInsideValidate`: they start the process `runtimetest` inside the container and `runtimetest` prints the TAP output. The test process itself must not output anything to avoid mixing its output with the TAP output. Each test can only call `util.RuntimeInsideValidate` one time because several TAP outputs cannot be concatenated.
12
-
* tests using `util.RuntimeOutsideValidate`: they create a container but without executing `runtimetest`. The test program itself must print the TAP output.
10
+
So far, we have three kinds of validation tests and they print the TAP output differently:
11
+
12
+
#### Using `util.RuntimeOutsideValidate`
13
+
14
+
They create a container but without executing `runtimetest`. The test program itself must print the TAP output.
15
+
16
+
Example:
17
+
```go
18
+
err = util.RuntimeOutsideValidate(g, t, func(config *rspec.Spec, t *tap.T, state *rspec.State) error {
19
+
err:=testFoo()
20
+
t.Ok((err == nil), "check foo")
21
+
if err != nil {
22
+
t.Diagnostic(err.Error())
23
+
returnnil
24
+
}
25
+
returnnil
26
+
})
27
+
28
+
```
29
+
#### Using `util.RuntimeInsideValidate` and passthrough
30
+
31
+
They start the process `runtimetest` inside the container and `runtimetest` prints the TAP output.
32
+
The test process itself must not output anything to avoid mixing its output with the TAP output.
33
+
Each test can only call `util.RuntimeInsideValidate` one time because several TAP outputs cannot be concatenated.
34
+
35
+
Example:
36
+
```go
37
+
err = util.RuntimeInsideValidate(g, nil, nil)
38
+
if err != nil {
39
+
util.Fatal(err)
40
+
}
41
+
```
42
+
43
+
#### Using `util.RuntimeInsideValidate` and encapsulation
44
+
45
+
Similar to the passthrough variant but the test consumes the output from `runtimetest` and re-emit a single TAP result for the container run.
46
+
For that, the TAP object must be passed as parameter to `util.RuntimeInsideValidate`.
0 commit comments