Skip to content
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

Add extraMounts functional tests #476

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fmount
Copy link
Contributor

@fmount fmount commented Dec 10, 2024

This change adds a functional test for Cinder extraMounts. It ensures we're able to validate the abstraction of corev1.VolumeSource struct introduced in lib-common/storage module.

Jira: https://issues.redhat.com/browse/OSPRH-11210

@fmount fmount requested review from abays and ASBishop December 10, 2024 10:49
@fmount
Copy link
Contributor Author

fmount commented Dec 10, 2024

/retest

1 similar comment
@fmount
Copy link
Contributor Author

fmount commented Dec 17, 2024

/retest

@fmount fmount requested a review from stuggi January 14, 2025 09:44
Copy link
Contributor

@stuggi stuggi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, just some general comments which are not something request to change. just some feedback or to get your opinion on.

ss := th.GetStatefulSet(volume)
// Check the resulting deployment fields
Expect(int(*ss.Spec.Replicas)).To(Equal(1))
Expect(ss.Spec.Template.Spec.Volumes).To(HaveLen(15))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also use https://github.com/openstack-k8s-operators/lib-common/blob/main/modules/common/test/helpers/volumes.go#L27 . to check that the volume with the expected name exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I totally agree to this. Thank you, I wasn't aware about lib-common providing such assertion, and I'm going to use it. In general I don't like much checking the Volumes (or VolumeMount) array length by hardcoding a value, and the assertion solves this problem providing a more solid check!

container := ss.Spec.Template.Spec.Containers[1]
// Fail if manila-share doesn't have the right number of
// VolumeMounts entries
Expect(container.VolumeMounts).To(HaveLen(17))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have https://github.com/openstack-k8s-operators/lib-common/blob/main/modules/common/test/helpers/volumes.go#L36 to check that an expected VolumeMount exist, but it does not (yet) provide functionality to validate the MountPath. should we enhance it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a good idea as well. I was planning, as part of the other comment, to add a validation as part of the extraMount.propagation, to make sure the VolumeMount exists in the resulting statefulset, but perhaps when you mentioned validate the MountPath you had something different in mind (e.g. reserved paths or other relevant RFCs)

Copy link
Contributor

@stuggi stuggi Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in your previous version you were validating the volumemount path like

Expect(vm.MountPath).To(ContainSubstring(CinderCephExtraMountsPath))

we could enhance the test helpers to be able to do that. thats not something it checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see sorry. Even for MountPath we currently check the name and it would be good to be able to validate the path that way. I will add it to the existing assertion in lib-common, so we get it here with the next bump.

test/functional/base_test.go Show resolved Hide resolved
@fmount
Copy link
Contributor Author

fmount commented Jan 14, 2025

looks good to me, just some general comments which are not something request to change. just some feedback or to get your opinion on.

Thank you very much for the review, it's very useful and I wasn't aware about existing assertions provided for basic components in lib-common.
I'm going to push an update to make sure we reuse functions like AssertVolumes/AssertVolumeMounts already provided by lib-common. This would simplify a bit the core logic here!

Copy link
Contributor

openshift-ci bot commented Jan 14, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fmount
Once this PR has been reviewed and has the lgtm label, please assign asbishop for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

This change adds a functional test for Cinder extraMounts. It
ensures we're able to validate the abstraction of 'corev1.VolumeSource'
struct introduced in lib-common/storage module.

Jira: https://issues.redhat.com/browse/OSPRH-11210

Signed-off-by: Francesco Pantano <[email protected]>
@stuggi
Copy link
Contributor

stuggi commented Jan 14, 2025

/lgtm

@fmount
Copy link
Contributor Author

fmount commented Jan 14, 2025

/test cinder-operator-build-deploy-kuttl

1 similar comment
@fmount
Copy link
Contributor Author

fmount commented Jan 16, 2025

/test cinder-operator-build-deploy-kuttl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants