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

Refactor devfile delete tests and add validity checks for delete command #4793

Merged
merged 4 commits into from
Jun 14, 2021

Conversation

valaparthvi
Copy link
Member

What type of PR is this?
/kind cleanup
/kind code-refactoring

What does this PR do / why we need it:

  1. Add validity checks for the delete command as mentioned in issue "odo delete -a" with "--app" & "--project" flags deletes the component under cwd/pwd #4451 (comment)
  2. Add tests for validity checks
  3. Add missing test cases for issue "odo delete -a" with "--app" & "--project" flags deletes the component under cwd/pwd #4451
  4. Refactor tests with the new testbook approach

Which issue(s) this PR fixes:

Fixes #4451

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

  • Update changelog

  • I have read the test guidelines

How to test changes / Special notes to the reviewer:

@valaparthvi
Copy link
Member Author

/test v4.7-integration-e2e

Reason -


: Run multi-stage test integration-e2e - integration-e2e-ipi-deprovision-deprovision container test expand_less | 31m58s
-- | --
DependencyViolation: The dhcpOptions 'dopt-0544ee0ee0b2278c2' has dependencies and cannot be deleted. arn=arn:aws:ec2:us-west-2:460538899914:dhcp-options/dopt-0544ee0ee0b2278c2 level=warning msg=	status code: 400, request id: 4aef4723-323d-4ef0-9787-211c664125ec arn=arn:aws:ec2:us-west-2:460538899914:dhcp-options/dopt-0544ee0ee0b2278c2 level=info msg=Deleted id=sg-06b6d12af801070a9 level=info msg=Deleted id=Z0962381306F5FMSNLEIV record set=A api.ci-op-pwrd3446-89922.origin-ci-int-aws.dev.rhcloud.com. level=info msg=Deleted id=Z0962381306F5FMSNLEIV record set=A \052.apps.ci-op-pwrd3446-89922.origin-ci-int-aws.dev.rhcloud.com. level=info msg=Deleted id=Z0962381306F5FMSNLEIV level=info msg=Deleted id=igw-0e12f384fb74c2924 level=info msg=Released id=eipalloc-0092c7c3b3d1fb6d5 level=info msg=Deleted id=sg-012d00814ecedd613 level=info msg=Deleted NAT gateway=nat-023e177355a8f01d6 id=vpc-0ee31ee0c8abe6e24 level=info msg=Deleted NAT gateway=nat-0542c90c59e82b47b id=vpc-0ee31ee0c8abe6e24 level=info msg=Deleted id=vpc-0ee31ee0c8abe6e24 table=rtb-052c5b2b80f8cec93 level=info msg=Deleted id=vpc-0ee31ee0c8abe6e24 subnet=subnet-06f83c0f22c8e6682 level=info msg=Deleted id=vpc-0ee31ee0c8abe6e24 subnet=subnet-0e3ba88ab9fd0cd05 level=info msg=Deleted id=vpc-0ee31ee0c8abe6e24 level=info msg=Released id=eipalloc-0291e68eafe2e757e level=info msg=Deleted id=ci-op-pwrd3446-89922-cndzg-aext/572a695e5038c3bc level=info msg=Deleted id=dopt-0544ee0ee0b2278c2 level=info msg=Time elapsed: 31m59s {"component":"entrypoint","file":"prow/entrypoint/run.go:252","func":"k8s.io/test-infra/prow/entrypoint.gracefullyTerminate","level":"error","msg":"Process gracefully exited before 10m0s grace period","severity":"error","time":"2021-06-10T17:25:11Z"} {"component":"entrypoint","error":"process timed out","file":"prow/entrypoint/run.go:80","func":"k8s.io/test-infra/prow/entrypoint.Options.Run","level":"error","msg":"Error executing test process","severity":"error","time":"2021-06-10T17:25:11Z"} error: failed to execute wrapped command: exit status 127


commonVar.CliRunner.WaitAndCheckForExistence("deployments", commonVar.Project, 1)
Context("deleting a component from other component directory", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Describe seems more appropriate here

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it alright to nest Describe inside a Context block?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, for me it's alright. Describes explains what we are testing in a high level, Context explains how we are testing it

https://onsi.github.io/ginkgo/#organizing-specs-with-containers-describe-and-context

helper.CmdShouldPass("odo", "push", "--project", commonVar.Project)
})
JustAfterEach(func() {})
Context("delete with --context flag", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this information/Context necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure whether I understand your question correctly, but if what you mean to ask is whether we need a separate ginkgo.Context for this, then I would say yes, because in order to test this command with --context flag correctly, we either need to create /move to a new directory or move out of the component's directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

In line 246, you are using this Context, because you are changing the current directory in JustBeforeEach, which is fine.

But here, there is no JustBeforeEach, so the context would not change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right right, it doesn't make much sense to have that Context. I'll remove it, thanks.

tests/integration/devfile/cmd_devfile_delete_test.go Outdated Show resolved Hide resolved
tests/integration/devfile/cmd_devfile_delete_test.go Outdated Show resolved Hide resolved
@feloy
Copy link
Contributor

feloy commented Jun 11, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jun 11, 2021
@valaparthvi
Copy link
Member Author

/retest

1 similar comment
@valaparthvi
Copy link
Member Author

/retest

@valaparthvi
Copy link
Member Author

/test psi-unit-test-mac

@girishramnani
Copy link
Contributor

/approve

@openshift-ci
Copy link

openshift-ci bot commented Jun 14, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: girishramnani

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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Jun 14, 2021
@openshift-bot
Copy link

/retest

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

2 similar comments
@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@valaparthvi
Copy link
Member Author

/override ci/prow/psi-unit-test-mac
This job has been disabled atm.

@openshift-ci
Copy link

openshift-ci bot commented Jun 14, 2021

@valaparthvi: Overrode contexts on behalf of valaparthvi: ci/prow/psi-unit-test-mac

In response to this:

/override ci/prow/psi-unit-test-mac
This job has been disabled atm.

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.

@openshift-merge-robot openshift-merge-robot merged commit c5728e0 into redhat-developer:main Jun 14, 2021
@rm3l rm3l added the area/refactoring Issues or PRs related to code refactoring label Jun 16, 2023
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. Required by Prow. area/refactoring Issues or PRs related to code refactoring lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"odo delete -a" with "--app" & "--project" flags deletes the component under cwd/pwd
6 participants