-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: create e2e resources from yaml files #237
Conversation
/retest-required |
/retest |
size = "5Gi" | ||
) | ||
//go:embed testdata/pvc_tests/pvc-template.yaml | ||
var pvcYAMLTemplate string |
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.
YAML
can be removed from each of the variables. Looks redundant IMO. pvcTemplate
should suffice.
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 think the yaml makes it a little clearer as to what type it is in the code.
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.
ok
if err != nil { | ||
return nil, err | ||
} | ||
pvc := obj.(*k8sv1.PersistentVolumeClaim) |
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 think obj
can returned here without casting it to actual resource because the return type of all these decoder functions is used in the crClient.Create
function that can take the obj
.
So we can have a single function that just decodes all the input yaml strings to obj.
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 prefer casting it because it makes the code clearer as to what object it is working on.
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.
ok
volumeSnapshotClassName: odf-lvm-vg1 | ||
source: | ||
persistentVolumeClaimName: lvmfilepvc | ||
|
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.
blank line.
By("Creating a clone of the block-pvc") | ||
clonePvc = getSamplePvc(size, pvc.Name+"-clone", k8sv1.PersistentVolumeBlock, storageClass, "PersistentVolumeClaim", pvc.Name) | ||
pvcCloneYaml := fmt.Sprintf(pvcCloneYAMLTemplate, "lvmblockpvc-clone", testNamespace, "Block", storageClass, "lvmblockpvc") |
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 we rather create multiple template files for reach resource type rather than updating the template like this?
I think the main purpose of the go embed would be to use static assets that don't change.
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 don't think that is necessary - we can use the same template to create multiple instances of a type.
Having a separate file for each instance could quickly get out of hand once the tests are expanded.
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.
ok
Modified the e2e code to use go:embed and yaml files to create pod,pvc,and volumesnapshot resources. This makes it easier to make changes when required Signed-off-by: N Balachandran <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nbalacha, sp98 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Modified the e2e code to use go:embed and yaml files
to create pod,pvc,and volumesnapshot resources. This makes
it easier to make changes when required.
Signed-off-by: N Balachandran [email protected]