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
Bug 1798862: VMI list integration tests #4209
Bug 1798862: VMI list integration tests #4209
Conversation
@rhrazdil please review |
726226a
to
0c39097
Compare
@yaacov: This pull request references Bugzilla bug 1798862, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -28,8 +28,8 @@ import { KubevirtDetailView } from './kubevirtDetailView'; | |||
import { ImportWizard } from './importWizard'; | |||
|
|||
export class VirtualMachine extends KubevirtDetailView { | |||
constructor(config) { | |||
super({ ...config, kind: 'virtualmachines' }); | |||
constructor(config, kind?: 'virtualmachines' | 'virtualmachineinstances') { |
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's an interesting idea. I'm just wondering whether we should or should not differentiate the type of VirtualMachine and VirtualMachineInstance more explicitly.
@suomiy wdyt?
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.
whether we should or should not differentiate the type of VirtualMachine and VirtualMachineInstance more explicitly.
The page rendering VM and VMI share the same component, it renders a vmiLike
object that can be VM or VMI. When rendering we have small changes, mainly page title, how status is calculated, and what is allowed to be edit:
https://github.com/openshift/console/blob/master/frontend/packages/kubevirt-plugin/src/components/vms/vm-details.tsx#L72
IMHO it makes sense to share the testing methods of this components too.
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 and VMI objects are very similar, not the same though. You can't do the same (or any basically) actions with VMI, which would be nice to have reflected in our testing framework.
But it could be achieved this way as well.
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 there will be differences in actions and also editing and we should reflect that and not use the same class for them. Let's figure out the best approach
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; we decided to keep it simple for now after offline discussion.
Radim will revisits this once his VMBuilder PR is up.
Let's just think of it as temporary solution for now.
@@ -237,6 +238,49 @@ export function getVMManifest( | |||
throw Error('Provision source not Implemented'); | |||
} | |||
|
|||
const spec = { |
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.
can you please rename this to vmiSpec
?
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.
sure, done
spec, | ||
}; | ||
|
||
return kind === 'VirtualMachineInstance' ? vmiResource : vmResource; |
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.
can we rather have two functions getVMManifest and getVMIManifest which would use common settings of them?
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.
done 👍
@@ -28,8 +28,8 @@ import { KubevirtDetailView } from './kubevirtDetailView'; | |||
import { ImportWizard } from './importWizard'; | |||
|
|||
export class VirtualMachine extends KubevirtDetailView { | |||
constructor(config) { | |||
super({ ...config, kind: 'virtualmachines' }); | |||
constructor(config, kind?: 'virtualmachines' | 'virtualmachineinstances') { |
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 there will be differences in actions and also editing and we should reflect that and not use the same class for them. Let's figure out the best approach
); | ||
|
||
beforeAll(async () => { | ||
await waitForVM(testVM, VM_STATUS.Off, leakedResources); |
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 this be really in before all block? Shouldn't we also check the vmi status 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.
should this be really in before all block?
The test is to filter by status, knowing the the vmi is Running
while the vm is Off
So we need one vm in Off
status and one vmi in Running
status, before we start the tests.
Shouldn't we also check the vmi status change?
vmi is always running ( if evrything is ok :-) )
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 then
await isLoaded(); | ||
}; | ||
|
||
describe('Test List View Filtering (VMI)', () => { |
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.
not sure if the naming applies ^^, we are not filtering anything - we show all of the VMs and VMIs at 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.
we are not filtering anything
We are filtering by status, we have 1 Off
vm and 1 Running
vmi,
A side affect of this filtering procedure is the we know for sure the we list both vm and vmi in one list.
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 mean the name implies that we are testing the filtering feature of the UI. We are just reading the values and not testing 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.
Correct, we are actually testing vmStatusFilter that filter the vm/vmi list, and not the actual filtering feature of the UI , implemented in MultiListPage
.
This actually makes sense here because the UI filtering is a core feature that we should not test in our module, maybe we should rename the test to make it clear we test vmStatusFilter
and not MultiListPage
that does the UI filtering ?
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's true that name like: Test List View Filter counts
or similar would probably better describe what is done here.
I would keep the test names e2e oriented from user's perspective. IMO there is no need to make distinction betweem our plugin vs core in the test cases names.
/test e2e-gcp-console |
/test e2e-gcp-console |
it('Displays correct count of Running VMIs', async () => { | ||
const vmiImportingCount = await filterBoxCount(VM_STATUS.Running); | ||
expect(vmiImportingCount).toEqual(1); | ||
}); |
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 when I think about it, it may be a good idea to add one more test case that the VMI is displayed in the list.
Something like:
import {
resourceRowsPresent,
textFilter,
} from '@console/internal-integration-tests/views/crud.view';
it('Displays VMIs in the list of VirtualMachines', async () => {
await fillInput(textFilter, testVMI.metadata.name);
await resourceRowsPresent();
});
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.
Thanks 👍
c90e8f8
to
a7ee6c7
Compare
/test e2e-gcp-console |
1 similar comment
/test e2e-gcp-console |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhrazdil, suomiy, yaacov 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 |
@yaacov: All pull requests linked via external trackers have merged. Bugzilla bug 1798862 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
A test to check that we see VMs and VMIs in the Virtual Machine list page