Skip to content

Commit e8a96d4

Browse files
committed
Fix marvin test for adding and removing external nodes
1 parent 90eb42a commit e8a96d4

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,8 @@ protected void copyScriptFile(String nodeAddress, final int sshPort, File file,
720720
}
721721
SshHelper.scpTo(nodeAddress, sshPort, getControlNodeLoginUser(), sshKeyFile, null,
722722
"~/", file.getAbsolutePath(), "0755", 20000, 30 * 60 * 1000);
723-
String cmdStr = String.format("sudo mv ~/%s %s/%s", file.getName(), scriptPath, destination);
723+
// Ensure destination dir scriptPath exists and copy file to destination
724+
String cmdStr = String.format("sudo mkdir -p %s ; sudo mv ~/%s %s/%s", scriptPath, file.getName(), scriptPath, destination);
724725
SshHelper.sshExecute(nodeAddress, sshPort, getControlNodeLoginUser(), sshKeyFile, null,
725726
cmdStr, 10000, 10000, 10 * 60 * 1000);
726727
} catch (Exception e) {

test/integration/smoke/test_kubernetes_clusters.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"displaytext": "cks-u2204-kvm-" + RAND_SUFFIX,
8686
"format": "qcow2",
8787
"hypervisor": "kvm",
88-
"ostypeid": "5d83ac5d-d03c-4743-9629-7d70b5928f7f",
88+
"ostype": "Ubuntu 22.04 LTS",
8989
"url": "https://download.cloudstack.org/testing/custom_templates/ubuntu/22.04/cks-ubuntu-2204-kvm.qcow2.bz2",
9090
"requireshvm": "True",
9191
"ispublic": "True",
@@ -97,7 +97,7 @@
9797
"displaytext": "cks-u2204-hyperv-" + RAND_SUFFIX,
9898
"format": "vhd",
9999
"hypervisor": "xenserver",
100-
"ostypeid": "5d83ac5d-d03c-4743-9629-7d70b5928f7f",
100+
"ostype": "Ubuntu 22.04 LTS",
101101
"url": "https://download.cloudstack.org/testing/custom_templates/ubuntu/22.04/cks-ubuntu-2204-hyperv.vhd.zip",
102102
"requireshvm": "True",
103103
"ispublic": "True",
@@ -109,7 +109,7 @@
109109
"displaytext": "cks-u2204-hyperv-" + RAND_SUFFIX,
110110
"format": "vhd",
111111
"hypervisor": "hyperv",
112-
"ostypeid": "5d83ac5d-d03c-4743-9629-7d70b5928f7f",
112+
"ostype": "Ubuntu 22.04 LTS",
113113
"url": "https://download.cloudstack.org/testing/custom_templates/ubuntu/22.04/cks-ubuntu-2204-hyperv.vhd.zip",
114114
"requireshvm": "True",
115115
"ispublic": "True",
@@ -121,7 +121,7 @@
121121
"displaytext": "cks-u2204-vmware-" + RAND_SUFFIX,
122122
"format": "ova",
123123
"hypervisor": "vmware",
124-
"ostypeid": "5d83ac5d-d03c-4743-9629-7d70b5928f7f",
124+
"ostype": "Ubuntu 22.04 LTS",
125125
"url": "https://download.cloudstack.org/testing/custom_templates/ubuntu/22.04/cks-ubuntu-2204-vmware.ova",
126126
"requireshvm": "True",
127127
"ispublic": "True",
@@ -777,12 +777,13 @@ def test_12_test_deploy_cluster_different_offerings_per_node_type(self):
777777
@attr(tags=["advanced", "smoke"], required_hardware="true")
778778
@skipTestIf("hypervisorIsNotVmware")
779779
def test_13_test_add_external_nodes_to_cluster(self):
780-
"""Test creating a CKS cluster with different offerings per node type
780+
"""Test adding and removing external nodes to CKS clusters
781781
782782
# Validate the following:
783783
# - Deploy Kubernetes Cluster
784784
# - Deploy VM on the same network as the Kubernetes cluster with the worker nodes offering and CKS ready template
785785
# - Add external node to the Kubernetes Cluster
786+
# - Remove external node from the Kubernetes Cluster
786787
"""
787788
if self.setup_failed == True:
788789
self.fail("Setup incomplete")
@@ -795,12 +796,14 @@ def test_13_test_add_external_nodes_to_cluster(self):
795796
)
796797
self.services["virtual_machine"]["template"] = self.nodes_template.id
797798
external_node = VirtualMachine.create(self.apiclient,
798-
self.services["virtual_machine"],
799-
zoneid=self.zone.id,
800-
accountid=self.account.name,
801-
domainid=self.account.domainid,
802-
serviceofferingid=self.cks_worker_nodes_offering.id,
803-
networkids=cluster.networkid)
799+
self.services["virtual_machine"],
800+
zoneid=self.zone.id,
801+
accountid=self.account.name,
802+
domainid=self.account.domainid,
803+
rootdiskcontroller="osdefault",
804+
rootdisksize=8,
805+
serviceofferingid=self.cks_worker_nodes_offering.id,
806+
networkids=cluster.networkid)
804807

805808
# Acquire public IP and create Port Forwarding Rule and Firewall rule for SSH access
806809
free_ip_addresses = PublicIPAddress.list(
@@ -849,22 +852,25 @@ def test_13_test_add_external_nodes_to_cluster(self):
849852
delay=10
850853
)
851854
node_ssh_client.execute("echo '" + self.mgmtSshKey + "' > ~/.ssh/authorized_keys")
855+
# Remove acquired public IP address and rules
856+
nat_rule.delete(self.apiclient)
857+
fw_rule.delete(self.apiclient)
858+
external_node_ipaddress.delete(self.apiclient)
852859

853860
self.addExternalNodesToKubernetesCluster(cluster.id, [external_node.id])
861+
cluster = self.listKubernetesCluster(cluster.id)
854862
self.assertEqual(
855863
cluster.size,
856864
2,
857865
"Expected 2 worker nodes but got {}".format(cluster.size)
858866
)
859867
self.removeExternalNodesFromKubernetesCluster(cluster.id, [external_node.id])
868+
cluster = self.listKubernetesCluster(cluster.id)
860869
self.assertEqual(
861870
cluster.size,
862871
1,
863872
"Expected 1 worker node but got {}".format(cluster.size)
864873
)
865-
nat_rule.delete(self.apiclient)
866-
fw_rule.delete(self.apiclient)
867-
external_node_ipaddress.delete(self.apiclient)
868874
VirtualMachine.delete(external_node, self.apiclient, expunge=True)
869875
self.debug("Deleting Kubernetes cluster with ID: %s" % cluster.id)
870876
self.deleteKubernetesClusterAndVerify(cluster.id)

0 commit comments

Comments
 (0)