-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that connections persist a reboot
It will create a vlan interface with a policy and reboot the nodes preventing k8s from starting up, the vlan connection has to be there since is NM the one configured and it's persistent. The teardown code puts back the k8s configuration and ensure that k8s is at good shape. Closes #143 Signed-off-by: Quique Llorente <[email protected]>
- Loading branch information
Showing
4 changed files
with
106 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package e2e | ||
|
||
import ( | ||
"strings" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Nmstate network connnections persistency", func() { | ||
Context("after rebooting a node with applied configuration", func() { | ||
var ( | ||
macByNode = map[string]string{} | ||
) | ||
BeforeEach(func() { | ||
By("Apply policy") | ||
setDesiredStateWithPolicy("create-linux-bridge", linuxBrUp(bridge1)) | ||
|
||
for _, node := range nodes { | ||
interfacesNameForNodeEventually(node).Should(ContainElement(bridge1)) | ||
macByNode[node] = macAddress(node, bridge1) | ||
Expect(macByNode[node]).To(Equal(macAddress(node, *firstSecondaryNic))) | ||
} | ||
|
||
By("Move kubernetes configuration to prevent start up") | ||
_, errs := runAtNodes("sudo", "mv", "/etc/kubernetes", "/etc/kubernetes.bak") | ||
Expect(errs).ToNot(ContainElement(HaveOccurred())) | ||
|
||
By("Reboot the nodes") | ||
runAtNodes("sudo", "reboot") | ||
|
||
By("Wait for nodes to come back") | ||
_, errs = runAtNodes("true") | ||
Expect(errs).ToNot(ContainElement(HaveOccurred())) | ||
}) | ||
|
||
AfterEach(func() { | ||
By("Move kubernetes configuration back") | ||
_, errs := runAtNodes("sudo", "mv", "/etc/kubernetes.bak", "/etc/kubernetes") | ||
Expect(errs).ToNot(ContainElement(HaveOccurred())) | ||
|
||
By("Wait for k8s to be ready") | ||
waitForNodesReady() | ||
|
||
setDesiredStateWithPolicy("delete-linux-bridge", linuxBrAbsent(bridge1)) | ||
for _, node := range nodes { | ||
interfacesNameForNodeEventually(node).ShouldNot(ContainElement(bridge1)) | ||
} | ||
deletePolicy("create-linux-bridge") | ||
deletePolicy("delete-linux-bridge") | ||
resetDesiredStateForNodes() | ||
}) | ||
It("should have nmstate connections before kubelet starts", func() { | ||
|
||
By("Check that kubelet is down") | ||
Consistently(func() []error { | ||
_, errs := runAtNodes("/usr/sbin/pidof", "kubelet") | ||
return errs | ||
}).ShouldNot(ContainElement(Succeed())) | ||
|
||
By("Linux bridge interface is there with proper mac") | ||
for _, node := range nodes { | ||
output, err := runAtNode(node, "sudo", "ip", "link", "show", bridge1) | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(strings.ToLower(output)).To(ContainSubstring(macByNode[node])) | ||
} | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters