Skip to content

Commit b880d57

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 0c66fe9 commit b880d57

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
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
@@ -945,15 +945,15 @@ func run(context *cli.Context) error {
945945
} else {
946946
t.Fail(v.description)
947947
}
948-
t.Diagnostic(err.Error())
948+
t.YAML(map[string]string{"error": err.Error()})
949949
}
950950
} else {
951951
if e, ok := err.(*rfc2119.Error); ok {
952952
t.Ok(e.Level < complianceLevel, v.description)
953953
} else {
954954
t.Fail(v.description)
955955
}
956-
t.Diagnostic(err.Error())
956+
t.YAML(map[string]string{"error": err.Error()})
957957
}
958958
}
959959
}

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/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
@@ -42,12 +42,12 @@ func Fatal(err error) {
4242
}
4343

4444
// Skip skips a full TAP suite.
45-
func Skip(message string, diagnostic string) {
45+
func Skip(message string, diagnostic interface{}) {
4646
t := tap.New()
4747
t.Header(1)
4848
t.Skip(1, message)
49-
if diagnostic != "" {
50-
t.Diagnostic(diagnostic)
49+
if diagnostic != nil {
50+
t.YAML(diagnostic)
5151
}
5252
}
5353

0 commit comments

Comments
 (0)