@@ -60,7 +60,7 @@ func TestCreate(t *testing.T) {
6060 assert .NilError (t , cli .ContextStore ().CreateOrUpdate (store.Metadata {Name : "existing-context" }))
6161 tests := []struct {
6262 doc string
63- options CreateOptions
63+ options createOptions
6464 expecterErr string
6565 }{
6666 {
@@ -69,58 +69,58 @@ func TestCreate(t *testing.T) {
6969 },
7070 {
7171 doc : "reserved name" ,
72- options : CreateOptions {
73- Name : "default" ,
72+ options : createOptions {
73+ name : "default" ,
7474 },
7575 expecterErr : `"default" is a reserved context name` ,
7676 },
7777 {
7878 doc : "whitespace-only name" ,
79- options : CreateOptions {
80- Name : " " ,
79+ options : createOptions {
80+ name : " " ,
8181 },
8282 expecterErr : `context name " " is invalid` ,
8383 },
8484 {
8585 doc : "existing context" ,
86- options : CreateOptions {
87- Name : "existing-context" ,
86+ options : createOptions {
87+ name : "existing-context" ,
8888 },
8989 expecterErr : `context "existing-context" already exists` ,
9090 },
9191 {
9292 doc : "invalid docker host" ,
93- options : CreateOptions {
94- Name : "invalid-docker-host" ,
95- Docker : map [string ]string {
93+ options : createOptions {
94+ name : "invalid-docker-host" ,
95+ endpoint : map [string ]string {
9696 "host" : "some///invalid/host" ,
9797 },
9898 },
9999 expecterErr : `unable to parse docker host` ,
100100 },
101101 {
102102 doc : "ssh host with skip-tls-verify=false" ,
103- options : CreateOptions {
104- Name : "skip-tls-verify-false" ,
105- Docker : map [string ]string {
103+ options : createOptions {
104+ name : "skip-tls-verify-false" ,
105+ endpoint : map [string ]string {
106106 "host" : "ssh://example.com,skip-tls-verify=false" ,
107107 },
108108 },
109109 },
110110 {
111111 doc : "ssh host with skip-tls-verify=true" ,
112- options : CreateOptions {
113- Name : "skip-tls-verify-true" ,
114- Docker : map [string ]string {
112+ options : createOptions {
113+ name : "skip-tls-verify-true" ,
114+ endpoint : map [string ]string {
115115 "host" : "ssh://example.com,skip-tls-verify=true" ,
116116 },
117117 },
118118 },
119119 {
120120 doc : "ssh host with skip-tls-verify=INVALID" ,
121- options : CreateOptions {
122- Name : "skip-tls-verify-invalid" ,
123- Docker : map [string ]string {
121+ options : createOptions {
122+ name : "skip-tls-verify-invalid" ,
123+ endpoint : map [string ]string {
124124 "host" : "ssh://example.com" ,
125125 "skip-tls-verify" : "INVALID" ,
126126 },
@@ -129,9 +129,9 @@ func TestCreate(t *testing.T) {
129129 },
130130 {
131131 doc : "unknown option" ,
132- options : CreateOptions {
133- Name : "unknown-option" ,
134- Docker : map [string ]string {
132+ options : createOptions {
133+ name : "unknown-option" ,
134+ endpoint : map [string ]string {
135135 "UNKNOWN" : "value" ,
136136 },
137137 },
@@ -140,7 +140,7 @@ func TestCreate(t *testing.T) {
140140 }
141141 for _ , tc := range tests {
142142 t .Run (tc .doc , func (t * testing.T ) {
143- err := RunCreate (cli , & tc .options )
143+ err := runCreate (cli , & tc .options )
144144 if tc .expecterErr == "" {
145145 assert .NilError (t , err )
146146 } else {
@@ -159,9 +159,9 @@ func assertContextCreateLogging(t *testing.T, cli *test.FakeCli, n string) {
159159func TestCreateOrchestratorEmpty (t * testing.T ) {
160160 cli := makeFakeCli (t )
161161
162- err := RunCreate (cli , & CreateOptions {
163- Name : "test" ,
164- Docker : map [string ]string {},
162+ err := runCreate (cli , & createOptions {
163+ name : "test" ,
164+ endpoint : map [string ]string {},
165165 })
166166 assert .NilError (t , err )
167167 assertContextCreateLogging (t , cli , "test" )
@@ -187,20 +187,20 @@ func TestCreateFromContext(t *testing.T) {
187187
188188 cli := makeFakeCli (t )
189189 cli .ResetOutputBuffers ()
190- assert .NilError (t , RunCreate (cli , & CreateOptions {
191- Name : "original" ,
192- Description : "original description" ,
193- Docker : map [string ]string {
190+ assert .NilError (t , runCreate (cli , & createOptions {
191+ name : "original" ,
192+ description : "original description" ,
193+ endpoint : map [string ]string {
194194 keyHost : "tcp://42.42.42.42:2375" ,
195195 },
196196 }))
197197 assertContextCreateLogging (t , cli , "original" )
198198
199199 cli .ResetOutputBuffers ()
200- assert .NilError (t , RunCreate (cli , & CreateOptions {
201- Name : "dummy" ,
202- Description : "dummy description" ,
203- Docker : map [string ]string {
200+ assert .NilError (t , runCreate (cli , & createOptions {
201+ name : "dummy" ,
202+ description : "dummy description" ,
203+ endpoint : map [string ]string {
204204 keyHost : "tcp://24.24.24.24:2375" ,
205205 },
206206 }))
@@ -211,11 +211,11 @@ func TestCreateFromContext(t *testing.T) {
211211 for _ , tc := range cases {
212212 t .Run (tc .name , func (t * testing.T ) {
213213 cli .ResetOutputBuffers ()
214- err := RunCreate (cli , & CreateOptions {
215- From : "original" ,
216- Name : tc .name ,
217- Description : tc .description ,
218- Docker : tc .docker ,
214+ err := runCreate (cli , & createOptions {
215+ from : "original" ,
216+ name : tc .name ,
217+ description : tc .description ,
218+ endpoint : tc .docker ,
219219 })
220220 assert .NilError (t , err )
221221 assertContextCreateLogging (t , cli , tc .name )
@@ -251,10 +251,10 @@ func TestCreateFromCurrent(t *testing.T) {
251251
252252 cli := makeFakeCli (t )
253253 cli .ResetOutputBuffers ()
254- assert .NilError (t , RunCreate (cli , & CreateOptions {
255- Name : "original" ,
256- Description : "original description" ,
257- Docker : map [string ]string {
254+ assert .NilError (t , runCreate (cli , & createOptions {
255+ name : "original" ,
256+ description : "original description" ,
257+ endpoint : map [string ]string {
258258 keyHost : "tcp://42.42.42.42:2375" ,
259259 },
260260 }))
@@ -265,9 +265,9 @@ func TestCreateFromCurrent(t *testing.T) {
265265 for _ , tc := range cases {
266266 t .Run (tc .name , func (t * testing.T ) {
267267 cli .ResetOutputBuffers ()
268- err := RunCreate (cli , & CreateOptions {
269- Name : tc .name ,
270- Description : tc .description ,
268+ err := runCreate (cli , & createOptions {
269+ name : tc .name ,
270+ description : tc .description ,
271271 })
272272 assert .NilError (t , err )
273273 assertContextCreateLogging (t , cli , tc .name )
0 commit comments