-
Notifications
You must be signed in to change notification settings - Fork 667
Add VM Wizard test cases for Kubevirt plugin #2053
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 VM Wizard test cases for Kubevirt plugin #2053
Conversation
|
/assign @bparees |
|
/unassign |
|
In reaction to #2051, moving this to WIP, and will move the code to the kubevirt-plugin directory |
77cfd6c to
5359f06
Compare
|
@yaacov Moved the tests to our kubevirt-plugin package. The last change that is made to openshift core code is in |
5359f06 to
918bb3e
Compare
8140c57 to
c7dd5d7
Compare
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 looks like lint doesn't like the order here, KubevirtDetailView should be below rowForName:
2478b2f
328e164 to
f32c3e2
Compare
frontend/packages/kubevirt-plugin/integration-tests/tests/utils/consts.ts
Outdated
Show resolved
Hide resolved
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.
newResourceRowInput is also for nic , should it be less specific ?
export const newResourceRowInput = $('[data-id^=create-]')
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.
Fixed
frontend/packages/kubevirt-plugin/integration-tests/views/kubevirtDetailView.view.ts
Outdated
Show resolved
Hide resolved
f32c3e2 to
600fe45
Compare
|
/test e2e-aws-console |
| 'tests/monitoring.scenario.ts', | ||
| 'tests/crd-extensions.scenario.ts', | ||
| ]), | ||
| kubevirt: [ |
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.
Does it make sense to have a convention where the name of test suite corresponds with the name of Console plugin package?
For example, use kubevirt-plugin for package @console/kubevirt-plugin:
'kubevirt-plugin': [ /* test scenarios */ ],This would go well with active plugin resolution mechanism (after we add support for this):
# Active plugin list will be [app, kubevirt-plugin, dev-console]
# List of test suites will be enhanced to [foo, bar, kubevirt-plugin, dev-console]
CONSOLE_PLUGINS=kubevirt-plugin,dev-console yarn run test-suite --suite foo,bar
# Same as above, without specifying non-plugin test suites
CONSOLE_PLUGINS=kubevirt-plugin,dev-console yarn run test-suiteAlso, why not use the suite() function here?
Is it because e.g. kubevirt.login.scenario.ts effectively replaces standard login.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.
Yep, makes sense.
suite is not used because of custom login.
@spadgett already wondered what's the reason behind the custom login scenario.
I added it because at certain point login page of openshift/console and kubevirt/web-ui were different and login.scenario.ts didn't work. That is not an issue now, however, login.scenario.ts adds numerous test cases, that are not relevant to our plugin.
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 is not an issue now, however,
login.scenario.tsadds numerous test cases, that are not relevant to our plugin.
OK, understood, thanks for clarification.
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.
suiteis not used because of custom login.
You could also modify the suite function to support a custom (non-standard) login scenario(s) but this can be done later on.
| 'tests/crd-extensions.scenario.ts', | ||
| ]), | ||
| kubevirt: [ | ||
| '../packages/kubevirt-plugin/integration-tests/tests/kubevirt.login.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.
Nit: I'd extract the path to packages directory:
import * as path from 'path';
const consolePkgRoot = path.resolve(__dirname, '../packages');
`${consolePkgRoot}/kubevirt-plugin/integration-tests/tests/kubevirt.login.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.
p.s. we want to move all this tests to the plugin dir using #2051 , so the links will 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.
@vojtechszocs Yeah, the path looks bad, I can do this. But with #2051, we will remove kubevirt suite from protractor.conf anyway
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.
p.s. we want to move all this tests to the plugin dir using #2051 , so the links will change ...
Yes, they will change in future 😃 once #2051 is merged, we should start moving all integration tests (including the non-plugin ones) into appropriate monorepo packages.
@vojtechszocs Yeah, the path looks bad, I can do this. But with #2051, we will remove kubevirt suite from
protractor.confanyway
Agreed, let's keep the change minimal for now. #2051 will change this anyway.
| describe('Authentication', () => { | ||
| it('Web console logs in.', async () => { | ||
| await browser.get(appHost); | ||
| if (process.env.BRIDGE_BASE_ADDRESS !== undefined) { |
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 could replace if condition with:
expect(process.env.BRIDGE_BASE_ADDRESS).toBeDefined();to enforce our expectation.
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.
Actually, we use this variable to distinguish between execution against cluster UI and local bridge. If BRIDGE_BASE_ADDRESS is undefined, we assume running against localhost, which doesn't require logging in
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.
Understood, thanks for clarification.
| @@ -0,0 +1,18 @@ | |||
| import { execSync } from 'child_process'; | |||
| import { browser } from 'protractor'; | |||
| import { appHost } from '../../../../integration-tests/protractor.conf'; | |||
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 avoid relative paths that point outside the monorepo. Let's do two things here:
1, add integration-tests/package.json
{
"name": "@console/integration-tests",
"version": "0.0.0-fixed",
"description": "Console integration tests to be moved into appropriate packages",
"private": true
}2, update root package.json & run yarn to update symlinks in node_modules
"workspaces": [
"packages/*",
"public",
"integration-tests"
],3, update all imports in plugin packages
-import { appHost } from '../../../../integration-tests/protractor.conf';
+import { appHost } from '@console/integration-tests/protractor.conf';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 do it in #2051 , see comment about links.
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 use @console/internal-integration-tests ?
Ref: https://github.com/openshift/console/pull/2051/files#r313030053
p.s.
if changing here, this should be changed in all relevant places.
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. Kobi told me about this comment: #2051 (comment)
Is it relevant for this PR? Should I try to incorporated 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.
@vojtechszocs So I added this change and then removed it to not create conflict with Kobi's PR #2051
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 can do it in Kobi's PR #2051.
| @@ -0,0 +1,195 @@ | |||
| /* eslint-disable no-await-in-loop, no-console, no-underscore-dangle */ | |||
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 (and other utils if appropriate) could be moved under packages/console-shared/src/test-utils.
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.
8a4902b to
c14a00c
Compare
|
@rhrazdil @vojtechszocs if #2051 is planed for merge in the same phase as this one, we can revert the parts about making [1] #2053 |
c14a00c to
52f273b
Compare
52f273b to
536347b
Compare
536347b to
0f0f30e
Compare
|
This will need quite some changes once we move to the new wizard in the future |
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 the runtime for this code is Node.js (i.e. Protractor or Jest) then you can simply add
/* eslint-env node */at the top of the file.
By doing that, the above rule disable list might not be necessary.
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.
didn't help
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 add frontend/packages/kubevirt-plugin/integration-tests/.eslintrc.js
module.exports = {
root: true,
extends: [
'plugin:console/base',
'plugin:console/typescript',
'plugin:console/node',
'plugin:console/prettier',
],
};The root: true option is used to override the parent cross-package packages/.eslintrc.js.
Ideally, we shouldn't repeat those /* eslint-disable ... */ comments in multiple files.
Instead, simply edit the closest .eslintrc.js file in hierarchy and update it like
rules: {
'no-unused-vars': 'off',
'no-console': ['error', { allow: ['warn', 'error', 'log', 'info'] }],
},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 can disable or tweak no-await-in-loop (and other rules too) in the appropriate .eslintrc.js file.
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.
Just a reminder that Console acronym naming convention is to use uppercase, e.g. getAttachedNICs.
In context of KubeVirt plugin package, we should pick one convention and stick with it consistently.
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.
Fixed.
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 really like the way how we express the logical operations here. It's highly readable and clean!
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 will probably change in future due to VM wizard changes made by @suomiy.
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, I expect I'll have to refactor.
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 use CamelCase when declaring types, i.e. ProvisionOption.
(Also in other files, if relevant.)
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.
Fixed.
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.
Nit: please add newline.
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.
Added.
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.
Using ESDoc @param tag properly, great to see this! 😃
(In existing code, most @param tags are auto-generated stubs with no added value.)
0f0f30e to
7da161e
Compare
|
/test e2e-aws-console |
|
@rhrazdil I'll do the proposed ESLint related improvements in a separate PR. /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhrazdil, suomiy, vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds 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. |
1 similar comment
|
/retest Please review the full test history for this PR and help us cut down flakes. |
Adding test cases for working with VM Wizard in Kubevirt plugin to openshift console.
Added Tests:
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-771
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-869
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-870
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-2446
https://polarion.engineering.redhat.com/polarion/redirect/project/CNV/workitem?id=CNV-2447
Tests are organized under {tests,views}/kubevirt/* directory, executed with kubevirt test suite.