-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(CNV-43603): add disk-uploader functional tests #549
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: codingben The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
test/disk_uploader_test.go
Outdated
ExportSourceKind: "vm", | ||
ExportSourceName: vmName, | ||
VolumeName: dvName, | ||
ImageDestination: "quay.io/boukhano/e2e-example-vm", // TODO: Use quay.io/kubevirt/e2e-example-vm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a registry local to the test cluster, that can be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a discussion with @ksimon1 about it to keep using an external registry that allows you also to test it on Kubernetes cluster. As you know, only OpenShift has built-in container registry.
test/disk_uploader_test.go
Outdated
"accessKeyId": []byte(""), // TODO: Get value from OCP CI | ||
"secretKey": []byte(""), // TODO: Get value from OCP CI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add any credentials to this repo! Can we do this differently with a local registry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be no credentials in the repo, since the OCP ci has a secret vault, which can be used for populating the secrets in test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be no secrets in this repository. Both accessKeyId
and secretKey
values will be set from the environment variables (aka Secrets in the OCP CI).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ksimon1 How do you think we'll store the registry credenetials when running in developer mode, locally in the developer machine? (not in a CI)
CreateTaskRun(). | ||
ExpectSuccess(). | ||
ExpectLogs(config.GetAllExpectedLogs()...). | ||
ExpectResults(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Query the repository after to verify disk was uploaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep good idea, need to check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you going to add a check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. We may want to delete the repository after completing running the tests. If we won't delete it, and re-run the functional tests, it may be false check.
@ksimon1 @0xFelix Currently there is a single test case: |
func createAndWaitForVM(client kubevirtcliv1.KubevirtClient, namespace, name string, timeout time.Duration) { | ||
dataVolume := libdv.NewDataVolume( | ||
libdv.WithRegistryURLSource("docker://quay.io/kubevirt/cirros-container-disk-demo"), | ||
libdv.WithForceBindAnnotation(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be required, if the VM was started at least once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VM can't be exported if started and it's running. It should be stopped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VM is created as stopped by default.
Deploy a new Cirros VM to export from, and run disk-uploader as Task to execute extraction process and upload it to the Quay container registry. Signed-off-by: Ben Oukhanov <[email protected]>
@ksimon1 @0xFelix This revision will make e2e tests work, as tested locally it works now and image was pushed to the Quay container registry [1]. Can you please review? [1] https://quay.io/repository/boukhano/e2e-tests-example-vm |
@@ -40,7 +40,7 @@ kubectl apply -f "https://github.com/kubevirt/kubevirt/releases/download/${KUBEV | |||
|
|||
kubectl apply -f "https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/kubevirt-cr.yaml" | |||
|
|||
kubectl patch kubevirt kubevirt -n kubevirt --type merge -p '{"spec":{"configuration":{"developerConfiguration":{"featureGates": ["DataVolumes"]}}}}' | |||
kubectl patch kubevirt kubevirt -n kubevirt --type merge -p '{"spec":{"configuration":{"developerConfiguration":{"featureGates": ["DataVolumes", "VMExport"]}}}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataVolumes
FG can be dropped I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep just want to get confirmation from @ksimon1 about it, so this PR won't do any other changes except adding new tests.
@@ -3,3 +3,6 @@ | |||
export DEV_MODE="${DEV_MODE:-false}" | |||
export STORAGE_CLASS="${STORAGE_CLASS:-}" | |||
export NUM_NODES=${NUM_NODES:-2} | |||
export REGISTRY_IMAGE_DESTINATION="quay.io/kubevirt/e2e-tests-example-vm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there absolutely no way to use an ephemeral registry? Why do we have to store test artifacts on a live registry? (quay.io)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replied here earlier. The issue is that there is no built-in registry in Kubernetes cluster (only on OpenShift).
So we have 3 options:
1). Deploy a new pod that will use registry image to push there
2). Use OCP's built-in container registry
3). Use an external container registry
imageDestination := os.Getenv("REGISTRY_IMAGE_DESTINATION") | ||
Expect(imageDestination).ToNot(BeEmpty()) | ||
|
||
registryCredentials, err := createRegistryCredentials(f.CoreV1Client, f.DeployNamespace) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
cirrosVm, err := createCirrosVM(f.KubevirtClient, f.DeployNamespace) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
_, err = vm.WaitForVM(f.KubevirtClient, f.DeployNamespace, cirrosVm.Name, "", constants.Timeouts.WaitForVMStart.Duration, false) | ||
Expect(err).ToNot(HaveOccurred()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to BeforeEach?
CreateTaskRun(). | ||
ExpectSuccess(). | ||
ExpectLogs(config.GetAllExpectedLogs()...). | ||
ExpectResults(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you going to add a check?
|
||
func createCirrosVM(client kubevirtcliv1.KubevirtClient, namespace string) (*v1.VirtualMachine, error) { | ||
dataVolume := libdv.NewDataVolume( | ||
libdv.WithRegistryURLSource("docker://quay.io/kubevirt/cirros-container-disk-demo"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not use libdv
. It lives under tests/libdv
which might be subject to change. Only libvmi
can be considered stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xFelix Don't you think that this is an issue that such important libs for external projects tests living under kubevirt/kubevirt
, especially under tests/libdv
?
|
What this PR does / why we need it:
Deploy a new Cirros VM to export from,
and run disk-uploader as Task to execute
extraction process and upload it to the
Quay container registry.
Release note: