@@ -28,6 +28,7 @@ func TestClusterInfo_Generate(t *testing.T) {
2828 cases := []struct {
2929 name string
3030 workflow workflow.AgentWorkflowType
31+ nodesConfig AddNodesConfig
3132 objects []runtime.Object
3233 openshiftObjects []runtime.Object
3334 expectedClusterInfo ClusterInfo
@@ -162,11 +163,126 @@ func TestClusterInfo_Generate(t *testing.T) {
162163 },
163164 },
164165 },
166+ {
167+ name : "architecture specified in nodesConfig as arm64 and target cluster is amd64" ,
168+ workflow : workflow .AgentWorkflowTypeAddNodes ,
169+ nodesConfig : AddNodesConfig {
170+ Config : Config {
171+ CPUArchitecture : "arm64" ,
172+ },
173+ },
174+ openshiftObjects : []runtime.Object {
175+ & configv1.ClusterVersion {
176+ ObjectMeta : v1.ObjectMeta {
177+ Name : "version" ,
178+ },
179+ Spec : configv1.ClusterVersionSpec {
180+ ClusterID : "1b5ba46b-7e56-47b1-a326-a9eebddfb38c" ,
181+ },
182+ Status : configv1.ClusterVersionStatus {
183+ History : []configv1.UpdateHistory {
184+ {
185+ Image : "registry.ci.openshift.org/ocp/release@sha256:65d9b652d0d23084bc45cb66001c22e796d43f5e9e005c2bc2702f94397d596e" ,
186+ Version : "4.15.0" ,
187+ },
188+ },
189+ },
190+ },
191+ & configv1.Proxy {
192+ ObjectMeta : v1.ObjectMeta {
193+ Name : "cluster" ,
194+ },
195+ Spec : configv1.ProxySpec {
196+ HTTPProxy : "http://proxy" ,
197+ HTTPSProxy : "https://proxy" ,
198+ NoProxy : "localhost" ,
199+ },
200+ },
201+ },
202+ objects : []runtime.Object {
203+ & corev1.Secret {
204+ ObjectMeta : v1.ObjectMeta {
205+ Name : "pull-secret" ,
206+ Namespace : "openshift-config" ,
207+ },
208+ Data : map [string ][]byte {
209+ ".dockerconfigjson" : []byte ("c3VwZXJzZWNyZXQK" ),
210+ },
211+ },
212+ & corev1.ConfigMap {
213+ ObjectMeta : v1.ObjectMeta {
214+ Name : "user-ca-bundle" ,
215+ Namespace : "openshift-config" ,
216+ },
217+ Data : map [string ]string {
218+ "ca-bundle.crt" : "--- bundle ---" ,
219+ },
220+ },
221+ & corev1.Node {
222+ ObjectMeta : v1.ObjectMeta {
223+ Labels : map [string ]string {
224+ "node-role.kubernetes.io/master" : "" ,
225+ },
226+ },
227+ Status : corev1.NodeStatus {
228+ NodeInfo : corev1.NodeSystemInfo {
229+ Architecture : "amd64" ,
230+ },
231+ },
232+ },
233+ & corev1.ConfigMap {
234+ ObjectMeta : v1.ObjectMeta {
235+ Name : "cluster-config-v1" ,
236+ Namespace : "kube-system" ,
237+ },
238+ Data : map [string ]string {
239+ "install-config" : makeInstallConfig (t ),
240+ },
241+ },
242+ & corev1.ConfigMap {
243+ ObjectMeta : v1.ObjectMeta {
244+ Name : "coreos-bootimages" ,
245+ Namespace : "openshift-machine-config-operator" ,
246+ },
247+ Data : map [string ]string {
248+ "stream" : makeCoreOsBootImages (t , buildStreamData ()),
249+ },
250+ },
251+ },
252+ expectedClusterInfo : ClusterInfo {
253+ ClusterID : "1b5ba46b-7e56-47b1-a326-a9eebddfb38c" ,
254+ ClusterName : "ostest" ,
255+ ReleaseImage : "registry.ci.openshift.org/ocp/release@sha256:65d9b652d0d23084bc45cb66001c22e796d43f5e9e005c2bc2702f94397d596e" ,
256+ Version : "4.15.0" ,
257+ APIDNSName : "api.ostest.test.metalkube.org" ,
258+ Namespace : "cluster0" ,
259+ PullSecret : "c3VwZXJzZWNyZXQK" ,
260+ UserCaBundle : "--- bundle ---" ,
261+ Architecture : "arm64" ,
262+ Proxy : & types.Proxy {
263+ HTTPProxy : "http://proxy" ,
264+ HTTPSProxy : "https://proxy" ,
265+ NoProxy : "localhost" ,
266+ },
267+ ImageDigestSources : []types.ImageDigestSource {
268+ {
269+ Source : "quay.io/openshift-release-dev/ocp-v4.0-art-dev" ,
270+ Mirrors : []string {
271+ "registry.example.com:5000/ocp4/openshift4" ,
272+ },
273+ },
274+ },
275+ PlatformType : v1beta1 .BareMetalPlatformType ,
276+ SSHKey : "my-ssh-key" ,
277+ OSImage : buildStreamData (),
278+ OSImageLocation : "http://my-coreosimage-url/416.94.202402130130-1" ,
279+ },
280+ },
165281 }
166282 for _ , tc := range cases {
167283 t .Run (tc .name , func (t * testing.T ) {
168284 agentWorkflow := & workflow.AgentWorkflow {Workflow : tc .workflow }
169- addNodesConfig := & AddNodesConfig {}
285+ addNodesConfig := & tc . nodesConfig
170286 parents := asset.Parents {}
171287 parents .Add (agentWorkflow )
172288 parents .Add (addNodesConfig )
@@ -219,6 +335,20 @@ func buildStreamData() *stream.Stream {
219335 },
220336 },
221337 },
338+ "aarch64" : {
339+ Artifacts : map [string ]stream.PlatformArtifacts {
340+ "metal" : {
341+ Release : "416.94.202402130130-0" ,
342+ Formats : map [string ]stream.ImageFormat {
343+ "iso" : {
344+ Disk : & stream.Artifact {
345+ Location : "http://my-coreosimage-url/416.94.202402130130-1" ,
346+ },
347+ },
348+ },
349+ },
350+ },
351+ },
222352 },
223353 }
224354}
0 commit comments