Skip to content
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

Create tests for VM dashboard #3951

Merged

Conversation

rawagner
Copy link
Contributor

No description provided.

@rawagner
Copy link
Contributor Author

/assign @rhrazdil

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. component/kubevirt Related to kubevirt-plugin labels Jan 14, 2020
@rawagner rawagner force-pushed the kubevirt_dashboard_tests branch 2 times, most recently from d32bc0d to 5d9d76c Compare January 14, 2020 13:12
Copy link

@rhrazdil rhrazdil left a comment

Choose a reason for hiding this comment

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

Only couple nits and small changes


describe('Test VM dashboard', () => {
const leakedResources = new Set<string>();
const testVM = getVMManifest('URL', testName, null, 'foo');

Choose a reason for hiding this comment

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

Nit:
Unless vm name matters, you don't need to specify one and get a generated name
const testVM = getVMManifest('URL', testName);
It's then not necessary to set the testVM.metadata.name on line 43

});

beforeAll(async () => {
createResource(multusNAD);

Choose a reason for hiding this comment

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

Nit:
we could use createResources([multusNAD, testVM])

createResource(testVM);
addLeakableResource(leakedResources, testVM);
vm = new VirtualMachine(testVM.metadata);
vm.navigateToDashboard();

Choose a reason for hiding this comment

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

missing await

until.textToBePresentInElement(vmStatus, VM_STATUS.Off),
VM_IMPORT_TIMEOUT_SECS,
);
});

Choose a reason for hiding this comment

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

Since we're waiting for the VM import it may be better to pass the timeout to this beforeAll as the default timeout for the whole spec is only 40 seconds.
It can be changed by passing 2nd parameter.
beforeAll(functionBody, VM_IMPORT_TIMEOUT_SECS)

@rawagner
Copy link
Contributor Author

@rhrazdil thanks for the review! I've addressed all your comments, please take a look again

addLeakableResource(leakedResources, testVM);
vm = new VirtualMachine(testVM.metadata);
await vm.navigateToDashboard();
await browser.wait(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a way to make this condition optional ? meaning if this fails, than continue and do not fail the suite ? In some environments, the import can be so fast that we wont see the transition between Off -> Importing statuses

Choose a reason for hiding this comment

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

You can use until.or and specify multiple conditions. Take a look at this sample. It first waits for Importing || Off and then for Off, meaning if the VM is being imported first, it will wait at the first wait with adequate timeout. When that finishes, the second wait will block only for a brief moment since the VM should be in Off already.

await browser.wait(
  until.or(
    until.textToBePresentInElement(
      vmView.vmDetailStatus(this.namespace, this.name),
      VM_STATUS.Importing,
    ),
    until.textToBePresentInElement(
      vmView.vmDetailStatus(this.namespace, this.name),
      VM_STATUS.Off,
    ),
  ),
  VM_IMPORT_TIMEOUT,
);
await this.waitForStatus(
  VM_STATUS.Off,
  PAGE_LOAD_TIMEOUT_SECS,
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

after discussion with @rhrazdil we opted for using try/catch

@rhrazdil
Copy link

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 15, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rawagner, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

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

6 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@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 78b2e5c into openshift:master Jan 15, 2020
@spadgett spadgett added this to the v4.4 milestone Jan 17, 2020
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 lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants