Skip to content

Commit cc99514

Browse files
committed
unit tests: fix breakage caused by client-go & apimachinery bump
Changes in the apimachinery and client-go packages broke our unit tests after upgrade. client-go stopped serializing the empty preferences: {} field for the kubeconfig. apimachinery, with kubernetes/apimachinery@c58e197 caused much more extensive breakage by changing the format with which errors are returned, and our unit tests hard code the expected error messages. For the most part, I used claude to fix these issues, and here is the summary it created: Changes Made Root Cause: The k8s apimachinery package (errors.go:93-96) now uses json.Marshal() to format BadValue in error messages instead of Go's native format. Error Format Changes: Arrays: []string{"a", "b"} → ["a","b"] (JSON format, no spaces) Nil values: []string(nil) → null Structs: aws.Subnet{ID:"x", Roles:...} → {"id":"x"} (JSON with lowercase keys) Custom types: gcp.OSImage{Name:"x", Project:"y"} → {"name":"x","project":"y"}
1 parent 921fc63 commit cc99514

36 files changed

+54
-91
lines changed

cmd/node-joiner/testdata/add-nodes-overrides.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ status:
3131
apiVersion: agent-install.openshift.io/v1beta1
3232
kind: InfraEnv
3333
metadata:
34-
creationTimestamp: null
3534
name: ostest
3635
namespace: cluster0
3736
spec:

cmd/openshift-install/testdata/agent/configimage/manifests/default_manifests.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ rendezvousIP: 192.168.111.20
4747
apiVersion: extensions.hive.openshift.io/v1beta1
4848
kind: AgentClusterInstall
4949
metadata:
50-
creationTimestamp: null
5150
name: ostest
5251
namespace: cluster0
5352
spec:
@@ -79,7 +78,6 @@ status:
7978
apiVersion: hive.openshift.io/v1
8079
kind: ClusterDeployment
8180
metadata:
82-
creationTimestamp: null
8381
name: ostest
8482
namespace: cluster0
8583
spec:
@@ -101,7 +99,6 @@ status: {}
10199
apiVersion: hive.openshift.io/v1
102100
kind: ClusterImageSet
103101
metadata:
104-
creationTimestamp: null
105102
name: openshift-was not built correctly
106103
namespace: cluster0
107104
spec:

cmd/openshift-install/testdata/agent/image/assets/with_additional_ntp_sources.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ logdir /var/log/chrony
5353
apiVersion: agent-install.openshift.io/v1beta1
5454
kind: InfraEnv
5555
metadata:
56-
creationTimestamp: null
5756
name: ostest
5857
namespace: cluster0
5958
spec:

cmd/openshift-install/testdata/agent/image/configurations/baremetal_host_bmc_config.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ kind: AgentClusterInstall
134134
metadata:
135135
annotations:
136136
agent-install.openshift.io/install-config-overrides: '{"platform":{"baremetal":{"hosts":[{"name":"master-0","bmc":{"username":"foo","password":"pwd1","address":"http://172.22.0.10:8000/redfish/v1/Systems/d3fe1eb9-f04c-465d-b5d6-d267f0a0059b","disableCertificateVerification":false},"role":"","bootMACAddress":"00:00:00:aa:bb:01","hardwareProfile":""},{"name":"master-1","bmc":{"username":"foo","password":"pwd2","address":"http://172.22.0.11:8000/redfish/v1/Systems/65bf6806-b634-4494-bccf-032ebdecc65d","disableCertificateVerification":false},"role":"","bootMACAddress":"00:00:00:aa:bb:02","hardwareProfile":""},{"name":"master-2","bmc":{"username":"foo","password":"pwd3","address":"http://172.22.0.12:8000/redfish/v1/Systems/ff67e706-28c4-42f6-b9a2-ce714195300a","disableCertificateVerification":false},"role":"","bootMACAddress":"00:00:00:aa:bb:03","hardwareProfile":""}],"clusterProvisioningIP":"172.22.0.3","provisioningNetwork":"Managed","provisioningNetworkInterface":"enp1s0","provisioningNetworkCIDR":"172.22.0.0/24","provisioningDHCPRange":"172.22.0.10,172.22.0.254"}}}'
137-
creationTimestamp: null
138137
name: ostest
139138
namespace: cluster0
140139
spec:

cmd/openshift-install/testdata/agent/image/configurations/control-plane-4-replicas.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,19
6060
apiVersion: extensions.hive.openshift.io/v1beta1
6161
kind: AgentClusterInstall
6262
metadata:
63-
creationTimestamp: null
6463
name: ostest
6564
namespace: cluster0
6665
spec:

cmd/openshift-install/testdata/agent/image/configurations/control-plane-5-replicas.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ DefaultEnvironment=NO_PROXY="172.22.0.0/24,virthost.ostest.test.metalkube.org,19
6060
apiVersion: extensions.hive.openshift.io/v1beta1
6161
kind: AgentClusterInstall
6262
metadata:
63-
creationTimestamp: null
6463
name: ostest
6564
namespace: cluster0
6665
spec:

cmd/openshift-install/testdata/agent/image/configurations/external_compact.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ kind: AgentClusterInstall
4949
metadata:
5050
annotations:
5151
agent-install.openshift.io/install-config-overrides: '{"platform":{"external":{"platformName":"some-cloud-provider"}}}'
52-
creationTimestamp: null
5352
name: ostest
5453
namespace: cluster0
5554
spec:

cmd/openshift-install/testdata/agent/image/configurations/external_with_bootArtifactsBaseURL_minimal_iso.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ kind: AgentClusterInstall
5454
metadata:
5555
annotations:
5656
agent-install.openshift.io/install-config-overrides: '{"platform":{"external":{"platformName":"oci","cloudControllerManager":"External"}}}'
57-
creationTimestamp: null
5857
name: ostest
5958
namespace: cluster0
6059
spec:

cmd/openshift-install/testdata/agent/image/configurations/external_without_bootArtifactsBaseURL_minimal_iso.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ kind: AgentClusterInstall
5252
metadata:
5353
annotations:
5454
agent-install.openshift.io/install-config-overrides: '{"platform":{"external":{"platformName":"oci","cloudControllerManager":"External"}}}'
55-
creationTimestamp: null
5655
name: ostest
5756
namespace: cluster0
5857
spec:

cmd/openshift-install/testdata/agent/image/configurations/nutanix_compact.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ kind: AgentClusterInstall
6363
metadata:
6464
annotations:
6565
agent-install.openshift.io/install-config-overrides: '{"platform":{"nutanix":{"prismCentral":{"endpoint":{"address":"pc1.test.metalkube.org","port":9440},"username":"testUser","password":"testPassword"},"prismElements":[{"uuid":"00061f7f-44f7-19dc-72gc-7cc25586ee53","endpoint":{"address":"pe1.test.metalkube.org","port":9440}}],"apiVIPs":["192.168.111.5"],"ingressVIPs":["192.168.111.4"],"subnetUUIDs":["a2e46975-2cde-4a49-9dda-815eb4fcd681"]}}}'
66-
creationTimestamp: null
6766
name: ostest
6867
spec:
6968
apiVIPs:

0 commit comments

Comments
 (0)