File tree Expand file tree Collapse file tree 1 file changed +33
-4
lines changed Expand file tree Collapse file tree 1 file changed +33
-4
lines changed Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "fmt"
5
+ "runtime"
6
+
7
+ "github.com/mndrix/tap-go"
4
8
"github.com/opencontainers/runtime-tools/validation/util"
5
9
)
6
10
7
- func main () {
11
+ func testHostname ( t * tap. T , hostname string ) error {
8
12
g , err := util .GetDefaultGenerator ()
9
13
if err != nil {
10
- util . Fatal ( err )
14
+ return err
11
15
}
12
- g .SetHostname ("hostname-specific" )
16
+
17
+ g .SetHostname (hostname )
13
18
err = util .RuntimeInsideValidate (g , nil )
19
+ t .Ok (err == nil , "hostname is set correctly" )
14
20
if err != nil {
15
- util .Fatal (err )
21
+ t .Diagnosticf ("expect: err == nil, actual: err != nil" )
22
+ }
23
+
24
+ return nil
25
+ }
26
+
27
+ func main () {
28
+ t := tap .New ()
29
+ t .Header (0 )
30
+ defer t .AutoPlan ()
31
+
32
+ if "linux" != runtime .GOOS {
33
+ t .Skip (1 , fmt .Sprintf ("linux-specific namespace test" ))
34
+ }
35
+
36
+ hostnames := []string {
37
+ "" ,
38
+ "hostname-specific" ,
39
+ }
40
+
41
+ for _ , h := range hostnames {
42
+ if err := testHostname (t , h ); err != nil {
43
+ util .Fatal (err )
44
+ }
16
45
}
17
46
}
You can’t perform that action at this time.
0 commit comments