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

Expose project name as an environment variable #577

Merged
merged 2 commits into from
Apr 8, 2019
Merged

Expose project name as an environment variable #577

merged 2 commits into from
Apr 8, 2019

Conversation

nikovirtala
Copy link
Contributor

As requested in #539, this is an attempt to expose the project name as an environment variable.

@codecov
Copy link

codecov bot commented Apr 6, 2019

Codecov Report

Merging #577 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
server/events/runtime/run_step_runner.go 100% <100%> (ø) ⬆️

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 2f54257...6ee1cf6. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 6, 2019

Codecov Report

Merging #577 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
server/events/runtime/run_step_runner.go 100% <100%> (ø) ⬆️

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 2f54257...83c81db. Read the comment docs.

@@ -87,6 +87,7 @@ func TestRunStepRunner_Run(t *testing.T) {
Workspace: "myworkspace",
RepoRelDir: "mydir",
TerraformVersion: projVersion,
ProjectName: "myproject",
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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

server/events/runtime/run_step_runner.go Outdated Show resolved Hide resolved
@@ -58,40 +58,97 @@ func TestRunStepRunner_Run(t *testing.T) {
ExpOut: "user_name=acme-user\n",
},
}
casesWithProject := []struct {
Copy link
Member

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.

@lkysow lkysow merged commit 83c81db into runatlantis:master Apr 8, 2019
@lkysow
Copy link
Member

lkysow commented Apr 8, 2019

Closed by #578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants