-
Notifications
You must be signed in to change notification settings - Fork 244
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
Speeds up integration test for deletion of owned resources #2599
Conversation
e2ea864
to
af23b37
Compare
@@ -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 |
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.
oc is already defined globally. so +1 for removing this.
|
||
JustBeforeEach(func() { | ||
project = helper.CreateRandProject() | ||
originalDir = helper.Getwd() |
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 for removing it because i do not see any use of originalDir
in the test spec
|
||
JustAfterEach(func() { | ||
helper.DeleteProject(project) | ||
helper.Chdir(originalDir) |
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
var oc helper.OcRunner | ||
|
||
JustBeforeEach(func() { | ||
project = helper.CreateRandProject() |
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 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.
tests/integration/component.go
Outdated
@@ -816,18 +816,6 @@ func componentTests(args ...string) { | |||
Context("odo component delete should clean owned resources", func() { | |||
appName := "app" |
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.
Can you please add a dynamic string instead of hardcode to avoid name collision in future. Something like
appName = helper.RandString(5)
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.
@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 Report
@@ 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
Continue to review full report at Codecov.
|
cmpName := "nodejs" | ||
var oc helper.OcRunner | ||
appName := helper.RandString(5) | ||
cmpName := helper.RandString(5) |
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.
Cool!!!
Thanks for making it dynamic
ATM don't believe this report. Will fix this in #2575 |
/lgtm |
/approve |
[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 |
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.