github.com/nmstate/kubernetes-nmstate@v0.82.0/test/e2e/handler/simple_ovs_bridge_test.go (about) 1 /* 2 Copyright The Kubernetes NMState Authors. 3 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 */ 17 18 package handler 19 20 import ( 21 . "github.com/onsi/ginkgo/v2" 22 . "github.com/onsi/gomega" 23 ) 24 25 var _ = Describe("Simple OVS bridge", func() { 26 Context("when desiredState is configured with an ovs bridge up", func() { 27 BeforeEach(func() { 28 updateDesiredStateAndWait(ovsBrUp(bridge1)) 29 }) 30 AfterEach(func() { 31 updateDesiredStateAndWait(ovsBrAbsent(bridge1)) 32 for _, node := range nodes { 33 interfacesNameForNodeEventually(node).ShouldNot(ContainElement(bridge1)) 34 } 35 resetDesiredStateForNodes() 36 }) 37 It("should have the ovs bridge at currentState", func() { 38 for _, node := range nodes { 39 interfacesForNode(node).Should(ContainElement(SatisfyAll( 40 HaveKeyWithValue("name", bridge1), 41 HaveKeyWithValue("type", "ovs-bridge"), 42 HaveKeyWithValue("state", "up"), 43 ))) 44 } 45 }) 46 }) 47 Context("when desiredState is configured with an ovs bridge with internal port up", func() { 48 BeforeEach(func() { 49 updateDesiredStateAndWait(ovsbBrWithInternalInterface(bridge1)) 50 }) 51 AfterEach(func() { 52 updateDesiredStateAndWait(ovsBrAbsent(bridge1)) 53 for _, node := range nodes { 54 interfacesNameForNodeEventually(node).ShouldNot(ContainElement(bridge1)) 55 } 56 resetDesiredStateForNodes() 57 }) 58 It("should have the ovs bridge at currentState", func() { 59 for _, node := range nodes { 60 interfacesForNode(node).Should(SatisfyAll( 61 ContainElement(SatisfyAll( 62 HaveKeyWithValue("name", bridge1), 63 HaveKeyWithValue("type", "ovs-bridge"), 64 HaveKeyWithValue("state", "up"), 65 )), 66 ContainElement(SatisfyAll( 67 HaveKeyWithValue("name", "ovs0"), 68 HaveKeyWithValue("type", "ovs-interface"), 69 HaveKeyWithValue("state", "up"), 70 )), 71 )) 72 } 73 }) 74 }) 75 })