forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: remove execute functions from utils
Remove execute functions: ExecuteCommandOnPod, ExecuteCommandOnPodV2, ExecCommandOnPod from utils and use them from exec package. Signed-off-by: Ben Oukhanov <[email protected]>
- Loading branch information
Showing
33 changed files
with
131 additions
and
160 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 |
---|---|---|
|
@@ -31,6 +31,7 @@ import ( | |
. "github.com/onsi/gomega" | ||
"github.com/pborman/uuid" | ||
|
||
"kubevirt.io/kubevirt/tests/exec" | ||
"kubevirt.io/kubevirt/tests/util" | ||
|
||
v1 "kubevirt.io/api/core/v1" | ||
|
@@ -62,7 +63,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
} | ||
if len(path) > 0 { | ||
cmdCheck := []string{"stat", "--printf='%s'", path} | ||
out, err := tests.ExecuteCommandOnPod(virtClient, pod, "compute", cmdCheck) | ||
out, err := exec.ExecuteCommandOnPod(virtClient, pod, "compute", cmdCheck) | ||
Expect(err).NotTo(HaveOccurred()) | ||
size, err := strconv.Atoi(strings.Trim(out, "'")) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
@@ -114,7 +115,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
|
||
By("Checking if ConfigMap has been attached to the pod") | ||
vmiPod := tests.GetRunningPodByVirtualMachineInstance(vmi, util.NamespaceTestDefault) | ||
podOutput, err := tests.ExecuteCommandOnPod( | ||
podOutput, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -208,7 +209,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
|
||
By("Checking if Secret has been attached to the pod") | ||
vmiPod := tests.GetRunningPodByVirtualMachineInstance(vmi, util.NamespaceTestDefault) | ||
podOutput, err := tests.ExecuteCommandOnPod( | ||
podOutput, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -281,7 +282,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
|
||
By("Checking if ServiceAccount has been attached to the pod") | ||
vmiPod := tests.GetRunningPodByVirtualMachineInstance(vmi, util.NamespaceTestDefault) | ||
namespace, err := tests.ExecuteCommandOnPod( | ||
namespace, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -293,7 +294,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
Expect(err).ToNot(HaveOccurred()) | ||
Expect(namespace).To(Equal(util.NamespaceTestDefault)) | ||
|
||
token, err := tests.ExecuteCommandOnPod( | ||
token, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -383,7 +384,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
|
||
By("Checking if ConfigMap has been attached to the pod") | ||
vmiPod := tests.GetRunningPodByVirtualMachineInstance(vmi, util.NamespaceTestDefault) | ||
podOutputCfgMap, err := tests.ExecuteCommandOnPod( | ||
podOutputCfgMap, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -410,7 +411,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
}, 200)).To(Succeed()) | ||
|
||
By("Checking if Secret has also been attached to the same pod") | ||
podOutputSecret, err := tests.ExecuteCommandOnPod( | ||
podOutputSecret, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -490,7 +491,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
|
||
By("Checking if Secret has been attached to the pod") | ||
vmiPod := tests.GetRunningPodByVirtualMachineInstance(vmi, util.NamespaceTestDefault) | ||
podOutput1, err := tests.ExecuteCommandOnPod( | ||
podOutput1, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -501,7 +502,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
Expect(err).ToNot(HaveOccurred()) | ||
Expect(podOutput1).To(Equal(expectedPrivateKey), "Expected pod output of private key to match genereated one.") | ||
|
||
podOutput2, err := tests.ExecuteCommandOnPod( | ||
podOutput2, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
@@ -551,7 +552,7 @@ var _ = Describe("[rfe_id:899][crit:medium][vendor:[email protected]][level:comp | |
|
||
By("Checking if DownwardAPI has been attached to the pod") | ||
vmiPod := tests.GetRunningPodByVirtualMachineInstance(vmi, util.NamespaceTestDefault) | ||
podOutput, err := tests.ExecuteCommandOnPod( | ||
podOutput, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
vmiPod, | ||
vmiPod.Spec.Containers[0].Name, | ||
|
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ import ( | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
|
||
"kubevirt.io/kubevirt/tests/exec" | ||
"kubevirt.io/kubevirt/tests/util" | ||
|
||
v1 "kubevirt.io/api/core/v1" | ||
|
@@ -244,7 +245,7 @@ var _ = Describe("[rfe_id:588][crit:medium][vendor:[email protected]][level:comp | |
|
||
writableImagePath := fmt.Sprintf("/var/run/kubevirt-ephemeral-disks/disk-data/%v/disk.qcow2", vmi.Spec.Domain.Devices.Disks[0].Name) | ||
|
||
writableImageOctalMode, err := tests.ExecuteCommandOnPod( | ||
writableImageOctalMode, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
pod, | ||
"compute", | ||
|
@@ -255,7 +256,7 @@ var _ = Describe("[rfe_id:588][crit:medium][vendor:[email protected]][level:comp | |
By("Checking the writable Image Octal mode") | ||
Expect(strings.Trim(writableImageOctalMode, "\n")).To(Equal("640"), "Octal Mode of writable Image should be 640") | ||
|
||
readonlyImageOctalMode, err := tests.ExecuteCommandOnPod( | ||
readonlyImageOctalMode, err := exec.ExecuteCommandOnPod( | ||
virtClient, | ||
pod, | ||
"compute", | ||
|
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
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ import ( | |
|
||
"kubevirt.io/api/migrations/v1alpha1" | ||
|
||
"kubevirt.io/kubevirt/tests/exec" | ||
"kubevirt.io/kubevirt/tests/framework/cleanup" | ||
|
||
"kubevirt.io/kubevirt/pkg/virt-handler/cgroup" | ||
|
@@ -571,7 +572,7 @@ var _ = Describe("[rfe_id:393][crit:high][vendor:[email protected]][level:system | |
} | ||
|
||
getLibvirtdPid := func(pod *k8sv1.Pod) string { | ||
stdout, stderr, err := tests.ExecuteCommandOnPodV2(virtClient, pod, "compute", | ||
stdout, stderr, err := exec.ExecuteCommandOnPodV2(virtClient, pod, "compute", | ||
[]string{ | ||
"pidof", | ||
"libvirtd", | ||
|
@@ -1104,7 +1105,7 @@ var _ = Describe("[rfe_id:393][crit:high][vendor:[email protected]][level:system | |
|
||
// kill libvirtd | ||
By(fmt.Sprintf("Killing libvirtd with pid %s", pid)) | ||
stdout, stderr, err := tests.ExecuteCommandOnPodV2(virtClient, &pods.Items[0], "compute", | ||
stdout, stderr, err := exec.ExecuteCommandOnPodV2(virtClient, &pods.Items[0], "compute", | ||
[]string{ | ||
"kill", | ||
"-9", | ||
|
@@ -4102,7 +4103,7 @@ var _ = Describe("[rfe_id:393][crit:high][vendor:[email protected]][level:system | |
pod, err := tests.GetRunningPodByLabel(string(vmi.GetUID()), v1.CreatedByLabel, vmi.Namespace, vmi.Status.NodeName) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
stdout, stderr, err := tests.ExecuteCommandOnPodV2(virtClient, | ||
stdout, stderr, err := exec.ExecuteCommandOnPodV2(virtClient, | ||
pod, | ||
"compute", | ||
[]string{"virsh", "vcpupin", fmt.Sprintf("%s_%s", vmi.GetNamespace(), vmi.GetName())}) | ||
|
@@ -4127,7 +4128,7 @@ var _ = Describe("[rfe_id:393][crit:high][vendor:[email protected]][level:system | |
cpusetPath = "/sys/fs/cgroup/cpuset/cpuset.cpus" | ||
} | ||
|
||
stdout, stderr, err := tests.ExecuteCommandOnPodV2(virtClient, | ||
stdout, stderr, err := exec.ExecuteCommandOnPodV2(virtClient, | ||
pod, | ||
"compute", | ||
[]string{"cat", cpusetPath}) | ||
|
@@ -4553,7 +4554,7 @@ func wakeNodeLabellerUp(virtClient kubecli.KubevirtClient) { | |
func libvirtDomainIsPersistent(virtClient kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance) (bool, error) { | ||
vmiPod := tests.GetRunningPodByVirtualMachineInstance(vmi, util.NamespaceTestDefault) | ||
|
||
stdout, stderr, err := tests.ExecuteCommandOnPodV2( | ||
stdout, stderr, err := exec.ExecuteCommandOnPodV2( | ||
virtClient, | ||
vmiPod, | ||
tests.GetComputeContainerOfPod(vmiPod).Name, | ||
|
@@ -4573,7 +4574,7 @@ func getVMIsCgroupVersion(vmi *v1.VirtualMachineInstance, virtClient kubecli.Kub | |
} | ||
|
||
func getPodsCgroupVersion(pod *k8sv1.Pod, virtClient kubecli.KubevirtClient) cgroup.CgroupVersion { | ||
stdout, stderr, err := tests.ExecuteCommandOnPodV2(virtClient, | ||
stdout, stderr, err := exec.ExecuteCommandOnPodV2(virtClient, | ||
pod, | ||
"compute", | ||
[]string{"stat", "/sys/fs/cgroup/", "-f", "-c", "%T"}) | ||
|
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
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
Oops, something went wrong.