@@ -25,6 +25,7 @@ func TestClusterInfo_Generate(t *testing.T) {
2525 cases := []struct {
2626 name string
2727 workflow workflow.AgentWorkflowType
28+ nodesConfig AddNodesConfig
2829 objects []runtime.Object
2930 openshiftObjects []runtime.Object
3031 expectedClusterInfo ClusterInfo
@@ -144,11 +145,126 @@ func TestClusterInfo_Generate(t *testing.T) {
144145 OSImageLocation : "http://my-coreosimage-url/416.94.202402130130-0" ,
145146 },
146147 },
148+ {
149+ name : "architecture specified in nodesConfig as arm64 and target cluster is amd64" ,
150+ workflow : workflow .AgentWorkflowTypeAddNodes ,
151+ nodesConfig : AddNodesConfig {
152+ Config : Config {
153+ CPUArchitecture : "arm64" ,
154+ },
155+ },
156+ openshiftObjects : []runtime.Object {
157+ & configv1.ClusterVersion {
158+ ObjectMeta : v1.ObjectMeta {
159+ Name : "version" ,
160+ },
161+ Spec : configv1.ClusterVersionSpec {
162+ ClusterID : "1b5ba46b-7e56-47b1-a326-a9eebddfb38c" ,
163+ },
164+ Status : configv1.ClusterVersionStatus {
165+ History : []configv1.UpdateHistory {
166+ {
167+ Image : "registry.ci.openshift.org/ocp/release@sha256:65d9b652d0d23084bc45cb66001c22e796d43f5e9e005c2bc2702f94397d596e" ,
168+ Version : "4.15.0" ,
169+ },
170+ },
171+ },
172+ },
173+ & configv1.Proxy {
174+ ObjectMeta : v1.ObjectMeta {
175+ Name : "cluster" ,
176+ },
177+ Spec : configv1.ProxySpec {
178+ HTTPProxy : "http://proxy" ,
179+ HTTPSProxy : "https://proxy" ,
180+ NoProxy : "localhost" ,
181+ },
182+ },
183+ },
184+ objects : []runtime.Object {
185+ & corev1.Secret {
186+ ObjectMeta : v1.ObjectMeta {
187+ Name : "pull-secret" ,
188+ Namespace : "openshift-config" ,
189+ },
190+ Data : map [string ][]byte {
191+ ".dockerconfigjson" : []byte ("c3VwZXJzZWNyZXQK" ),
192+ },
193+ },
194+ & corev1.ConfigMap {
195+ ObjectMeta : v1.ObjectMeta {
196+ Name : "user-ca-bundle" ,
197+ Namespace : "openshift-config" ,
198+ },
199+ Data : map [string ]string {
200+ "ca-bundle.crt" : "--- bundle ---" ,
201+ },
202+ },
203+ & corev1.Node {
204+ ObjectMeta : v1.ObjectMeta {
205+ Labels : map [string ]string {
206+ "node-role.kubernetes.io/master" : "" ,
207+ },
208+ },
209+ Status : corev1.NodeStatus {
210+ NodeInfo : corev1.NodeSystemInfo {
211+ Architecture : "amd64" ,
212+ },
213+ },
214+ },
215+ & corev1.ConfigMap {
216+ ObjectMeta : v1.ObjectMeta {
217+ Name : "cluster-config-v1" ,
218+ Namespace : "kube-system" ,
219+ },
220+ Data : map [string ]string {
221+ "install-config" : makeInstallConfig (t ),
222+ },
223+ },
224+ & corev1.ConfigMap {
225+ ObjectMeta : v1.ObjectMeta {
226+ Name : "coreos-bootimages" ,
227+ Namespace : "openshift-machine-config-operator" ,
228+ },
229+ Data : map [string ]string {
230+ "stream" : makeCoreOsBootImages (t , buildStreamData ()),
231+ },
232+ },
233+ },
234+ expectedClusterInfo : ClusterInfo {
235+ ClusterID : "1b5ba46b-7e56-47b1-a326-a9eebddfb38c" ,
236+ ClusterName : "ostest" ,
237+ ReleaseImage : "registry.ci.openshift.org/ocp/release@sha256:65d9b652d0d23084bc45cb66001c22e796d43f5e9e005c2bc2702f94397d596e" ,
238+ Version : "4.15.0" ,
239+ APIDNSName : "api.ostest.test.metalkube.org" ,
240+ Namespace : "cluster0" ,
241+ PullSecret : "c3VwZXJzZWNyZXQK" ,
242+ UserCaBundle : "--- bundle ---" ,
243+ Architecture : "arm64" ,
244+ Proxy : & types.Proxy {
245+ HTTPProxy : "http://proxy" ,
246+ HTTPSProxy : "https://proxy" ,
247+ NoProxy : "localhost" ,
248+ },
249+ ImageDigestSources : []types.ImageDigestSource {
250+ {
251+ Source : "quay.io/openshift-release-dev/ocp-v4.0-art-dev" ,
252+ Mirrors : []string {
253+ "registry.example.com:5000/ocp4/openshift4" ,
254+ },
255+ },
256+ },
257+ PlatformType : v1beta1 .BareMetalPlatformType ,
258+ SSHKey : "my-ssh-key" ,
259+ OSImage : buildStreamData (),
260+ OSImageLocation : "http://my-coreosimage-url/416.94.202402130130-1" ,
261+ },
262+ },
147263 }
148264 for _ , tc := range cases {
149265 t .Run (tc .name , func (t * testing.T ) {
150266 agentWorkflow := & workflow.AgentWorkflow {Workflow : tc .workflow }
151- addNodesConfig := & AddNodesConfig {}
267+ addNodesConfig := & tc . nodesConfig
152268 parents := asset.Parents {}
153269 parents .Add (agentWorkflow )
154270 parents .Add (addNodesConfig )
@@ -200,6 +316,20 @@ func buildStreamData() *stream.Stream {
200316 },
201317 },
202318 },
319+ "aarch64" : {
320+ Artifacts : map [string ]stream.PlatformArtifacts {
321+ "metal" : {
322+ Release : "416.94.202402130130-0" ,
323+ Formats : map [string ]stream.ImageFormat {
324+ "iso" : {
325+ Disk : & stream.Artifact {
326+ Location : "http://my-coreosimage-url/416.94.202402130130-1" ,
327+ },
328+ },
329+ },
330+ },
331+ },
332+ },
203333 },
204334 }
205335}
0 commit comments