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

Speeds up integration test for deletion of owned resources #2599

Merged
merged 2 commits into from
Mar 20, 2020

Conversation

mik-dass
Copy link
Contributor

@mik-dass mik-dass commented Feb 13, 2020

What type of PR is this?

/kind code-refactoring

What does does this PR do / why we need it:

OC helper decalration is happening twice for the context, so removing it.

Which issue(s) this PR fixes:

Speeds up integration test for deletion of owned resources

How to test changes / Special notes to the reviewer:

odo component delete should clean owned resources integration test should pass.

@@ -816,18 +816,6 @@ func componentTests(args ...string) {
Context("odo component delete should clean owned resources", func() {
appName := "app"
cmpName := "nodejs"
var oc helper.OcRunner
Copy link
Contributor

Choose a reason for hiding this comment

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

oc is already defined globally. so +1 for removing this.


JustBeforeEach(func() {
project = helper.CreateRandProject()
originalDir = helper.Getwd()
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for removing it because i do not see any use of originalDir in the test spec


JustAfterEach(func() {
helper.DeleteProject(project)
helper.Chdir(originalDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

var oc helper.OcRunner

JustBeforeEach(func() {
project = helper.CreateRandProject()
Copy link
Contributor

Choose a reason for hiding this comment

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

The project is being used locally to the spec and moreover there is no such project is created in BeforeEach(func(). So you can not remove it.

@@ -816,18 +816,6 @@ func componentTests(args ...string) {
Context("odo component delete should clean owned resources", func() {
appName := "app"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a dynamic string instead of hardcode to avoid name collision in future. Something like

appName = helper.RandString(5)

@mik-dass mik-dass closed this Feb 13, 2020
@mik-dass mik-dass deleted the fix_own_test branch February 13, 2020 08:36
@mik-dass mik-dass restored the fix_own_test branch February 13, 2020 10:10
@mik-dass mik-dass reopened this Feb 13, 2020
@mik-dass mik-dass changed the title Speeds up integration test for deletion of owned resources [WIP] Speeds up integration test for deletion of owned resources Feb 13, 2020
@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. Required by Prow. label Feb 13, 2020
Copy link
Contributor

@amitkrout amitkrout left a comment

Choose a reason for hiding this comment

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

@mik-dass Can you please replace

appName := "app"
		cmpName := "nodejs"
		var oc helper.OcRunner

		JustBeforeEach(func() {
			project = helper.CreateRandProject()
			originalDir = helper.Getwd()
			oc = helper.NewOcRunner("oc")
		})

		JustAfterEach(func() {
			helper.DeleteProject(project)
			helper.Chdir(originalDir)
		})

with

appName := "app"
		cmpName := "nodejs"

		JustBeforeEach(func() {
			project = helper.CreateRandProject()
		})

		JustAfterEach(func() {
			helper.DeleteProject(project)
		})

Signed-off-by: mik-dass <mrinald7@gmail.com>
@codecov
Copy link

codecov bot commented Mar 20, 2020

Codecov Report

Merging #2599 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2599      +/-   ##
=========================================
- Coverage   43.73%   43.7%   -0.04%     
=========================================
  Files          87      87              
  Lines        8043    8043              
=========================================
- Hits         3518    3515       -3     
- Misses       4176    4179       +3     
  Partials      349     349
Impacted Files Coverage Δ
pkg/component/watch.go 65.33% <0%> (-2%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f940c55...60040a2. Read the comment docs.

@mik-dass mik-dass changed the title [WIP] Speeds up integration test for deletion of owned resources Speeds up integration test for deletion of owned resources Mar 20, 2020
@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. Required by Prow. label Mar 20, 2020
cmpName := "nodejs"
var oc helper.OcRunner
appName := helper.RandString(5)
cmpName := helper.RandString(5)
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!!!
Thanks for making it dynamic

@amitkrout
Copy link
Contributor

Codecov Report

Merging #2599 into master will decrease coverage by 1.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2599      +/-   ##
==========================================
- Coverage   43.73%   42.65%   -1.09%     
==========================================
  Files          87       74      -13     
  Lines        8043     7089     -954     
==========================================
- Hits         3518     3024     -494     
+ Misses       4176     3773     -403     
+ Partials      349      292      -57

Impacted Files Coverage Δ
pkg/devfile/parser/fs.go 0% <0%> (-100%) ⬇️
pkg/kclient/kclient.go 0% <0%> (-26.93%) ⬇️
pkg/storage/storage.go 44.44% <0%> (-5.03%) ⬇️
pkg/occlient/occlient.go 49.48% <0%> (-3.41%) ⬇️
pkg/preference/preference.go 66.35% <0%> (-2.62%) ⬇️
pkg/url/url.go 44.69% <0%> (-1.52%) ⬇️
pkg/devfile/parser/content.go 82.6% <0%> (-0.73%) ⬇️
pkg/component/component.go 24.05% <0%> (-0.25%) ⬇️
pkg/devfile/parse.go 0% <0%> (ø) ⬆️
pkg/testingutil/fileutils.go 0% <0%> (ø) ⬆️
... and 37 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f940c55...88a86e7. Read the comment docs.

ATM don't believe this report. Will fix this in #2575

@amitkrout
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Mar 20, 2020
@kadel
Copy link
Member

kadel commented Mar 20, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kadel

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Mar 20, 2020
@openshift-merge-robot openshift-merge-robot merged commit a2cdfe5 into redhat-developer:master Mar 20, 2020
@mik-dass mik-dass deleted the fix_own_test branch April 13, 2020 07:32
@rm3l rm3l added estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person area/refactoring Issues or PRs related to code refactoring labels Jun 18, 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 estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person 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.

None yet

6 participants