From 14549535f13c63fc239ba055d36d590e68b01503 Mon Sep 17 00:00:00 2001 From: ShylajaDevadiga <56045581+ShylajaDevadiga@users.noreply.github.com> Date: Mon, 6 May 2024 11:18:25 -0700 Subject: [PATCH] Fix e2e tests (#10061) Signed-off-by: ShylajaDevadiga Co-authored-by: ShylajaDevadiga --- tests/e2e/token/token_test.go | 2 +- tests/e2e/upgradecluster/Vagrantfile | 14 ++------------ tests/e2e/vagrantdefaults.rb | 4 +++- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/tests/e2e/token/token_test.go b/tests/e2e/token/token_test.go index af07814dcbad..2790714b6f0d 100644 --- a/tests/e2e/token/token_test.go +++ b/tests/e2e/token/token_test.go @@ -155,7 +155,7 @@ var _ = Describe("Use the token CLI to create and join agents", Ordered, func() serverToken := "1234" It("Creates a new server token", func() { Expect(e2e.RunCmdOnNode("k3s token rotate -t vagrant --new-token="+serverToken, serverNodeNames[0])). - To(ContainSubstring("Token rotated, restart k3s with new token")) + To(ContainSubstring("Token rotated, restart k3s nodes with new token")) }) It("Restarts servers with the new token", func() { cmd := fmt.Sprintf("sed -i 's/token:.*/token: %s/' /etc/rancher/k3s/config.yaml", serverToken) diff --git a/tests/e2e/upgradecluster/Vagrantfile b/tests/e2e/upgradecluster/Vagrantfile index b5e76c79e3f7..704133a4dcd4 100644 --- a/tests/e2e/upgradecluster/Vagrantfile +++ b/tests/e2e/upgradecluster/Vagrantfile @@ -10,6 +10,7 @@ REGISTRY = (ENV['E2E_REGISTRY'] || "") GOCOVER = (ENV['E2E_GOCOVER'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i NODE_MEMORY = (ENV['E2E_NODE_MEMORY'] || 2048).to_i +GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") # Virtualbox >= 6.1.28 require `/etc/vbox/network.conf` for expanded private networks NETWORK_PREFIX = "10.10.11" install_type = "" @@ -26,19 +27,8 @@ def provision(vm, role, role_num, node_num) load vagrant_defaults defaultOSConfigure(vm) - - if RELEASE_VERSION == "skip" - install_type = "INSTALL_K3S_SKIP_DOWNLOAD=true" - elsif !RELEASE_VERSION.empty? - install_type = "INSTALL_K3S_VERSION=#{RELEASE_VERSION}" - elsif RELEASE_CHANNEL == "commit" - vm.provision "shell", path: "../scripts/latest_commit.sh", args: ["master", "/tmp/k3s_commits"] - install_type = "INSTALL_K3S_COMMIT=$(head\ -n\ 1\ /tmp/k3s_commits)" - else - install_type = "INSTALL_K3S_CHANNEL=#{RELEASE_CHANNEL}" - end - + install_type = getInstallType(vm, RELEASE_VERSION, GITHUB_BRANCH, RELEASE_CHANNEL) vm.provision "shell", inline: "ping -c 2 k3s.io" db_type = getDBType(role, role_num, vm) diff --git a/tests/e2e/vagrantdefaults.rb b/tests/e2e/vagrantdefaults.rb index b962a0744d44..0f07b99e6c92 100644 --- a/tests/e2e/vagrantdefaults.rb +++ b/tests/e2e/vagrantdefaults.rb @@ -16,11 +16,13 @@ def defaultOSConfigure(vm) end end -def getInstallType(vm, release_version, branch) +def getInstallType(vm, release_version, branch, release_channel='') if release_version == "skip" install_type = "INSTALL_K3S_SKIP_DOWNLOAD=true" elsif !release_version.empty? return "INSTALL_K3S_VERSION=#{release_version}" + elsif release_channel != "commit" + return "INSTALL_K3S_CHANNEL=#{release_channel}" else jqInstall(vm) scripts_location = Dir.exists?("./scripts") ? "./scripts" : "../scripts"