Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #381

Merged
merged 10 commits into from
May 19, 2023
2 changes: 1 addition & 1 deletion tests/assets/single.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ write_files:
envFrom:
- configMapRef:
name: default-controller-env
image: rancher/system-upgrade-controller:v0.9.1
image: quay.io/jimmykarily/system-upgrade-controller:v0.9.1
imagePullPolicy: IfNotPresent
name: system-upgrade-controller
volumeMounts:
Expand Down
13 changes: 8 additions & 5 deletions tests/decentralized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,17 @@ var _ = Describe("kairos decentralized k8s test", Label("decentralized-k8s"), fu
vm.Reboot(1200)
out := ""
Eventually(func() string {
vm.Sudo(`curl -X POST http://localhost:8080/api/dns --header "Content-Type: application/json" -d '{ "Regex": "foo.bar", "Records": { "A": "2.2.2.2" } }'`)
out, _ = vm.Sudo("ping -c 1 foo.bar")
var err error
out, err = vm.Sudo(`curl -X POST http://localhost:8080/api/dns --header "Content-Type: application/json" -d '{ "Regex": "foo.bar", "Records": { "A": "2.2.2.2" } }'`)
Expect(err).ToNot(HaveOccurred(), out)

out, _ = vm.Sudo("dig +short foo.bar")
return out
}, 900*time.Second, 10*time.Second).Should(ContainSubstring("2.2.2.2"), out)
}, 900*time.Second, 10*time.Second).Should(Equal("2.2.2.2"), out)
Eventually(func() string {
out, _ = vm.Sudo("ping -c 1 google.com")
out, _ = vm.Sudo("dig +short google.com")
return out
}, 900*time.Second, 10*time.Second).Should(ContainSubstring("64 bytes from"), out)
}, 900*time.Second, 10*time.Second).ShouldNot(BeEmpty(), out)
}
})

Expand Down
3 changes: 2 additions & 1 deletion tests/upgrade_latest_k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ var _ = Describe("k3s upgrade test from k8s", Label("upgrade-latest-with-kuberne
By("wait system-upgrade-controller")
Eventually(func() string {
out, _ := kubectl(vm, "get pods -A")
fmt.Printf("out = %+v\n", out)
return out
}, 900*time.Second, 10*time.Second).Should(ContainSubstring("system-upgrade-controller"))

Expand All @@ -163,7 +164,7 @@ var _ = Describe("k3s upgrade test from k8s", Label("upgrade-latest-with-kuberne

By("checking upgraded version")
Eventually(func() string {
out, _ = kubectl(vm, "get pods -A")
out, _ = kubectl(vm, "describe jobs -A")
version, err := vm.Sudo(getVersionCmd)
if err != nil || !strings.Contains(version, "v") {
// If we met error, keep going with the Eventually
Expand Down