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
Bug 1861957: Overhaul kubevirt plugin tests #6152
Conversation
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. 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. |
will rebase on #6132. |
@@ -46,6 +48,8 @@ export function removeLeakableResource(leakedResources: Set<string>, resource) { | |||
} | |||
|
|||
export function createResource(resource) { | |||
// ensure not return error even the source is existed by deleting it before adding 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.
where is this necessary?
IMO we should have a specific method for this like recreate
so the use case would be apparent by looking at the name.
We should not use this in places where it isn't necessary, so it would not hide bugs 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.
I've seen some tests failed because of existed resource when I run tests locally, I was think it would be safe to make sure they're not returning error as they're used in setup/teardown.
I don't want to introduce recreate
as they're not on the same purpose. I can revert this.
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.
they are not, but we could have both createResource and reCreateResource
ok, let's revert if you are not seeing this anymore. If you think it is necessary in some case, I would vote for having already mentioned functions and using it just in place where it is needed.
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 about add a check via kubectl get
, if the resource is existing, do nothing. Then it doesn't throw error.
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.
could we use kubectl apply for this instead?
again, can we still make a 2nd method for that and use applyResource in places where this is needed?
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.
Are you meaning to use kubectl create
for createResource and use kubectl apply
for applyResource?
I changed it to kubectl apply
in createResource.
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, IMO it would be nicer to have both createResource and applyResource and use them accordingly
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 applyResource, I will use it accordingly in future based on test experience.
@@ -56,7 +60,7 @@ export function createResources(resources) { | |||
export function deleteResource(resource) { | |||
const kind = resource.kind === 'NetworkAttachmentDefinition' ? 'net-attach-def' : resource.kind; | |||
execSync( | |||
`kubectl delete -n ${resource.metadata.namespace} --cascade ${kind} ${resource.metadata.name}`, | |||
`kubectl delete --ignore-not-found=true -n ${resource.metadata.namespace} --cascade ${kind} ${resource.metadata.name}`, |
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 same. Where is this used?
we could also pass an additional argument for this if needed
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 resource is not created successfully, the test is failed earlier and will have an error in tear down step in deleteResource
. This is trying to make it not throwing error, as it seems always been used in tear down step.
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, can we at least add the additional optional argument ignoreNotFound ?
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 additional optional argument ignoreNotFound
with default value true
because it's used in tear down, in case it's called somewhere else, it can specify it to false
.
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.
+1
frontend/packages/kubevirt-plugin/integration-tests/tests/mocks/vmBuilderPresets.ts
Outdated
Show resolved
Hide resolved
frontend/packages/kubevirt-plugin/integration-tests/tests/mocks/vmBuilderPresets.ts
Outdated
Show resolved
Hide resolved
frontend/packages/kubevirt-plugin/integration-tests/tests/vm.action.base.scenario.ts
Show resolved
Hide resolved
frontend/packages/kubevirt-plugin/integration-tests/tests/vm.tab.console.rdp.scenario.ts
Show resolved
Hide resolved
frontend/packages/kubevirt-plugin/integration-tests/tests/vm.tab.dashboard.scenario.ts
Show resolved
Hide resolved
@@ -46,6 +48,8 @@ export function removeLeakableResource(leakedResources: Set<string>, resource) { | |||
} | |||
|
|||
export function createResource(resource) { | |||
// ensure not return error even the source is existed by deleting it before adding 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.
they are not, but we could have both createResource and reCreateResource
ok, let's revert if you are not seeing this anymore. If you think it is necessary in some case, I would vote for having already mentioned functions and using it just in place where it is needed.
frontend/packages/kubevirt-plugin/integration-tests/tests/vm.tab.console.rdp.scenario.ts
Show resolved
Hide resolved
frontend/packages/kubevirt-plugin/integration-tests/tests/vm.tab.dashboard.scenario.ts
Show resolved
Hide resolved
frontend/packages/kubevirt-plugin/integration-tests/tests/vm.tab.console.rdp.scenario.ts
Show resolved
Hide resolved
f223b49
to
a162f5a
Compare
); | ||
if (ignoreNotFound) { | ||
execSync( | ||
`kubectl delete --ignore-not-found=true -n ${resource.metadata.namespace} --cascade ${kind} ${resource.metadata.name}`, |
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.
`kubectl delete --ignore-not-found=true -n ${resource.metadata.namespace} --cascade ${kind} ${resource.metadata.name}`, | |
`kubectl delete --ignore-not-found=${ignoreNotFound} -n ${resource.metadata.namespace} --cascade ${kind} ${resource.metadata.name}`, |
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 seems better to don't add if esle
in this way, changed to use --ignore-not-found=${ignoreNotFound}
and not use if else
.
04cee14
to
da6dba6
Compare
/approve |
/ok-to-test |
@rawagner could you take a look? |
@gouyang: An error was encountered adding this pull request to the external tracker bugs for bug 1861957 on the Bugzilla server at https://bugzilla.redhat.com:
In 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. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gouyang, rawagner, suomiy 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 |
@gouyang: All pull requests linked via external trackers have merged: openshift/console#6152. Bugzilla bug 1861957 has been moved to the MODIFIED state. In 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. |
Overhaul failure tests, verified here: https://cnv-qe-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/test-kubevirt-console-4.5-cnv-2.4-prod-gouyang/5/testReport/.
Note:
The verify job is running against http://0.0.0.0:9000/ which has login disabled, so non-admin test is failed.
If run non-admin test against https://console-openshift-console.apps.gouyang0727.cnv-qe.rhcloud.com/, it's PASS.