-
Notifications
You must be signed in to change notification settings - Fork 667
Bug 1883766: Adjust tests for UI changes #6788
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
Conversation
|
@gouyang: This pull request references Bugzilla bug 1883766, which is invalid:
Comment DetailsIn 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. |
|
Hi @gouyang. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
/ok-to-test |
frontend/packages/kubevirt-plugin/integration-tests/tests/dialogs/diskDialog.ts
Outdated
Show resolved
Hide resolved
| }, | ||
| [ProvisionSource.PXE]: { method: ProvisionSource.PXE }, | ||
| [ProvisionSource.DISK]: { method: ProvisionSource.DISK }, | ||
| [ProvisionSource.PXE]: { method: ProvisionSourceItem.PXE }, |
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.
what benefit do we get from splitting ProvisionSource into 2 constants? This will result in worse maintainability.
Can we either
- rename the original to what we need:
URL (adds disk), etc. - refactor the ProvisionSource to become ObjectEnum so it has all the required information in one place (name, label and source)
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 added ProvisionSourceItem because string like URL (adds disk) cannot be used as the key.
Will look into ObjectEnum.
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.
Why not? Is there a specific reason why it cannot be used as a key?
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.
If using URL (adds disk) , it throws errors very quickly:
[10:33:24] E/launcher - Error: TypeError: Cannot read property 'source' of undefined
at Object.exports.getTestDataVolume (/home/gouyang/console/frontend/packages/kubevirt-plugin/integration-tests/tests/mocks/mocks.ts:102:37)
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.
@suomiy Could you give me an example how to use ObjectEnum?
frontend/packages/kubevirt-plugin/integration-tests/tests/mocks/mocks.ts
Show resolved
Hide resolved
| await selectOptionByText(view.provisionSourceSelect, provisionOptions.method); | ||
| await selectItemFromDropdown( | ||
| view.provisionSourceSelect, | ||
| view.bootSourceDropDownItem(provisionOptions.method), |
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 call it provisionSourceDropDownItem for consistency reasons? I know we renamed it in the UI. but we should be consistent here IMO.
Or we should rename all the occurrences here
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 used the code listed here:
async selectOperatingSystem(operatingSystem: string) {
await selectItemFromDropdown(view.operatingSystemSelect, view.dropDownItem(operatingSystem));
}
and it couldn't select OS when running VMWare wizard
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 call it provisionSourceDropDownItem for consistency reasons? I know we renamed it in the UI. but we should be consistent here IMO.
ok.
and it couldn't select OS when running VMWare wizard
I guess the style of OS list in VMWare wizard is different from vm Wizard, if so, I think the best way is making the style consistent.
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 is using the same component in the code. @ibragins can you check if it renders different html/styles for you?
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
| ); | ||
| if (Object.prototype.hasOwnProperty.call(provisionOptions, 'source')) { | ||
| await fillInput(view.provisionSourceInputs[provisionOptions.method], provisionOptions.source); | ||
| if (provisionOptions.method === ProvisionSourceItem.URL) { |
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 this necessary? can we keep the original form?
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. will do
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 reason is the value of provisionOptions.method for URL is URL (adds disk), provisionSourceInputs only has URL and Container, so do it this way.
The original form does not work.
| // ProvisionSource, OS and workload are prefilled and disabled - ignoring them | ||
| } else if (template) { | ||
| await this.selectTemplate(template); | ||
| if (os) { |
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 can you show me, where is the logic for the template now? We are still offering this option.
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 wizard field is removed by 1871103, so remove it here 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.
the field was removed, but the wizard is still used for creating VMs from the template. So it should still not be possible to select os/workload/etc for these VMs. This applies for other logic as well. Only the selection should be removed.
Still we could automate this and add the template field tot the build and it would just go to the template page and select the create VM action
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.
Removed field template works well for create vm from template or not from template based on the new changes and the tests are PASS for vm.wizard and vmtemplate.wizard:
- template is removed in vm wizard
- the new link/button to create vm from template
| await this.addNIC(resource); | ||
| } | ||
| if (provisionSource?.method === ProvisionSource.PXE && template === undefined) { | ||
| if (provisionSource?.method === ProvisionSourceItem.PXE) { |
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.
plus here
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 used the code listed here:
async selectOperatingSystem(operatingSystem: string) {
await selectItemFromDropdown(view.operatingSystemSelect, view.dropDownItem(operatingSystem));
}
and it couldn't select OS when running VMWare wizard
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.
No need to use template here based on the actual test results.
| .setTemplate(vmt.name) | ||
| .setName('from-template') | ||
| .build(); | ||
| const vm = new VMBuilder(getBasicVMBuilder()).setName('from-template').build(); |
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 is a new flow for creating vm's from templates: through /k8s/ns/default/virtualization/templates or k8s/ns/default/vmtemplates/vm-template-example.
We should test the new way of creating vms from templates in all our scenarios
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 have the test ID(CNV-4290) Creates VM using VM Template create virtual machine link in vmtemplate.wizard.scenario.ts
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, but this test tests resources (disks/nics) and should also do that with template flow in mind
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.
No need to use template here based on the actual test results.
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 specify, why is there no need to test templates?
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 does not skip/ignore template test, I mean no need to use template field.
} else if (template) {
await this.selectTemplate(template);
} else {
await this.selectTemplate(template); will never be executed as we don't have this field. If remove this line and leave this block empty does not make sense and is not accepted by eslint.
To create vm from template should use:
await vmt.createVMFromRowLink();
await wizard.processWizard(vm.getData());
It does not need to have template at all.
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 get that the template option is not in the wizard, but it is still possible to create a VM from the template
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 have tests to create vm from template and it does not require template field to create vm from template.
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.
you need to know the name of the template to select it. The implementation (wizard field or clicking on the template row) is less important.
But having one config in one place is always better IMO.
| const vm = new VMBuilder() | ||
| .setNamespace(testName) | ||
| .setDescription(`VM from template ${vmt.name}`) | ||
| .setFlavor(flavorConfigs.Tiny) |
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 will still need to know the name of the template to create the VM from
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.
Will check this late.
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.
No need to use template here based on the actual test results.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gouyang The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
frontend/packages/kubevirt-plugin/integration-tests/tests/models/wizard.ts
Show resolved
Hide resolved
| Object.freeze(networkTabCol); | ||
|
|
||
| // Storage | ||
| export enum DISK_SOURCE { |
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 its a good idea maintaining these enum s here...
Every time something changes in src/ and it isn't updated here the tests break.
maybe we can have these enum s declared in src/ and imported from there.
I created a small PR for the disks as an example of what I think should be done: 7d8179c
It might be out of scope for this PR but I think it is worth doing it soon.
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 let's not mix src and tests code right now. This needs a proper discussion and evaluation of pros/cons.
The main issue with this is that the tests should not depend and be bound on the implementation. This can hurt when refactoring things and eg adding i18n.
If you bring bugs into the code it can bring bugs to the tests and it might be hard to discover them. For example we had a discussion about bringing VMWrappers into the tests, but decided against it for this exact reason.
The main hardship is that we are not commiting code with the tests at the same. Once we have the CI, such renaming issue would get picked up immediately and such code would not get merged in the first place. So there is less pressure for sharing the constants IMO.
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.
that's a good point. although I didn't referred to wrappers/classes/interfaces/types but only to enums that have text in the them. Those things can change more rapidly in the code - we can see how many strings had changed in this PR only.
IMO it would be nice to update these text variables in one place.
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 know it would be easier for now to do it like you suggest. But will get harder once you start introducing i18n.
Also, it would start a precedence with sharing the code, which might be confusing for newcomers.
Anyway, we can discuss this in a meeting next week if you want.
0db325b to
afdf8ee
Compare
afdf8ee to
8c3d8c4
Compare
|
@gouyang: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
No description provided.