Skip to content

Conversation

Skarlso
Copy link
Member

@Skarlso Skarlso commented Jul 9, 2018

A little cleanup is necessary but this is a good first start.

Coverage increased to 85.2%. ;) I want to add a little more coverage to the error cases. But I'm sleepy. :)

@Skarlso
Copy link
Member Author

Skarlso commented Jul 9, 2018

Deals with #1

@michelvocks
Copy link
Member

Wow. Thanks a lot! You are crazy 😄

@Skarlso
Copy link
Member Author

Skarlso commented Jul 10, 2018

Alright. As far as it gets. 92.5%. It's done. :)

@Skarlso Skarlso changed the title [WIP][Test] Test coverage in build [Test] Test coverage in build Jul 10, 2018
@Skarlso
Copy link
Member Author

Skarlso commented Jul 10, 2018

Hang on.. I might have another one.

@Skarlso
Copy link
Member Author

Skarlso commented Jul 10, 2018

Yep. Done. :) 96.2%. All important path are covered including build failure. Now it can be refactored.

Copy link
Member

@michelvocks michelvocks left a comment

Choose a reason for hiding this comment

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

Ah sorry @Skarlso. Overlooked your refactoring part 😕
I hope you don't mind my comments.

@@ -18,6 +18,8 @@ const (
srcFolder = "src"
)

var execCommandContext = exec.CommandContext
Copy link
Member

Choose a reason for hiding this comment

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

What is the benefit of storing this as an extra variable?

Copy link
Member Author

@Skarlso Skarlso Jul 11, 2018

Choose a reason for hiding this comment

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

The benefit is being able to mock exec.Command and test things like timeout in context and various exec error conditions later on should they arise. :)

if err != nil {
t.Fatal("error while running executebuild. none was expected")
}
expectedArgs := "-test.run=TestExecCommandContextHelper,--,/usr/local/bin/go,get,-d,./...:-test.run=TestExecCommandContextHelper,--,/usr/local/bin/go,build,-o,_"
Copy link
Member

Choose a reason for hiding this comment

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

If the go binary is not located at /usr/local/bin/ the test will fail.
What do you think about looking up the binary path programmatically? 🤓

Copy link
Member Author

Choose a reason for hiding this comment

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

True. I have to put this into a contains string rather than this. :)

if err == nil {
t.Fatal("error while running executebuild. none was expected")
}
expected := `# _/Users/gbrautigam/gohome/src/github.com/gaia-pipeline/gaia/pipeline/tmp
Copy link
Member

Choose a reason for hiding this comment

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

This works only on your computer 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, wth. I left that in. :/ Bad me. :( Thanks. :)

@Skarlso
Copy link
Member Author

Skarlso commented Jul 11, 2018

@michelvocks Of course not! Please do so if you spot errors. :)

@michelvocks michelvocks merged commit 59bb2bf into gaia-pipeline:master Jul 12, 2018
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