Skip to content

Commit e666abd

Browse files
committed
*: Transition from tap Diagnostic(...) to YAML(...)
See ad47e7d (Makefile: Change from prove to node-tap, 2017-11-30, opencontainers#439) about how node-tap handles YAML blocks vs. diagnostics. The README's localvalidation line is back after I accidentally removed it in ad47e7d. Signed-off-by: W. Trevor King <[email protected]>
1 parent aeaf786 commit e666abd

File tree

7 files changed

+21
-12
lines changed

7 files changed

+21
-12
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ $ npm install tap
3939

4040
```console
4141
$ make runtimetest validation-executables
42+
$ sudo make RUNTIME=runc localvalidation
4243
RUNTIME=runc tap validation/linux_rootfs_propagation_shared.t validation/create.t validation/default.t validation/linux_readonly_paths.t validation/linux_masked_paths.t validation/mounts.t validation/process.t validation/root_readonly_false.t validation/linux_sysctl.t validation/linux_devices.t validation/linux_gid_mappings.t validation/process_oom_score_adj.t validation/process_capabilities.t validation/process_rlimits.t validation/root_readonly_true.t validation/linux_rootfs_propagation_unbindable.t validation/hostname.t validation/linux_uid_mappings.t
4344
validation/linux_rootfs_propagation_shared.t ........ 18/19
4445
not ok rootfs propagation
46+
error: 'rootfs should be shared, but not'
4547

4648
validation/create.t ................................... 4/4
4749
validation/default.t ................................ 19/19
4850
validation/linux_readonly_paths.t ................... 19/19
4951
validation/linux_masked_paths.t ..................... 18/19
5052
not ok masked paths
53+
error: /masktest should not be readable
5154

5255
validation/mounts.t ................................... 0/1
5356
Skipped: 1

cmd/runtimetest/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,15 +917,15 @@ func run(context *cli.Context) error {
917917
} else {
918918
t.Fail(v.description)
919919
}
920-
t.Diagnostic(err.Error())
920+
t.YAML(map[string]string{"error": err.Error()})
921921
}
922922
} else {
923923
if e, ok := err.(*rfc2119.Error); ok {
924924
t.Ok(e.Level < complianceLevel, v.description)
925925
} else {
926926
t.Fail(v.description)
927927
}
928-
t.Diagnostic(err.Error())
928+
t.YAML(map[string]string{"error": err.Error()})
929929
}
930930
}
931931
}

validation/create.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,24 @@ func main() {
5050
r.SetID(c.id)
5151
stderr, err := r.Create()
5252
t.Ok((err == nil) == c.errExpected, c.err.(*specerror.Error).Err.Err.Error())
53-
t.Diagnostic(c.err.(*specerror.Error).Err.Reference)
53+
diagnostic := map[string]string{
54+
"reference": c.err.(*specerror.Error).Err.Reference,
55+
}
5456
if err != nil {
55-
t.Diagnostic(err.Error())
57+
diagnostic["error"] = err.Error()
5658
}
5759
if len(stderr) > 0 {
58-
t.Diagnostic(string(stderr))
60+
diagnostic["stderr"] = string(stderr)
5961
}
62+
t.YAML(diagnostic)
6063

6164
if err == nil {
6265
state, _ := r.State()
6366
t.Ok(state.ID == c.id, "")
64-
t.Diagnosticf("container PID: %d, state ID: %d", c.id, state.ID)
67+
t.YAML(map[string]string{
68+
"container ID": c.id,
69+
"state ID": state.ID,
70+
})
6571
}
6672
}
6773

validation/mounts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import (
55
)
66

77
func main() {
8-
util.Skip("TODO: mounts generation options have not been implemented", "")
8+
util.Skip("TODO: mounts generation options have not been implemented", nil)
99
}

validation/process_capabilities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func main() {
1111
if "linux" != runtime.GOOS {
12-
util.Skip("linux-specific process.capabilities test", runtime.GOOS)
12+
util.Skip("linux-specific process.capabilities test", map[string]string{"OS": runtime.GOOS})
1313
os.Exit(0)
1414
}
1515

validation/root_readonly_true.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func main() {
1111
if "windows" == runtime.GOOS {
12-
util.Skip("non-Windows root.readonly test", runtime.GOOS)
12+
util.Skip("non-Windows root.readonly test", map[string]string{"OS": runtime.GOOS})
1313
os.Exit(0)
1414
}
1515

validation/util/test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ func Fatal(err error) {
3838
}
3939

4040
// Skip skips a full TAP suite.
41-
func Skip(message string, diagnostic string) {
41+
func Skip(message string, diagnostic interface{}) {
4242
t := tap.New()
4343
t.Header(1)
4444
t.Skip(1, message)
45-
if diagnostic != "" {
46-
t.Diagnostic(diagnostic)
45+
if diagnostic != nil {
46+
t.YAML(diagnostic)
4747
}
4848
}
4949

0 commit comments

Comments
 (0)