Skip to content

Conversation

@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 16, 2019
@rhrazdil
Copy link
Author

/assign @bparees

@bparees
Copy link

bparees commented Jul 16, 2019

/unassign
/assign @spadgett

@rhrazdil
Copy link
Author

In reaction to #2051, moving this to WIP, and will move the code to the kubevirt-plugin directory

@rhrazdil rhrazdil changed the title Add VM Wizard test cases for Kubevirt plugin [WIP] Add VM Wizard test cases for Kubevirt plugin Jul 17, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 17, 2019
@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from 77cfd6c to 5359f06 Compare July 17, 2019 11:47
@rhrazdil rhrazdil changed the title [WIP] Add VM Wizard test cases for Kubevirt plugin Add VM Wizard test cases for Kubevirt plugin Jul 17, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 17, 2019
@rhrazdil
Copy link
Author

@yaacov Moved the tests to our kubevirt-plugin package. The last change that is made to openshift core code is in protractor.conf.ts, this can be removed when #2051 it merged.
@vojtechszocs I believe you can review this PR now.

@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from 5359f06 to 918bb3e Compare July 17, 2019 12:14
@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch 5 times, most recently from 8140c57 to c7dd5d7 Compare July 22, 2019 09:50
Copy link
Member

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

@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch 2 times, most recently from 328e164 to f32c3e2 Compare July 22, 2019 11:01
Copy link
Member

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-]')

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from f32c3e2 to 600fe45 Compare July 23, 2019 12:54
@rhrazdil
Copy link
Author

/test e2e-aws-console

'tests/monitoring.scenario.ts',
'tests/crd-extensions.scenario.ts',
]),
kubevirt: [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhrazdil @yaacov @spadgett

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-suite

Also, why not use the suite() function here?

Is it because e.g. kubevirt.login.scenario.ts effectively replaces standard login.scenario.ts?

Copy link
Author

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.

Copy link
Contributor

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.ts adds numerous test cases, that are not relevant to our plugin.

OK, understood, thanks for clarification.

Copy link
Contributor

@vojtechszocs vojtechszocs Aug 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suite is 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',
Copy link
Contributor

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`

Copy link
Member

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 ...

Copy link
Author

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

Copy link
Contributor

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.conf anyway

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) {
Copy link
Contributor

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.

Copy link
Author

@rhrazdil rhrazdil Aug 13, 2019

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

Copy link
Contributor

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';
Copy link
Contributor

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';

Copy link
Member

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.

Copy link
Member

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.

Copy link
Author

@rhrazdil rhrazdil Aug 13, 2019

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?

Copy link
Author

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

Copy link
Contributor

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 */
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from 8a4902b to c14a00c Compare August 13, 2019 13:31
@openshift-ci-robot openshift-ci-robot added the component/shared Related to console-shared label Aug 13, 2019
@yaacov
Copy link
Member

yaacov commented Aug 14, 2019

@rhrazdil @vojtechszocs if #2051 is planed for merge in the same phase as this one, we can revert the parts about making integration-tests a separate monorepo workspace [1] because it will create a conflict with #2051, WDYT ?

[1] #2053

@rhrazdil
Copy link
Author

@yaacov I can revert those changes, so that you don't need to change #2051, since your PR is practically ready, and there may be additional changes in this one.

@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from c14a00c to 52f273b Compare August 14, 2019 08:11
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2019
@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from 52f273b to 536347b Compare August 14, 2019 08:18
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2019
@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from 536347b to 0f0f30e Compare August 19, 2019 12:49
@atiratree
Copy link
Member

This will need quite some changes once we move to the new wizard in the future

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't help

Copy link
Contributor

@vojtechszocs vojtechszocs Aug 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @christianvogt

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'] }],
},

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

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!

Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: please add newline.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Copy link
Contributor

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.)

@rhrazdil rhrazdil force-pushed the console-vmwizard-kubevirt-tests branch from 0f0f30e to 7da161e Compare August 23, 2019 12:17
@rhrazdil
Copy link
Author

/test e2e-aws-console

@vojtechszocs
Copy link
Contributor

@rhrazdil I'll do the proposed ESLint related improvements in a separate PR.

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 23, 2019
@openshift-ci-robot
Copy link
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 23, 2019
@vojtechszocs
Copy link
Contributor

@rhrazdil I'll do the proposed ESLint related improvements in a separate PR.

ESLint changes addressed in #2472.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 800b645 into openshift:master Aug 23, 2019
@spadgett spadgett added this to the v4.2 milestone Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/kubevirt Related to kubevirt-plugin component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants