Skip to content

Commit 656c060

Browse files
committed
Add more functional tests for baremetalset controller
Signed-off-by: rabi <[email protected]>
1 parent 1866ef9 commit 656c060

File tree

4 files changed

+708
-14
lines changed

4 files changed

+708
-14
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ vet: gowork ## Run go vet against code.
130130
go vet ./...
131131
go vet ./... ./api/...
132132

133+
MAX_PROCS := 5
134+
NUM_PROCS := $(shell expr $(shell nproc --ignore 2) / 2)
135+
PROCS ?= $(shell if [ $(NUM_PROCS) -gt $(MAX_PROCS) ]; then echo $(MAX_PROCS); else echo $(NUM_PROCS); fi)
136+
PROC_CMD = --procs $(PROCS)
137+
133138
.PHONY: test
134139
test: manifests generate fmt vet envtest ginkgo ## Run tests.
135140
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" $(GINKGO) --trace --cover --coverpkg=../../pkg/...,../../controllers,../../api/v1beta1 --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./tests/...

tests/functional/base_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func DefaultBaremetalSetSpec(name types.NamespacedName, withProvInterface bool)
5353
spec := map[string]any{
5454
"baremetalHosts": map[string]any{
5555
"compute-0": map[string]any{
56-
"ctlPlaneIP": "10.0.0.1",
56+
"ctlPlaneIP": "10.0.0.1/24",
5757
},
5858
},
5959
"bmhLabelSelector": map[string]string{"app": "openstack"},
@@ -78,10 +78,10 @@ func TwoNodeBaremetalSetSpec(namespace string) map[string]any {
7878
spec := map[string]any{
7979
"baremetalHosts": map[string]any{
8080
"compute-0": map[string]any{
81-
"ctlPlaneIP": "10.0.0.1",
81+
"ctlPlaneIP": "10.0.0.1/24",
8282
},
8383
"compute-1": map[string]any{
84-
"ctlPlaneIP": "10.0.0.1",
84+
"ctlPlaneIP": "10.0.0.2/24",
8585
},
8686
},
8787
"bmhLabelSelector": map[string]string{"app": "openstack"},
@@ -96,11 +96,11 @@ func TwoNodeBaremetalSetSpecWithNodeLabel(namespace string) map[string]any {
9696
spec := map[string]any{
9797
"baremetalHosts": map[string]any{
9898
"compute-0": map[string]any{
99-
"ctlPlaneIP": "10.0.0.1",
99+
"ctlPlaneIP": "10.0.0.1/24",
100100
"bmhLabelSelector": map[string]string{"nodeName": "compute-0"},
101101
},
102102
"compute-1": map[string]any{
103-
"ctlPlaneIP": "10.0.0.1",
103+
"ctlPlaneIP": "10.0.0.2/24",
104104
"bmhLabelSelector": map[string]string{"nodeName": "compute-1"},
105105
},
106106
},
@@ -116,11 +116,11 @@ func TwoNodeBaremetalSetSpecWithWrongNodeLabel(namespace string) map[string]any
116116
spec := map[string]any{
117117
"baremetalHosts": map[string]any{
118118
"compute-0": map[string]any{
119-
"ctlPlaneIP": "10.0.0.1",
119+
"ctlPlaneIP": "10.0.0.1/24",
120120
"bmhLabelSelector": map[string]string{"nodeName": "compute-0"},
121121
},
122122
"compute-1": map[string]any{
123-
"ctlPlaneIP": "10.0.0.1",
123+
"ctlPlaneIP": "10.0.0.2/24",
124124
"bmhLabelSelector": map[string]string{"nodeName": "compute-2"},
125125
},
126126
},
@@ -136,15 +136,15 @@ func MultiNodeBaremetalSetSpecWithSameNodeLabel(namespace string) map[string]any
136136
spec := map[string]any{
137137
"baremetalHosts": map[string]any{
138138
"compute-0": map[string]any{
139-
"ctlPlaneIP": "10.0.0.1",
139+
"ctlPlaneIP": "10.0.0.1/24",
140140
"bmhLabelSelector": map[string]string{"nodeType": "compute"},
141141
},
142142
"compute-1": map[string]any{
143-
"ctlPlaneIP": "10.0.0.2",
143+
"ctlPlaneIP": "10.0.0.2/24",
144144
"bmhLabelSelector": map[string]string{"nodeType": "compute"},
145145
},
146146
"compute-2": map[string]any{
147-
"ctlPlaneIP": "10.0.0.3",
147+
"ctlPlaneIP": "10.0.0.3/24",
148148
"bmhLabelSelector": map[string]string{"nodeType": "compute"},
149149
},
150150
},
@@ -160,15 +160,15 @@ func MultiNodeBaremetalSetSpecWithOverlappingNodeLabels(namespace string) map[st
160160
spec := map[string]any{
161161
"baremetalHosts": map[string]any{
162162
"compute-0": map[string]any{
163-
"ctlPlaneIP": "10.0.0.1",
163+
"ctlPlaneIP": "10.0.0.1/24",
164164
"bmhLabelSelector": map[string]string{"nodeType": "compute", "dummyLabel": "dummy"},
165165
},
166166
"compute-1": map[string]any{
167-
"ctlPlaneIP": "10.0.0.2",
167+
"ctlPlaneIP": "10.0.0.2/24",
168168
"bmhLabelSelector": map[string]string{"nodeType": "compute", "nodeName": "compute-1"},
169169
},
170170
"compute-2": map[string]any{
171-
"ctlPlaneIP": "10.0.0.3",
171+
"ctlPlaneIP": "10.0.0.3/24",
172172
"bmhLabelSelector": map[string]string{"nodeType": "compute", "dummyLabel": "dummy"},
173173
},
174174
},

0 commit comments

Comments
 (0)