-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Expose project name as an environment variable #577
Conversation
Codecov Report
@@ Coverage Diff @@
## master #577 +/- ##
==========================================
+ Coverage 72.13% 72.13% +<.01%
==========================================
Files 61 61
Lines 4618 4619 +1
==========================================
+ Hits 3331 3332 +1
Misses 1043 1043
Partials 244 244
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #577 +/- ##
==========================================
+ Coverage 72.13% 72.13% +<.01%
==========================================
Files 61 61
Lines 4618 4619 +1
==========================================
+ Hits 3331 3332 +1
Misses 1043 1043
Partials 244 244
Continue to review full report at Codecov.
|
@@ -87,6 +87,7 @@ func TestRunStepRunner_Run(t *testing.T) { | |||
Workspace: "myworkspace", | |||
RepoRelDir: "mydir", | |||
TerraformVersion: projVersion, | |||
ProjectName: "myproject", |
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.
Because ProjectName
isn't always set, I'd like to test both cases. Can you make ProjectName
part of the cases
anonymous struct:
cases := []struct {
Command string
ProjectName string
ExpOut string
ExpErr string
}{
(you'll also have to move the initialization of ctx
to inside the t.Run()
func)
And then you can test the case when it is and isn't set.
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 fully understand what you're looking for, and I (kind of) managed to implement it as well, but the implementation is not too DRY (two set of cases, two context declarations, and two loops to execute the tests), since my experience of programming, especially in golang, is closer to 0 than 100.
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 fully understand what you're looking for, and I (kind of) managed to implement it as well, but the implementation is not too DRY (two set of cases, two context declarations, and two loops to execute the tests), since my experience of programming, especially in golang, is closer to 0 than 100.
All good, I've made a small change to your work here: #578 and will merge it from there
@@ -58,40 +58,97 @@ func TestRunStepRunner_Run(t *testing.T) { | |||
ExpOut: "user_name=acme-user\n", | |||
}, | |||
} | |||
casesWithProject := []struct { |
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.
combine this with the above cases
list is what I meant.
Closed by #578 |
As requested in #539, this is an attempt to expose the project name as an environment variable.