@@ -29,24 +29,27 @@ func TestNew(t *testing.T) {
29
29
{
30
30
desc : "no options" ,
31
31
c : & Client {
32
- flags : make ([]string , 0 ),
33
- debug : false ,
32
+ flags : make ([]string , 0 ),
33
+ ofctlFlags : make ([]string , 0 ),
34
+ debug : false ,
34
35
},
35
36
},
36
37
{
37
38
desc : "Timeout(2)" ,
38
39
options : []OptionFunc {Timeout (2 )},
39
40
c : & Client {
40
- flags : []string {"--timeout=2" },
41
- debug : false ,
41
+ flags : []string {"--timeout=2" },
42
+ ofctlFlags : make ([]string , 0 ),
43
+ debug : false ,
42
44
},
43
45
},
44
46
{
45
47
desc : "Debug(true)" ,
46
48
options : []OptionFunc {Debug (true )},
47
49
c : & Client {
48
- flags : make ([]string , 0 ),
49
- debug : true ,
50
+ flags : make ([]string , 0 ),
51
+ ofctlFlags : make ([]string , 0 ),
52
+ debug : true ,
50
53
},
51
54
},
52
55
{
@@ -72,8 +75,9 @@ func TestNew(t *testing.T) {
72
75
Debug (true ),
73
76
},
74
77
c : & Client {
75
- flags : []string {"--timeout=5" },
76
- debug : true ,
78
+ flags : []string {"--timeout=5" },
79
+ ofctlFlags : make ([]string , 0 ),
80
+ debug : true ,
77
81
},
78
82
},
79
83
{
@@ -82,8 +86,19 @@ func TestNew(t *testing.T) {
82
86
Sudo (),
83
87
},
84
88
c : & Client {
85
- flags : make ([]string , 0 ),
86
- sudo : true ,
89
+ flags : make ([]string , 0 ),
90
+ ofctlFlags : make ([]string , 0 ),
91
+ sudo : true ,
92
+ },
93
+ },
94
+ {
95
+ desc : "SetSSLParam(pkey, cert, cacert)" ,
96
+ options : []OptionFunc {
97
+ SetSSLParam ("privkey.pem" , "cert.pem" , "cacert.pem" ),
98
+ },
99
+ c : & Client {
100
+ flags : make ([]string , 0 ),
101
+ ofctlFlags : []string {"--private-key=privkey.pem" , "--certificate=cert.pem" , "--ca-cert=cacert.pem" },
87
102
},
88
103
},
89
104
}
@@ -101,6 +116,15 @@ func TestNew(t *testing.T) {
101
116
t .Fatalf ("unexpected Client.debug:\n - want: %v\n - got: %v" ,
102
117
want , got )
103
118
}
119
+ if want , got := tt .c .sudo , c .sudo ; ! reflect .DeepEqual (want , got ) {
120
+ t .Fatalf ("unexpected Client.sudo:\n - want: %v\n - got: %v" ,
121
+ want , got )
122
+ }
123
+
124
+ if want , got := tt .c .ofctlFlags , c .ofctlFlags ; ! reflect .DeepEqual (want , got ) {
125
+ t .Fatalf ("unexpected Client.ofctlFlags:\n - want: %v\n - got: %v" ,
126
+ want , got )
127
+ }
104
128
})
105
129
}
106
130
}
0 commit comments