Skip to content

Commit 907b6cd

Browse files
qinqonmetal-net-bot
authored andcommitted
Modernize golang dependencies like controller-runtime and k8s (nmstate#1288)
* deps: Bump versions * deps: Call make generate and make bundle * deps: Adapt code
1 parent f45047d commit 907b6cd

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

test/e2e/handler/main_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,16 @@ var _ = BeforeSuite(func() {
9494
}
9595

9696
resetDesiredStateForAllNodes()
97-
expectedInitialState := interfacesState(resetPrimaryAndSecondaryNICs(), interfacesToIgnore)
9897
for _, node := range allNodes {
99-
Eventually(func(g Gomega) {
98+
Eventually(func() map[string]string {
10099
By("Wait for network configuration to show up at NNS to retrieve it")
101100
nodeState := nodeInterfacesState(node, interfacesToIgnore)
102-
for name, state := range expectedInitialState {
103-
g.Expect(nodeState).To(HaveKeyWithValue(name, state))
104-
}
105-
}, 20*time.Second, time.Second).Should(Succeed())
101+
return nodeState
102+
}, 20*time.Second, time.Second).Should(SatisfyAll(
103+
HaveKeyWithValue(primaryNic, "up"),
104+
HaveKeyWithValue(firstSecondaryNic, "up"),
105+
HaveKeyWithValue(secondSecondaryNic, "up")),
106+
)
106107
}
107108
knmstateReporter = knmstatereporter.New("test_logs/e2e/handler", testenv.OperatorNamespace, nodes)
108109
knmstateReporter.Cleanup()

test/e2e/handler/utils.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,11 @@ func nodeInterfacesState(node string, exclude []string) map[string]string {
566566
// return a json with all node interfaces and their state e.g.
567567
// {"cni0":"up","docker0":"up","eth0":"up","eth1":"down","eth2":"down","lo":"down"}
568568
// use exclude to filter out interfaces you don't care about
569-
func interfacesState(state nmstate.State, exclude []string) map[string]string {
570-
interfaces := interfaces(state)
569+
func nodeInterfacesState(node string, exclude []string) map[string]string {
570+
var currentStateYaml nmstate.State
571+
currentState(node, &currentStateYaml).ShouldNot(BeEmpty())
572+
573+
interfaces := interfaces(currentStateYaml)
571574
ifacesState := make(map[string]string)
572575
for _, iface := range interfaces {
573576
name := interfaceName(iface)

0 commit comments

Comments
 (0)