test: precreate cvi for e2e tests#2103
Conversation
c38b025 to
636d591
Compare
853e2fb to
9abdc69
Compare
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
d55ba57 to
2f8064f
Compare
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
| require.True(t, strings.HasPrefix(tt.rendered, "#cloud-config\n"), | ||
| "cloud-init must start with #cloud-config header") |
There was a problem hiding this comment.
This can be a validation method of CloudConfig. But not required.
There was a problem hiding this comment.
The #cloud-config header is a property of the rendered string, not the CloudConfig struct itself — Render() always prepends it. A Validate() method on the struct wouldn't have access to it. This check is purely a test-level assertion that the pre-rendered constants are well-formed, so I think it fits better here as is.
| require.True(t, strings.HasPrefix(tt.rendered, "#cloud-config\n"), | ||
| "cloud-init must start with #cloud-config header") | ||
|
|
||
| var parsed map[string]interface{} |
There was a problem hiding this comment.
Should it be parsed into the CloudConfig structure?
There was a problem hiding this comment.
We intentionally parse into map[string]interface{} to verify actual YAML key names (which are controlled by the struct's json: tags via sigs.k8s.io/yaml). A round-trip through CloudConfig would always be self-consistent and wouldn't catch a tag typo that breaks the cloud-init contract.
There was a problem hiding this comment.
Should this file be placed in the precreatedcvi package or cviManager in the object package?
There was a problem hiding this comment.
I don’t think so, because it’s a data/definition file, not a lifecycle file.
The precreatedcvi package's role is solely orchestration
Co-authored-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com> Signed-off-by: Nikita Korolev <141920865+universal-itengineer@users.noreply.github.com>
Co-authored-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com> Signed-off-by: Nikita Korolev <141920865+universal-itengineer@users.noreply.github.com>
Co-authored-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com> Signed-off-by: Nikita Korolev <141920865+universal-itengineer@users.noreply.github.com>
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
Co-authored-by: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com> Signed-off-by: Nikita Korolev <141920865+universal-itengineer@users.noreply.github.com>
Description
Migrate e2e tests from per-test VirtualImage/ClusterVirtualImage creation via HTTP sources to a shared set of precreated ClusterVirtualImages that are bootstrapped once before the suite and reused across runs. Also refactors cloud-init configuration into a typed Go struct and removes ~30 duplicated YAML manifests from testdata.
Why do we need it, and what problem does it solve?
What is the expected result?
Precreated shared CVIs: 12
ClusterVirtualImageresources (Alpine UEFI/BIOS, Alpine Perf variants, Ubuntu, Ubuntu ISO, Cirros, Debian, container images, test data) are created once inSynchronizedBeforeSuite. If CVIs already exist in the cluster from a previous run, they are reused without re-creation, making repeated local runs significantly faster.Tests migrated to precreated CVIs: All e2e tests (VM, legacy, blockdevice, snapshot, vmop suites) now create VirtualDisks and VirtualImages via
dataSource.objectRefreferencing precreated CVIs instead of downloading images over HTTP. Helper functionsNewVDFromCVIandNewGeneratedVIFromCVIare added to simplify construction.Removed ~30 duplicated YAML manifests: Per-test VI/CVI kustomize manifests are deleted from testdata directories of affinity-toleration, complex-test, disk-resizing, image-hotplug, vd-snapshots, vm-disk-attachment, vm-evacuation, vm-label-annotation, vm-migration-cancel, and vm-migration.
Typed cloud-init configuration: User-data is now generated from a
CloudConfigGo struct with OS-specific presets (AlpineCloudInit,UbuntuCloudInit,PerfCloudInit), each with correct package names and service management commands. Covered by unit tests.Controlled cleanup: Precreated CVIs are preserved between runs by default. Deletion is opt-in via the
PRECREATED_CVI_CLEANUP=yesenvironment variable.Removed unused test: Deleted
vm/hotplug_pod.go.Checklist
Changelog entries