Skip to content

Commit 55f0b03

Browse files
authored
e2e, handler, ovs: Use secondary interfaces vars. (#1275)
There are some e2e test for the handler that try to discover the secondary interfaces stating "ipv4.enabled==false" this is wrong since those interfaces could part of a primary interface ovs bridge and that will match. This change just use the e2e passed env var that state those interfaces. Signed-off-by: Enrique Llorente <[email protected]>
1 parent 2e791f9 commit 55f0b03

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

test/e2e/handler/simple_ovs_bridge_and_bond_test.go

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
. "github.com/onsi/gomega"
2525

2626
nmstate "github.com/nmstate/kubernetes-nmstate/api/shared"
27+
"github.com/nmstate/kubernetes-nmstate/test/e2e/policy"
2728
)
2829

2930
func ovsBrUpLAGEth1AndEth2(bridgeName, bondName, port1Name, port2Name string) nmstate.State {
@@ -146,20 +147,21 @@ var _ = Describe("OVS Bridge", func() {
146147
Context("with capture", func() {
147148
BeforeEach(func() {
148149
capture := map[string]string{
149-
"ethernet-ifaces": `interfaces.type=="ethernet"`,
150-
"ethernet-not-ignored-ifaces": `capture.ethernet-ifaces | interfaces.state!="ignore"`,
151-
"secondary-ifaces": `capture.ethernet-not-ignored-ifaces | interfaces.ipv4.enabled==false`,
150+
"first-secondary-nic": fmt.Sprintf(`interfaces.name=="%s"`, firstSecondaryNic),
151+
"second-secondary-nic": fmt.Sprintf(`interfaces.name=="%s"`, secondSecondaryNic),
152152
}
153-
updateDesiredStateWithCaptureAndWait(
153+
setDesiredStateWithPolicyAndCapture(bridge1,
154154
ovsBrUpLAGEth1AndEth2(
155155
bridge1,
156156
bond1,
157-
`"{{ capture.secondary-ifaces.interfaces.0.name }}"`,
158-
`"{{ capture.secondary-ifaces.interfaces.1.name }}"`,
157+
`"{{ capture.first-secondary-nic.interfaces.0.name }}"`,
158+
`"{{ capture.second-secondary-nic.interfaces.0.name }}"`,
159159
),
160160
capture,
161161
)
162-
deletePolicy(TestPolicy)
162+
163+
policy.WaitForAvailablePolicy(bridge1)
164+
deletePolicy(bridge1)
163165
})
164166

165167
It("should have the ovs-bridge at currentState", func() {
@@ -255,22 +257,21 @@ var _ = Describe("OVS Bridge", func() {
255257
BeforeEach(func() {
256258
By("Creating policy with desiredState")
257259
capture := map[string]string{
258-
"first-secondary-iface": fmt.Sprintf(`interfaces.name=="%s"`, firstSecondaryNic),
259-
"ethernet-ifaces": `interfaces.type=="ethernet"`,
260-
"ethernet-not-ignored-ifaces": `capture.ethernet-ifaces | interfaces.state!="ignore"`,
261-
"secondary-ifaces": `capture.ethernet-not-ignored-ifaces | interfaces.ipv4.enabled==false`,
260+
"first-secondary-iface": fmt.Sprintf(`interfaces.name=="%s"`, firstSecondaryNic),
261+
"second-secondary-iface": fmt.Sprintf(`interfaces.name=="%s"`, secondSecondaryNic),
262262
}
263263

264264
macAddr = `"{{ capture.first-secondary-iface.interfaces.0.mac-address }}"`
265-
port1 := `"{{ capture.secondary-ifaces.interfaces.0.name }}"`
266-
port2 := `"{{ capture.secondary-ifaces.interfaces.1.name }}"`
265+
port1 := `"{{ capture.first-secondary-iface.interfaces.0.name }}"`
266+
port2 := `"{{ capture.second-secondary-iface.interfaces.0.name }}"`
267267

268-
updateDesiredStateWithCaptureAtNodeAndWait(
269-
designatedNode,
268+
setDesiredStateWithPolicyAndCaptureAndNodeSelectorEventually(bridge1,
270269
ovsBrUpLAGEth1Eth2WithInternalPort(bridge1, ovsPortName, macAddr, port1, port2),
271270
capture,
271+
map[string]string{"kubernetes.io/hostname": designatedNode},
272272
)
273-
deletePolicy(TestPolicy)
273+
policy.WaitForAvailablePolicy(bridge1)
274+
deletePolicy(bridge1)
274275
})
275276

276277
It("should have the ovs-bridge and internal port at currentState", func() {

0 commit comments

Comments
 (0)