@@ -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
2930func 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