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
Create tests for VM dashboard #3951
Conversation
/assign @rhrazdil |
d32bc0d
to
5d9d76c
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.
Only couple nits and small changes
|
||
describe('Test VM dashboard', () => { | ||
const leakedResources = new Set<string>(); | ||
const testVM = getVMManifest('URL', testName, null, 'foo'); |
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:
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); |
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:
we could use createResources([multusNAD, testVM])
createResource(testVM); | ||
addLeakableResource(leakedResources, testVM); | ||
vm = new VirtualMachine(testVM.metadata); | ||
vm.navigateToDashboard(); |
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.
missing await
until.textToBePresentInElement(vmStatus, VM_STATUS.Off), | ||
VM_IMPORT_TIMEOUT_SECS, | ||
); | ||
}); |
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.
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)
5d9d76c
to
5ffc052
Compare
@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( |
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 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
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 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,
);
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.
after discussion with @rhrazdil we opted for using try/catch
5ffc052
to
90fbd50
Compare
/lgtm |
[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 |
/retest Please review the full test history for this PR and help us cut down flakes. |
6 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
No description provided.