@@ -12,6 +12,7 @@ import (
1212 aiv1beta1 "github.com/openshift/assisted-service/api/v1beta1"
1313 "github.com/openshift/installer/pkg/asset"
1414 agentAsset "github.com/openshift/installer/pkg/asset/agent"
15+ "github.com/openshift/installer/pkg/asset/agent/joiner"
1516 "github.com/openshift/installer/pkg/asset/agent/workflow"
1617 "github.com/openshift/installer/pkg/asset/installconfig"
1718 "github.com/openshift/installer/pkg/ipnet"
@@ -78,10 +79,36 @@ func TestAgentHosts_Generate(t *testing.T) {
7879 expectedError string
7980 expectedConfig * AgentHostsBuilder
8081 }{
82+ {
83+ name : "host-from-add-nodes-config" ,
84+ dependencies : []asset.Asset {
85+ & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeAddNodes },
86+ & joiner.AddNodesConfig {
87+ Config : joiner.Config {
88+ Hosts : []agent.Host {
89+ {
90+ Hostname : "extra-worker-0" ,
91+ Role : "worker" ,
92+ Interfaces : []* aiv1beta1.Interface {
93+ {
94+ Name : "enp3s1" ,
95+ MacAddress : "28:d2:44:d2:b2:1a" ,
96+ },
97+ },
98+ },
99+ },
100+ },
101+ },
102+ getNoHostsInstallConfig (),
103+ getNoHostsAgentConfig (),
104+ },
105+ expectedConfig : agentHosts ().hosts (agentHost ().name ("extra-worker-0" ).role ("worker" ).interfaces (iface ("enp3s1" , "28:d2:44:d2:b2:1a" ))),
106+ },
81107 {
82108 name : "no-hosts" ,
83109 dependencies : []asset.Asset {
84110 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
111+ & joiner.AddNodesConfig {},
85112 getNoHostsInstallConfig (),
86113 getNoHostsAgentConfig (),
87114 },
@@ -91,6 +118,7 @@ func TestAgentHosts_Generate(t *testing.T) {
91118 name : "host-from-agent-config" ,
92119 dependencies : []asset.Asset {
93120 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
121+ & joiner.AddNodesConfig {},
94122 getInstallConfigSingleHost (),
95123 getAgentConfigSingleHost (),
96124 },
@@ -100,6 +128,7 @@ func TestAgentHosts_Generate(t *testing.T) {
100128 name : "host-from-install-config" ,
101129 dependencies : []asset.Asset {
102130 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
131+ & joiner.AddNodesConfig {},
103132 getInstallConfigSingleHost (),
104133 getNoHostsAgentConfig (),
105134 },
@@ -109,6 +138,7 @@ func TestAgentHosts_Generate(t *testing.T) {
109138 name : "multi-host-from-agent-config" ,
110139 dependencies : []asset.Asset {
111140 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
141+ & joiner.AddNodesConfig {},
112142 getInstallConfigSingleHost (),
113143 getAgentConfigMultiHost (),
114144 },
@@ -120,6 +150,7 @@ func TestAgentHosts_Generate(t *testing.T) {
120150 name : "multi-host-from-install-config" ,
121151 dependencies : []asset.Asset {
122152 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
153+ & joiner.AddNodesConfig {},
123154 getInstallConfigMultiHost (),
124155 getNoHostsAgentConfig (),
125156 },
@@ -131,6 +162,7 @@ func TestAgentHosts_Generate(t *testing.T) {
131162 name : "unsupported-device-name-agent-config" ,
132163 dependencies : []asset.Asset {
133164 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
165+ & joiner.AddNodesConfig {},
134166 getInstallConfigSingleHost (),
135167 getAgentConfigUnsupportedDeviceName (),
136168 },
@@ -141,6 +173,7 @@ func TestAgentHosts_Generate(t *testing.T) {
141173 name : "unsupported-wwn-extension-install-config" ,
142174 dependencies : []asset.Asset {
143175 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
176+ & joiner.AddNodesConfig {},
144177 getInstallConfigUnsupportedWWNExtension (),
145178 getNoHostsAgentConfig (),
146179 },
@@ -151,6 +184,7 @@ func TestAgentHosts_Generate(t *testing.T) {
151184 name : "unsupported-www-vendor-extension-agent-config" ,
152185 dependencies : []asset.Asset {
153186 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
187+ & joiner.AddNodesConfig {},
154188 getInstallConfigSingleHost (),
155189 getAgentConfigUnsupportedWWNVendorExtension (),
156190 },
@@ -161,6 +195,7 @@ func TestAgentHosts_Generate(t *testing.T) {
161195 name : "node-hostname-and-role-are-not-required" ,
162196 dependencies : []asset.Asset {
163197 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
198+ & joiner.AddNodesConfig {},
164199 getInstallConfigNoHostnameOrRole (),
165200 getNoHostsAgentConfig (),
166201 },
@@ -170,6 +205,7 @@ func TestAgentHosts_Generate(t *testing.T) {
170205 name : "host-roles-have-incorrect-values" ,
171206 dependencies : []asset.Asset {
172207 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
208+ & joiner.AddNodesConfig {},
173209 getInstallConfigSingleHost (),
174210 getAgentConfigInvalidHostRole (),
175211 },
@@ -180,6 +216,7 @@ func TestAgentHosts_Generate(t *testing.T) {
180216 name : "different-hosts-cannot-have-same-mac" ,
181217 dependencies : []asset.Asset {
182218 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
219+ & joiner.AddNodesConfig {},
183220 getInstallConfigSameMac (),
184221 getNoHostsAgentConfig (),
185222 },
@@ -190,6 +227,7 @@ func TestAgentHosts_Generate(t *testing.T) {
190227 name : "invalid-mac" ,
191228 dependencies : []asset.Asset {
192229 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
230+ & joiner.AddNodesConfig {},
193231 getInstallConfigSingleHost (),
194232 getAgentConfigInvalidMac (),
195233 },
@@ -200,6 +238,7 @@ func TestAgentHosts_Generate(t *testing.T) {
200238 name : "duplicate-mac-same-host-agent-config" ,
201239 dependencies : []asset.Asset {
202240 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
241+ & joiner.AddNodesConfig {},
203242 getInstallConfigSingleHost (),
204243 getAgentConfigInvalidInterfaces (),
205244 },
@@ -210,6 +249,7 @@ func TestAgentHosts_Generate(t *testing.T) {
210249 name : "duplicate-mac-same-host-install-config" ,
211250 dependencies : []asset.Asset {
212251 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
252+ & joiner.AddNodesConfig {},
213253 getInstallConfigInvalidInterfaces (),
214254 getNoHostsAgentConfig (),
215255 },
@@ -220,6 +260,7 @@ func TestAgentHosts_Generate(t *testing.T) {
220260 name : "invalid-rendezvous-agent-config" ,
221261 dependencies : []asset.Asset {
222262 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
263+ & joiner.AddNodesConfig {},
223264 getInstallConfigSingleHost (),
224265 getAgentConfigInvalidRendezvousIP (),
225266 },
@@ -230,6 +271,7 @@ func TestAgentHosts_Generate(t *testing.T) {
230271 name : "invalid-rendezvous-install-config" ,
231272 dependencies : []asset.Asset {
232273 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
274+ & joiner.AddNodesConfig {},
233275 getInstallConfigInvalidRendezvousIP (),
234276 getNoHostsAgentConfig (),
235277 },
@@ -240,6 +282,7 @@ func TestAgentHosts_Generate(t *testing.T) {
240282 name : "host-missing-interface-error" ,
241283 dependencies : []asset.Asset {
242284 & workflow.AgentWorkflow {Workflow : workflow .AgentWorkflowTypeInstall },
285+ & joiner.AddNodesConfig {},
243286 getInstallConfigSingleHost (),
244287 getAgentConfigMissingInterfaces (),
245288 },
@@ -261,6 +304,8 @@ func TestAgentHosts_Generate(t *testing.T) {
261304 assert .NoError (t , err )
262305 if tc .expectedConfig != nil {
263306 assert .Equal (t , tc .expectedConfig .build ().Hosts , asset .Hosts , "unexpected Config in AgentHosts" )
307+ } else {
308+ assert .Nil (t , asset .Hosts )
264309 }
265310 }
266311 })
0 commit comments