Skip to content

Commit

Permalink
E2E: Add support for CentOS 7 and Rocky 8 (k3s-io#6015)
Browse files Browse the repository at this point in the history
* Add e2e support for centos7 and rocky8

Signed-off-by: Derek Nola <derek.nola@suse.com>
Signed-off-by: Nikolai Shields <nikolai@nikolaishields.com>
  • Loading branch information
dereknola authored and nikolaishields committed Sep 14, 2022
1 parent 8579ace commit 6aac901
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
8 changes: 5 additions & 3 deletions tests/e2e/upgradecluster/upgradecluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
. "github.com/onsi/gomega"
)

// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64, dweomer/microos.amd64
// Valid nodeOS:
// generic/ubuntu2004, generic/centos7, generic/rocky8
// opensuse/Leap-15.3.x86_64, dweomer/microos.amd64
var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system")
var serverCount = flag.Int("serverCount", 3, "number of server nodes")
var agentCount = flag.Int("agentCount", 2, "number of agent nodes")
Expand Down Expand Up @@ -156,9 +158,9 @@ var _ = Describe("Verify Upgrade", func() {
Expect(err).NotTo(HaveOccurred(), "Daemonset manifest not deployed")

nodes, _ := e2e.ParseNodes(kubeConfigFile, false) //nodes :=
pods, _ := e2e.ParsePods(kubeConfigFile, false)

Eventually(func(g Gomega) {
pods, _ := e2e.ParsePods(kubeConfigFile, false)
count := e2e.CountOfStringInSlice("test-daemonset", pods)
fmt.Println("POD COUNT")
fmt.Println(count)
Expand Down Expand Up @@ -344,9 +346,9 @@ var _ = Describe("Verify Upgrade", func() {

It("After upgrade verifies Daemonset", func() {
nodes, _ := e2e.ParseNodes(kubeConfigFile, false) //nodes :=
pods, _ := e2e.ParsePods(kubeConfigFile, false)

Eventually(func(g Gomega) {
pods, _ := e2e.ParsePods(kubeConfigFile, false)
count := e2e.CountOfStringInSlice("test-daemonset", pods)
fmt.Println("POD COUNT")
fmt.Println(count)
Expand Down
6 changes: 6 additions & 0 deletions tests/e2e/vagrantdefaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ def defaultOSConfigure(vm)
vm.provision "Install jq", type: "shell", inline: "apt install -y jq"
elsif box.include?("Leap") || box.include?("Tumbleweed")
vm.provision "Install jq", type: "shell", inline: "zypper install -y jq"
elsif box.include?("rocky8") || box.include?("rocky9")
vm.provision "Install jq", type: "shell", inline: "dnf install -y jq"
vm.provision "Disable firewall", type: "shell", inline: "systemctl stop firewalld"
elsif box.include?("centos7")
vm.provision "Install jq", type: "shell", inline: "yum install -y jq"
vm.provision "Disable firewall", type: "shell", inline: "systemctl stop firewalld"
elsif box.include?("alpine")
vm.provision "Install tools", type: "shell", inline: "apk add jq coreutils"
elsif box.include?("microos")
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/validatecluster/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def getDBType(role, role_num, vm)
return "cluster-init: true"
end
elsif ( EXTERNAL_DB == "none" )
# Use internal sqlite
# Use internal sqlite, only valid for single node clusters
else
puts "Unknown EXTERNAL_DB: " + EXTERNAL_DB
abort
Expand Down
10 changes: 6 additions & 4 deletions tests/e2e/validatecluster/validatecluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ import (
. "github.com/onsi/gomega"
)

// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64, dweomer/microos.amd64
// Valid nodeOS:
// generic/ubuntu2004, generic/centos7, generic/rocky8,
// opensuse/Leap-15.3.x86_64, dweomer/microos.amd64
var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system")
var serverCount = flag.Int("serverCount", 3, "number of server nodes")
var agentCount = flag.Int("agentCount", 2, "number of agent nodes")
var hardened = flag.Bool("hardened", false, "true or false")

// Environment Variables Info:
// E2E_EXTERNAL_DB: mysql or postgres, nil for embedded etcd
// E2E_RELEASE_VERSION=v1.23.1+k3s2 or nil for latest commit from master
// E2E_EXTERNAL_DB: mysql, postgres, etcd (default: etcd)
// E2E_RELEASE_VERSION=v1.23.1+k3s2 (default: latest commit from master)

func Test_E2EClusterValidation(t *testing.T) {
RegisterFailHandler(Fail)
Expand Down Expand Up @@ -173,9 +175,9 @@ var _ = Describe("Verify Create", func() {
Expect(err).NotTo(HaveOccurred(), "Daemonset manifest not deployed")

nodes, _ := e2e.ParseNodes(kubeConfigFile, false)
pods, _ := e2e.ParsePods(kubeConfigFile, false)

Eventually(func(g Gomega) {
pods, _ := e2e.ParsePods(kubeConfigFile, false)
count := e2e.CountOfStringInSlice("test-daemonset", pods)
fmt.Println("POD COUNT")
fmt.Println(count)
Expand Down

0 comments on commit 6aac901

Please sign in to comment.