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 tests for adding/removing disks/nics to/from a vm template #3070
Add tests for adding/removing disks/nics to/from a vm template #3070
Conversation
0e2a681
to
cf7f051
Compare
cf7f051
to
150cb5a
Compare
150cb5a
to
d8ef6e9
Compare
@suomyi |
2aa1795
to
ba893ac
Compare
ba893ac
to
0b545b2
Compare
@@ -27,10 +27,10 @@ describe('KubeVirt VM detail - edit flavor', () => { | |||
it( | |||
'changes tiny to large', | |||
async () => { | |||
const vm1Config = vmConfig(configName.toLowerCase(), provisionConfig, testName); | |||
const vm1Config = vmConfig(configName.toLowerCase(), testName, provisionConfig); |
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.
This whole vmConfig creation is quite painful. the config is modified in 3 places
- call getProvisionConfigs
- call vmConfig
- customize result (you need to be familiar with the config format)
- pass it to vm multiple times
IMO, we should introduce builder pattern here with sensible defaults.
e.g
const vm: VirtualMachine = new VMBuilder(ProvisionConfigName.CONTAINER, testname)
.addStorage(additionalStorage)
.setNetworks([])
.startOnCreation(true)
.build()
vm.create()
console.log(vm.getConfig()) // to inspect
thoughts?
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 yes yes I agree 100%, I also hate that we need to pass the config twice, first to create the VirtualMachine object and then to the create
method.
I'm not sure if this is the right time to do it though because we need to close one epic automation gap epic first and this would be a huge 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.
indeed, I agree it would be nicer but it is a big change in a late moment in the cycle. Lets address as a followup once the automation gap is closed.
|
||
describe('Test adding/removing discs/nics to/from a VM template', () => { | ||
const provisionConfigContainer = getProvisionConfigs().get(ProvisionConfigName.CONTAINER); | ||
const commonSettings = { |
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.
it could incorporate all of these functions and configs, which are quite hard to read IMO
}); | ||
|
||
it('Adds a NIC to a VM template', async () => { | ||
expect(vm.getAttachedNICs()).toContain(networkInterface); |
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.
the disadvantage of this approach is that Add NIC test will fail if adding disk fails in beforeAll
|
||
it('Removes a disk from VM template', async () => { | ||
expect(vm.getAttachedDisks()).not.toContain(hddDisk); | ||
}); |
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.
same for the remove
const dataVolumeName = `${vm.name}-${vmTemplate.name}-${rootDisk.name}-clone`; | ||
const dataVolume = getResourceObject(dataVolumeName, vm.namespace, 'datavolume'); | ||
const srcPvc = get(dataVolume, 'spec.source.pvc.name', ''); | ||
expect(srcPvc).toEqual(`${vmTemplate.name}-${rootDisk.name}`); |
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.
after #3665 merges, we should check that it is not possible to remove url disk from the template list after the creation.
edit:
I meant edit should not be possible (applies to some vm disks as well)
I guess deletion should be possible - not entirely sure about that.
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.
and that the vm source type equals to Attached Clone Disk
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.
also, the naming will change a bit.
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.
we should also test that datavolume is not leaking after the template deletion
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.
now disabled, will be addressed in a different PR.
The comments can be addressed as followups, acking this one. /lgtm |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jelkosz, rhrazdil 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 |
/retest Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
3 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Adding
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-1849
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-1850
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-1839