Skip to content

Commit bc7bf01

Browse files
committed
Fix unit tests
1 parent f32c6c7 commit bc7bf01

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test-unit:
1010
test-e2e:
1111
go test ./test/integration -v -run ^\(TestIsIOHealthy\)$$ ^\(TestPullSecretExists\)$$ -timeout 6m30s
1212
test/integration/resource_samples/apply.sh
13-
go test ./test/integration -v -timeout 25m $(TEST_OPTIONS)
13+
go test ./test/integration -v -timeout 40m $(TEST_OPTIONS)
1414
.PHONY: test-e2e
1515

1616
vet:

pkg/gather/clusterconfig/container_runtime_configs_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ metadata:
2020
name: test-ContainerRC
2121
`
2222
gvr := schema.GroupVersionResource{Group: "machineconfiguration.openshift.io", Version: "v1", Resource: "containerruntimeconfigs"}
23-
client := dynamicfake.NewSimpleDynamicClient(runtime.NewScheme())
23+
client := dynamicfake.NewSimpleDynamicClientWithCustomListKinds(runtime.NewScheme(), map[schema.GroupVersionResource]string{
24+
gvr: "ContainerRuntimeConfigsList",
25+
})
2426
decUnstructured := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme)
2527

2628
testContainerRuntimeConfigs := &unstructured.Unstructured{}

pkg/gather/clusterconfig/install_plans_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestGatherInstallPlans(t *testing.T) {
5252
for _, test := range tests {
5353
t.Run(test.name, func(t *testing.T) {
5454

55-
client := dynamicfake.NewSimpleDynamicClient(runtime.NewScheme())
55+
var client *dynamicfake.FakeDynamicClient
5656
coreClient := kubefake.NewSimpleClientset()
5757
for _, file := range test.testfiles {
5858
f, err := os.Open(file)
@@ -86,6 +86,11 @@ func TestGatherInstallPlans(t *testing.T) {
8686
if err != nil {
8787
t.Fatal("unable to create ns fake ", err)
8888
}
89+
if client == nil {
90+
client = dynamicfake.NewSimpleDynamicClientWithCustomListKinds(runtime.NewScheme(), map[schema.GroupVersionResource]string{
91+
gvr: "InstallPlansList",
92+
})
93+
}
8994
_, err = client.Resource(gvr).Namespace(ns).Create(context.Background(), installplan, metav1.CreateOptions{})
9095
if err != nil {
9196
t.Fatal("unable to create installplan fake ", err)

pkg/gather/clusterconfig/machine_config_pools_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ metadata:
2020
name: master-t
2121
`
2222
gvr := schema.GroupVersionResource{Group: "machineconfiguration.openshift.io", Version: "v1", Resource: "machineconfigpools"}
23-
client := dynamicfake.NewSimpleDynamicClient(runtime.NewScheme())
23+
client := dynamicfake.NewSimpleDynamicClientWithCustomListKinds(runtime.NewScheme(), map[schema.GroupVersionResource]string{
24+
gvr: "MachineConfigPoolsList",
25+
})
2426
decUnstructured := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme)
2527

2628
testMachineConfigPools := &unstructured.Unstructured{}

pkg/gather/clusterconfig/machine_sets_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ metadata:
2020
name: test-worker
2121
`
2222
gvr := schema.GroupVersionResource{Group: "machine.openshift.io", Version: "v1beta1", Resource: "machinesets"}
23-
client := dynamicfake.NewSimpleDynamicClient(runtime.NewScheme())
23+
client := dynamicfake.NewSimpleDynamicClientWithCustomListKinds(runtime.NewScheme(), map[schema.GroupVersionResource]string{
24+
gvr: "MachineSetsList",
25+
})
2426
decUnstructured := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme)
2527

2628
testMachineSet := &unstructured.Unstructured{}

0 commit comments

Comments
 (0)