Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/e2e/blockdevice/importer_network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe("ImporterNetworkPolicy", func() {
util.UntilObjectState("Deployed", framework.ShortTimeout, project)

By("Create virtual image")
vi := object.NewGeneratedHTTPVIUbuntu("vi-", project.Name)
vi := object.NewGeneratedHTTPVIAlpineBIOS("vi-", project.Name)
err = f.CreateWithDeferredDeletion(context.Background(), vi)
Expect(err).NotTo(HaveOccurred())

Expand All @@ -62,7 +62,7 @@ var _ = Describe("ImporterNetworkPolicy", func() {
util.UntilObjectState("Deployed", framework.ShortTimeout, project)

By("Create virtual disk")
vd := object.NewGeneratedHTTPVDUbuntu("vd-", project.Name)
vd := object.NewHTTPVDAlpineBIOS("vd-", project.Name)
err = f.CreateWithDeferredDeletion(context.Background(), vd)
Expect(err).NotTo(HaveOccurred())

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/blockdevice/virtual_disk_provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var _ = Describe("VirtualDiskProvisioning", func() {
vi = vibuilder.New(
vibuilder.WithName("vi"),
vibuilder.WithNamespace(f.Namespace().Name),
vibuilder.WithDataSourceHTTP(object.ImageURLAlpineUEFIPerf, nil, nil),
vibuilder.WithDataSourceHTTP(object.ImageURLAlpineUEFI, nil, nil),
vibuilder.WithStorage(v1alpha2.StoragePersistentVolumeClaim),
)

Expand Down
14 changes: 4 additions & 10 deletions test/e2e/blockdevice/virtual_image_creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var _ = Describe("VirtualImageCreation", func() {
vdbuilder.WithSize(ptr.To(resource.MustParse("350Mi"))),
vdbuilder.WithDataSourceHTTP(
&v1alpha2.DataSourceHTTP{
URL: object.ImageURLAlpineUEFIPerf,
URL: object.ImageURLAlpineUEFI,
},
),
)
Expand Down Expand Up @@ -98,9 +98,7 @@ var _ = Describe("VirtualImageCreation", func() {
baseCvis = append(baseCvis, cvibuilder.New(
cvibuilder.WithGenerateName(fmt.Sprintf("%s-cvi-http-", cviPrefix)),
cvibuilder.WithDataSourceHTTP(
object.ImageURLAlpineUEFIPerf,
nil,
nil,
object.ImageURLAlpineUEFI, nil, nil,
),
))
baseCvis = append(baseCvis, cvibuilder.New(
Expand All @@ -120,9 +118,7 @@ var _ = Describe("VirtualImageCreation", func() {
vibuilder.WithNamespace(f.Namespace().Name),
vibuilder.WithStorage(v1alpha2.StorageContainerRegistry),
vibuilder.WithDataSourceHTTP(
object.ImageURLAlpineUEFIPerf,
nil,
nil,
object.ImageURLAlpineUEFI, nil, nil,
),
))
baseVis = append(baseVis, vibuilder.New(
Expand All @@ -146,9 +142,7 @@ var _ = Describe("VirtualImageCreation", func() {
vibuilder.WithNamespace(f.Namespace().Name),
vibuilder.WithStorage(v1alpha2.StoragePersistentVolumeClaim),
vibuilder.WithDataSourceHTTP(
object.ImageURLAlpineUEFIPerf,
nil,
nil,
object.ImageURLAlpineUEFI, nil, nil,
),
))
baseVis = append(baseVis, vibuilder.New(
Expand Down
18 changes: 10 additions & 8 deletions test/e2e/internal/object/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ limitations under the License.
package object

const (
ImageURLAlpineUEFIPerf = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2"
ImageURLAlpineBIOS = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-bios-base.qcow2"
ImageURLUbuntu = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/ubuntu/ubuntu-24.04-minimal-cloudimg-amd64.qcow2"
ImageURLContainerImage = "cr.yandex/crpvs5j3nh1mi2tpithr/e2e/alpine/alpine-image:latest"
ImageURLMinimalQCOW = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/test/test.qcow2"
ImageURLMinimalISO = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/test/test.iso"
Mi256 = 256 * 1024 * 1024
DefaultVMClass = "generic"
ImageURLAlpineUEFI = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-uefi-base.qcow2"
ImageURLAlpineBIOS = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-23-3-bios-base.qcow2"
ImagesURLAlpineUEFIPerf = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/alpine/alpine-3-21-uefi-perf.qcow2"
ImageURLUbuntu = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/ubuntu/ubuntu-24.04-minimal-cloudimg-amd64.qcow2"
ImageURLContainerImage = "cr.yandex/crpvs5j3nh1mi2tpithr/e2e/alpine/alpine-image:latest"
// No bootable
ImageTestDataQCOW = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/test/test.qcow2"
ImageTestDataISO = "https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/test/test.iso"
Mi256 = 256 * 1024 * 1024
DefaultVMClass = "generic"

cloudInitBase = `#cloud-config
package_update: true
Expand Down
8 changes: 2 additions & 6 deletions test/e2e/internal/object/cvi.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ func NewHTTPCVIUbuntu(name string, opts ...cvi.Option) *v1alpha2.ClusterVirtualI
baseOpts := []cvi.Option{
cvi.WithName(name),
cvi.WithDataSourceHTTP(
ImageURLAlpineBIOS,
nil,
nil,
ImageURLUbuntu, nil, nil,
),
}
baseOpts = append(baseOpts, opts...)
Expand All @@ -38,9 +36,7 @@ func NewGenerateHTTPCVIUbuntu(prefix string, opts ...cvi.Option) *v1alpha2.Clust
baseOpts := []cvi.Option{
cvi.WithGenerateName(prefix),
cvi.WithDataSourceHTTP(
ImageURLAlpineBIOS,
nil,
nil,
ImageURLUbuntu, nil, nil,
),
}
baseOpts = append(baseOpts, opts...)
Expand Down
26 changes: 25 additions & 1 deletion test/e2e/internal/object/vd.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewGeneratedHTTPVDUbuntu(prefix, namespace string, opts ...vd.Option) *v1al
vd.WithGenerateName(prefix),
vd.WithNamespace(namespace),
vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{
URL: ImageURLAlpineBIOS,
URL: ImageURLUbuntu,
}),
}
baseOpts = append(baseOpts, opts...)
Expand All @@ -96,3 +96,27 @@ func NewHTTPVDAlpineBIOS(name, namespace string, opts ...vd.Option) *v1alpha2.Vi
baseOpts = append(baseOpts, opts...)
return vd.New(baseOpts...)
}

func NewHTTPVDAlpineUEFI(name, namespace string, opts ...vd.Option) *v1alpha2.VirtualDisk {
baseOpts := []vd.Option{
vd.WithName(name),
vd.WithNamespace(namespace),
vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{
URL: ImageURLAlpineUEFI,
}),
}
baseOpts = append(baseOpts, opts...)
return vd.New(baseOpts...)
}

func NewHTTPVDAlpineUEFIPerf(name, namespace string, opts ...vd.Option) *v1alpha2.VirtualDisk {
baseOpts := []vd.Option{
vd.WithName(name),
vd.WithNamespace(namespace),
vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{
URL: ImagesURLAlpineUEFIPerf,
}),
}
baseOpts = append(baseOpts, opts...)
return vd.New(baseOpts...)
}
62 changes: 56 additions & 6 deletions test/e2e/internal/object/vi.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,35 @@ func NewHTTPVIUbuntu(name, namespace string, opts ...vi.Option) *v1alpha2.Virtua
vi.WithStorage(v1alpha2.StorageContainerRegistry),
vi.WithNamespace(namespace),
vi.WithDataSourceHTTP(
ImageURLAlpineBIOS,
nil,
nil,
ImageURLUbuntu, nil, nil,
),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
}
baseOpts = append(baseOpts, opts...)
return vi.New(baseOpts...)
}

func NewHTTPVIAlpineBIOS(name, namespace string, opts ...vi.Option) *v1alpha2.VirtualImage {
baseOpts := []vi.Option{
vi.WithName(name),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
vi.WithNamespace(namespace),
vi.WithDataSourceHTTP(
ImageURLAlpineBIOS, nil, nil,
),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
}
baseOpts = append(baseOpts, opts...)
return vi.New(baseOpts...)
}

func NewHTTPVIAlpineUEFI(name, namespace string, opts ...vi.Option) *v1alpha2.VirtualImage {
baseOpts := []vi.Option{
vi.WithName(name),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
vi.WithNamespace(namespace),
vi.WithDataSourceHTTP(
ImageURLAlpineUEFI, nil, nil,
),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
}
Expand All @@ -42,9 +68,33 @@ func NewGeneratedHTTPVIUbuntu(prefix, namespace string, opts ...vi.Option) *v1al
vi.WithGenerateName(prefix),
vi.WithNamespace(namespace),
vi.WithDataSourceHTTP(
ImageURLAlpineBIOS,
nil,
nil,
ImageURLUbuntu, nil, nil,
),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
}
baseOpts = append(baseOpts, opts...)
return vi.New(baseOpts...)
}

func NewGeneratedHTTPVIAlpineBIOS(prefix, namespace string, opts ...vi.Option) *v1alpha2.VirtualImage {
baseOpts := []vi.Option{
vi.WithGenerateName(prefix),
vi.WithNamespace(namespace),
vi.WithDataSourceHTTP(
ImageURLAlpineBIOS, nil, nil,
),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
}
baseOpts = append(baseOpts, opts...)
return vi.New(baseOpts...)
}

func NewGeneratedHTTPVIAlpineUEFI(prefix, namespace string, opts ...vi.Option) *v1alpha2.VirtualImage {
baseOpts := []vi.Option{
vi.WithGenerateName(prefix),
vi.WithNamespace(namespace),
vi.WithDataSourceHTTP(
ImageURLAlpineUEFI, nil, nil,
),
vi.WithStorage(v1alpha2.StorageContainerRegistry),
}
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/internal/util/sdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import (
)

const (
ClusterNetworkName = "cn-1003-for-e2e-test"
ClusterNetworkVLANID = 1003
ClusterNetworkName = "cn-4006-for-e2e-test"
ClusterNetworkVLANID = 4006
ClusterNetworkCreateCommand = `kubectl apply -f - <<EOF
apiVersion: network.deckhouse.io/v1alpha1
kind: ClusterNetwork
metadata:
name: cn-1003-for-e2e-test
name: cn-4006-for-e2e-test
spec:
parentNodeNetworkInterfaces:
labelSelector:
Expand All @@ -44,7 +44,7 @@ spec:
network.deckhouse.io/node-role: worker
type: VLAN
vlan:
id: 1003
id: 4006
EOF`
)

Expand Down
59 changes: 22 additions & 37 deletions test/e2e/vm/additional_network_interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,10 @@ import (
"github.com/deckhouse/virtualization/test/e2e/internal/util"
)

const (
// IPs on additional network interface for connectivity check between VMs.
// When VM has Main network, additional interface is eth1; otherwise it's eth0.
vmFooAdditionalIP = "192.168.1.10"
vmBarAdditionalIP = "192.168.1.11"
)

type additionalNetworkTestCase struct {
vmBarHasMainNetwork bool
vmFooAdditionalIP string
vmBarAdditionalIP string
}

var _ = Describe("VirtualMachineAdditionalNetworkInterfaces", func() {
Expand Down Expand Up @@ -78,43 +73,38 @@ var _ = Describe("VirtualMachineAdditionalNetworkInterfaces", func() {
By("Environment preparation", func() {
ns := f.Namespace().Name

vdFooRoot = vd.New(
vd.WithName("vd-foo-root"),
vd.WithNamespace(ns),
vdFooRoot = object.NewHTTPVDAlpineUEFIPerf("vd-foo-root", ns,
vd.WithSize(ptr.To(resource.MustParse("512Mi"))),
vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{
URL: object.ImageURLAlpineUEFIPerf,
}),
)
vdBarRoot = vd.New(
vd.WithName("vd-bar-root"),
vd.WithNamespace(ns),
vdBarRoot = object.NewHTTPVDAlpineUEFIPerf("vd-bar-root", ns,
vd.WithSize(ptr.To(resource.MustParse("512Mi"))),
vd.WithDataSourceHTTP(&v1alpha2.DataSourceHTTP{
URL: object.ImageURLAlpineUEFIPerf,
}),
)

// vm-foo always has Main + ClusterNetwork so we can SSH to it.
vmFoo = buildVMWithNetworks("vm-foo", ns, vdFooRoot.Name, vmFooAdditionalIP, true)
vmBar = buildVMWithNetworks("vm-bar", ns, vdBarRoot.Name, vmBarAdditionalIP, tc.vmBarHasMainNetwork)
vmFoo = buildVMWithNetworks("vm-foo", ns, vdFooRoot.Name, tc.vmFooAdditionalIP, true)
vmBar = buildVMWithNetworks("vm-bar", ns, vdBarRoot.Name, tc.vmBarAdditionalIP, tc.vmBarHasMainNetwork)

err := f.CreateWithDeferredDeletion(context.Background(), vdFooRoot, vdBarRoot, vmFoo, vmBar)
Expect(err).NotTo(HaveOccurred())

util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.LongTimeout, vmFoo, vmBar)
util.UntilVMAgentReady(crclient.ObjectKeyFromObject(vmFoo), framework.LongTimeout)
util.UntilSSHReady(f, vmFoo, framework.LongTimeout)
if tc.vmBarHasMainNetwork {
util.UntilVMAgentReady(crclient.ObjectKeyFromObject(vmBar), framework.LongTimeout)
util.UntilSSHReady(f, vmBar, framework.LongTimeout)
}

By(fmt.Sprintf("Wait until vms %s and %s in phase running", vmFoo.GetName(), vmBar.GetName()), func() {
util.UntilObjectPhase(string(v1alpha2.MachineRunning), framework.LongTimeout, vmFoo, vmBar)
})
})

// If test fail due this timeout, rollback in test waiting for agent to be ready.
By("Wait for additional network interfaces to be ready", func() {
util.UntilConditionStatus(vmcondition.TypeNetworkReady.String(), "True", framework.LongTimeout, vmFoo, vmBar)
})

By("Check connectivity between VMs via additional network", func() {
checkConnectivityBetweenVMs(f, vmFoo, vmBar, tc.vmBarHasMainNetwork)
checkConnectivityBetweenVMs(f, vmFoo, vmBar, tc.vmBarHasMainNetwork, tc.vmBarAdditionalIP, tc.vmFooAdditionalIP)
})

By("Create VMOPs to trigger migration", func() {
Expand Down Expand Up @@ -150,11 +140,11 @@ var _ = Describe("VirtualMachineAdditionalNetworkInterfaces", func() {
})

By("Check connectivity between VMs via additional network after migration", func() {
checkConnectivityBetweenVMs(f, vmFoo, vmBar, tc.vmBarHasMainNetwork)
checkConnectivityBetweenVMs(f, vmFoo, vmBar, tc.vmBarHasMainNetwork, tc.vmBarAdditionalIP, tc.vmFooAdditionalIP)
})
},
Entry("Main + additional network", additionalNetworkTestCase{vmBarHasMainNetwork: true}),
Entry("Only additional network (vm-bar without Main)", additionalNetworkTestCase{vmBarHasMainNetwork: false}),
Entry("Main + additional network", additionalNetworkTestCase{vmBarHasMainNetwork: true, vmFooAdditionalIP: "192.168.42.10", vmBarAdditionalIP: "192.168.42.11"}),
Entry("Only additional network (vm-bar without Main)", additionalNetworkTestCase{vmBarHasMainNetwork: false, vmFooAdditionalIP: "192.168.42.12", vmBarAdditionalIP: "192.168.42.13"}),
)
})

Expand Down Expand Up @@ -209,26 +199,21 @@ users:
lock_passwd: False
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxcXHmwaGnJ8scJaEN5RzklBPZpVSic4GdaAsKjQoeA your_email@example.com
packages:
- qemu-guest-agent
write_files:
- path: /etc/network/interfaces
append: true
content: |

auto %s
iface %s inet static
address %s
netmask 255.255.255.0
runcmd:
- sudo rc-update add qemu-guest-agent default
- sudo rc-service qemu-guest-agent start
- sudo /etc/init.d/networking restart
- chown -R cloud:cloud /home/cloud
- "rc-update add sshd && rc-service sshd start"
- "rc-update add networking boot && rc-service networking restart"
`, ifaceName, ifaceName, additionalIP)
}

func checkConnectivityBetweenVMs(f *framework.Framework, vmFoo, vmBar *v1alpha2.VirtualMachine, vmBarHasMainNetwork bool) {
func checkConnectivityBetweenVMs(f *framework.Framework, vmFoo, vmBar *v1alpha2.VirtualMachine, vmBarHasMainNetwork bool, vmBarAdditionalIP, vmFooAdditionalIP string) {
GinkgoHelper()

pingCmd := "ping -c 2 -W 2 -w 5 -q %s 2>&1 | grep -o \"[0-9]\\+%%\\s*packet loss\"" // %% -> % in output
Expand All @@ -244,14 +229,14 @@ func checkConnectivityBetweenVMs(f *framework.Framework, vmFoo, vmBar *v1alpha2.
}

const (
Interval = 5 * time.Second
Interval = 1 * time.Second
Timeout = 90 * time.Second
)

func checkResultSSHCommand(f *framework.Framework, vmName, vmNamespace, cmd, equal string) {
GinkgoHelper()
Eventually(func() (string, error) {
res, err := f.SSHCommand(vmName, vmNamespace, cmd)
res, err := f.SSHCommand(vmName, vmNamespace, cmd, framework.WithSSHTimeout(5*time.Second))
if err != nil {
return "", fmt.Errorf("cmd: %s\nstderr: %w", cmd, err)
}
Expand Down
Loading
Loading