Skip to content
Permalink
Browse files

Support Debian image in e2e tests

  • Loading branch information...
ivan4th committed Feb 28, 2019
1 parent 7931d8c commit 48b353c159f68588b04789d5ec8420c67ba9dc0f
@@ -227,7 +227,9 @@ func itShouldHaveNetworkConnectivity(podIface func() *framework.PodInterface, ss

It("Should be able to access another k8s endpoint"+suffix, func(done Done) {
defer close(done)
cmd := fmt.Sprintf("curl -s --connect-timeout 5 http://nginx.%s.svc.cluster.local", controller.Namespace())
// wget is present in CirrOS, Ubuntu and Debian images that we use, unlike curl,
// so we use it here
cmd := fmt.Sprintf("wget -O - -T 5 http://nginx.%s.svc.cluster.local", controller.Namespace())
Eventually(func() (string, error) {
return framework.RunSimple(ssh(), cmd)
}, 60).Should(ContainSubstring("Thank you for using nginx."))
@@ -38,7 +38,11 @@ import (
const (
cephContainerName = "ceph_cluster"
// avoid having the loop device on top of overlay2/aufs when using k-d-c
loopDeviceTestDir = "/dind/virtlet-e2e-tests"
loopDeviceTestDir = "/dind/virtlet-e2e-test-dir"
// The path to mkfs.ext2 may differ between the OSes. Also, on
// CirrOS, mkfs.ext2 is not under the default PATH when we do
// 'ssh sudo ...'
mkfsCommand = `export PATH="/usr/sbin:/sbin:$PATH"; sudo mkfs.ext2 %q`
)

var (
@@ -356,7 +360,7 @@ func makeVMWithMountAndSymlinkScript(nodeName string, PVCs []framework.PVCSpec,

func expectToBeUsableForFilesystem(ssh framework.Executor, devPath string) {
Eventually(func() error {
_, err := framework.RunSimple(ssh, fmt.Sprintf("sudo /usr/sbin/mkfs.ext2 %s", devPath))
_, err := framework.RunSimple(ssh, fmt.Sprintf(mkfsCommand, devPath))
return err
}, 60*5, 3).Should(Succeed())
do(framework.RunSimple(ssh, fmt.Sprintf("sudo mount %s /mnt", devPath)))
@@ -18,6 +18,7 @@ package framework

import (
"encoding/xml"
"flag"
"fmt"
"regexp"
"strconv"
@@ -29,6 +30,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var useDHCPNetworkConfig = flag.Bool("use-dhcp-network-config", false, "use DHCP network config instead of Cloud-Init-based one")

// VMInterface provides API to work with virtlet VM pods
type VMInterface struct {
controller *Controller
@@ -190,6 +193,10 @@ func (vmi *VMInterface) buildVMPod(options VMOptions) *v1.Pod {
"VirtletDiskDriver": options.DiskDriver,
"VirtletCloudInitUserDataOverwrite": strconv.FormatBool(options.OverwriteUserData),
}
if *useDHCPNetworkConfig {
annotations["VirtletForceDHCPNetworkConfig"] = "true"
}

if options.SSHKey != "" {
annotations["VirtletSSHKeys"] = options.SSHKey
}
@@ -67,7 +67,7 @@ var _ = Describe("virtletctl", func() {
_, err := controller.ConfigMaps().Create(cm)
Expect(err).NotTo(HaveOccurred())

vm = controller.VM("virtletctl-cirros-vm")
vm = controller.VM("virtletctl-test-vm")
Expect(vm.CreateAndWait(VMOptions{
SSHKeySource: "configmap/sshkey",
}.ApplyDefaults(), time.Minute*5, nil)).To(Succeed())
@@ -99,8 +99,8 @@ var _ = Describe("virtletctl", func() {
defer closeFunc()
localExecutor := framework.LocalExecutor(ctx)

output := callVirtletctl(localExecutor, "ssh", "--namespace", controller.Namespace(), "cirros@virtletctl-cirros-vm", "--", "-i", tempfileName, "hostname")
Expect(output).To(Equal("virtletctl-cirros-vm"))
output := callVirtletctl(localExecutor, "ssh", "--namespace", controller.Namespace(), *sshUser+"@virtletctl-test-vm", "--", "-i", tempfileName, "hostname")
Expect(output).To(Equal("virtletctl-test-vm"))
}, 60)

It("Should dump Virtlet diagnostics on diag dump subcommand", func(done Done) {
@@ -243,5 +243,5 @@ func addFlexvolMount(pod *framework.PodInterface, name string, mountPath string,
func shouldBeMounted(ssh framework.Executor, path string) {
Eventually(func() (string, error) {
return framework.RunSimple(ssh, "ls -l "+path)
}, 60).Should(ContainSubstring("lost+found"))
}, 180, 5).Should(ContainSubstring("lost+found"))
}

0 comments on commit 48b353c

Please sign in to comment.
You can’t perform that action at this time.