Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
snap-exec: update tests to follow main_test pattern #4006
Conversation
mvo5
added some commits
Sep 30, 2017
zyga
approved these changes
Oct 5, 2017
Looks good, some ideas about the test helper functions but not a blocker.
| +func SetOptsCommand(s string) { | ||
| + opts.Command = s | ||
| +} | ||
| +func GetOptsCommand() string { |
| +func SetOptsHook(s string) { | ||
| + opts.Hook = s | ||
| +} | ||
| +func GetOptsHook() string { |
| + // snap/validate.go:appContentWhitelist) | ||
| + tmpArgv := strings.Split(cmdAndArgs, " ") | ||
| + cmd := tmpArgv[0] | ||
| + cmdArgs := expandEnvCmdArgs(tmpArgv[1:], osutil.EnvMap(env)) |
| @@ -45,20 +46,19 @@ var _ = Suite(&snapExecSuite{}) | ||
| func (s *snapExecSuite) SetUpTest(c *C) { | ||
| // clean previous parse runs | ||
| - opts.Command = "" | ||
| - opts.Hook = "" | ||
| + snapExec.SetOptsCommand("") |
zyga
Oct 5, 2017
Contributor
Do you need to undo that anywhere? I don't suppose so (just testing) but perhaps a MockCommandAndHook thing would suffice?
|
The test failure looks real @mvo5
|
mvo5
and others
added some commits
Oct 5, 2017
codecov-io
commented
Oct 9, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #4006 +/- ##
==========================================
+ Coverage 75.71% 75.71% +<.01%
==========================================
Files 429 429
Lines 36709 36709
==========================================
+ Hits 27793 27795 +2
+ Misses 6964 6962 -2
Partials 1952 1952
Continue to review full report at Codecov.
|
|
@mvo5 I fixed the tests failures, I'll let you decide if anything else needs adjustments. |
mvo5 commentedOct 5, 2017
The snap-exec tests were using the same package as the snap-exec
main application. Most other packages in snapd use a $foo, $foo_test
package name pattern. This patch updates the tests to do this now.
Based on #3995 where I noticed that we use the old pattern.