-
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
3 changed files
with
83 additions
and
4 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,60 @@ | ||
package e2e | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
nmstatev1alpha1 "github.com/nmstate/kubernetes-nmstate/pkg/apis/nmstate/v1alpha1" | ||
) | ||
|
||
var _ = Describe("Nmstate network configuration", func() { | ||
var ( | ||
vlan101 = nmstatev1alpha1.State(`interfaces: | ||
interfaces: | ||
- name: eth0.101 | ||
type: vlan | ||
state: up | ||
vlan: | ||
base-iface: eth0 | ||
id: 101 | ||
`) | ||
) | ||
Context("when node reboots", func() { | ||
BeforeEach(func() { | ||
By("Apply policy") | ||
setDesiredStateWithPolicy("vlan-eth0.101", vlan101) | ||
|
||
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() | ||
}) | ||
It("should have nmstate connections before kubelet starts", func() { | ||
|
||
By("Check that kubelet is down") | ||
Consistently(func() []error { | ||
_, errs := runAtNodes("pidof", "kubelet") | ||
return errs | ||
}).ShouldNot(ContainElement(Succeed())) | ||
|
||
By("Vlan interface is there") | ||
_, errs := runAtNodes("sudo", "ip", "link", "show", "eth0.101") | ||
Expect(errs).ToNot(ContainElement(HaveOccurred())) | ||
}) | ||
}) | ||
}) |
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