@@ -46,68 +46,68 @@ func TestCreateInvalids(t *testing.T) {
4646 defer cleanup ()
4747 assert .NilError (t , cli .ContextStore ().CreateOrUpdateContext (store.ContextMetadata {Name : "existing-context" }))
4848 tests := []struct {
49- options createOptions
49+ options CreateOptions
5050 expecterErr string
5151 }{
5252 {
5353 expecterErr : `context name cannot be empty` ,
5454 },
5555 {
56- options : createOptions {
57- name : " " ,
56+ options : CreateOptions {
57+ Name : " " ,
5858 },
5959 expecterErr : `context name " " is invalid` ,
6060 },
6161 {
62- options : createOptions {
63- name : "existing-context" ,
62+ options : CreateOptions {
63+ Name : "existing-context" ,
6464 },
6565 expecterErr : `context "existing-context" already exists` ,
6666 },
6767 {
68- options : createOptions {
69- name : "invalid-docker-host" ,
70- docker : map [string ]string {
68+ options : CreateOptions {
69+ Name : "invalid-docker-host" ,
70+ Docker : map [string ]string {
7171 keyHost : "some///invalid/host" ,
7272 },
7373 },
7474 expecterErr : `unable to parse docker host` ,
7575 },
7676 {
77- options : createOptions {
78- name : "invalid-orchestrator" ,
79- defaultStackOrchestrator : "invalid" ,
77+ options : CreateOptions {
78+ Name : "invalid-orchestrator" ,
79+ DefaultStackOrchestrator : "invalid" ,
8080 },
8181 expecterErr : `specified orchestrator "invalid" is invalid, please use either kubernetes, swarm or all` ,
8282 },
8383 {
84- options : createOptions {
85- name : "orchestrator-swarm-no-endpoint" ,
86- defaultStackOrchestrator : "swarm" ,
84+ options : CreateOptions {
85+ Name : "orchestrator-swarm-no-endpoint" ,
86+ DefaultStackOrchestrator : "swarm" ,
8787 },
8888 expecterErr : `docker endpoint configuration is required` ,
8989 },
9090 {
91- options : createOptions {
92- name : "orchestrator-kubernetes-no-endpoint" ,
93- defaultStackOrchestrator : "kubernetes" ,
94- docker : map [string ]string {},
91+ options : CreateOptions {
92+ Name : "orchestrator-kubernetes-no-endpoint" ,
93+ DefaultStackOrchestrator : "kubernetes" ,
94+ Docker : map [string ]string {},
9595 },
9696 expecterErr : `cannot specify orchestrator "kubernetes" without configuring a Kubernetes endpoint` ,
9797 },
9898 {
99- options : createOptions {
100- name : "orchestrator-all-no-endpoint" ,
101- defaultStackOrchestrator : "all" ,
102- docker : map [string ]string {},
99+ options : CreateOptions {
100+ Name : "orchestrator-all-no-endpoint" ,
101+ DefaultStackOrchestrator : "all" ,
102+ Docker : map [string ]string {},
103103 },
104104 expecterErr : `cannot specify orchestrator "all" without configuring a Kubernetes endpoint` ,
105105 },
106106 }
107107 for _ , tc := range tests {
108108 tc := tc
109- t .Run (tc .options .name , func (t * testing.T ) {
110- err := runCreate (cli , & tc .options )
109+ t .Run (tc .options .Name , func (t * testing.T ) {
110+ err := RunCreate (cli , & tc .options )
111111 assert .ErrorContains (t , err , tc .expecterErr )
112112 })
113113 }
@@ -117,10 +117,10 @@ func TestCreateOrchestratorSwarm(t *testing.T) {
117117 cli , cleanup := makeFakeCli (t )
118118 defer cleanup ()
119119
120- err := runCreate (cli , & createOptions {
121- name : "test" ,
122- defaultStackOrchestrator : "swarm" ,
123- docker : map [string ]string {},
120+ err := RunCreate (cli , & CreateOptions {
121+ Name : "test" ,
122+ DefaultStackOrchestrator : "swarm" ,
123+ Docker : map [string ]string {},
124124 })
125125 assert .NilError (t , err )
126126 assert .Equal (t , "test\n " , cli .OutBuffer ().String ())
@@ -131,9 +131,9 @@ func TestCreateOrchestratorEmpty(t *testing.T) {
131131 cli , cleanup := makeFakeCli (t )
132132 defer cleanup ()
133133
134- err := runCreate (cli , & createOptions {
135- name : "test" ,
136- docker : map [string ]string {},
134+ err := RunCreate (cli , & CreateOptions {
135+ Name : "test" ,
136+ Docker : map [string ]string {},
137137 })
138138 assert .NilError (t , err )
139139}
@@ -156,13 +156,13 @@ func createTestContextWithKube(t *testing.T, cli command.Cli) {
156156 revert := env .Patch (t , "KUBECONFIG" , "./testdata/test-kubeconfig" )
157157 defer revert ()
158158
159- err := runCreate (cli , & createOptions {
160- name : "test" ,
161- defaultStackOrchestrator : "all" ,
162- kubernetes : map [string ]string {
159+ err := RunCreate (cli , & CreateOptions {
160+ Name : "test" ,
161+ DefaultStackOrchestrator : "all" ,
162+ Kubernetes : map [string ]string {
163163 keyFromCurrent : "true" ,
164164 },
165- docker : map [string ]string {},
165+ Docker : map [string ]string {},
166166 })
167167 assert .NilError (t , err )
168168}
0 commit comments