-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add test for github.com special handling #390
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
Add test for github.com special handling #390
Conversation
94f3031 to
586d77c
Compare
cli/command/image/build_test.go
Outdated
| os.Chdir(tmpDir) | ||
| os.MkdirAll(filepath.Join(tmpDir, "github.com/docker/no-such-repository"), 0777) | ||
| err = cmd.Execute() | ||
| assert.Contains(t, err.Error(), "unable to prepare context: unable to evaluate symlinks in Dockerfile path:") |
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.
Since the expectation here is "does build from local directory" maybe this would be more clear by adding a simple Dockerfile to the directory and checking for no error?
This error could easily change and fail the test, but that doesn't necessary mean the test is broken.
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.
Agreed, I'll look into that
cli/command/image/build_test.go
Outdated
| // TestRunBuildFromLocalGitHubDirNonExistingRepo tests that build contexts | ||
| // starting with `github.com/` are special-cased, and the build command attempts | ||
| // to clone the remote repo, however a local directory should take precedence. | ||
| func TestRunBuildFromLocalGitHubDirNonExistingRepo(t *testing.T) { |
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 think this should be split into two test cases
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.
Was doubting; in a single test, it more "proves" that without local directory it does X, and with it does Y, but guess it doesn't matter if split; will update
586d77c to
1d5cdf9
Compare
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1d5cdf9 to
f007d62
Compare
Codecov Report
@@ Coverage Diff @@
## master #390 +/- ##
==========================================
+ Coverage 46.26% 46.61% +0.34%
==========================================
Files 193 193
Lines 16093 16093
==========================================
+ Hits 7445 7501 +56
+ Misses 8259 8203 -56
Partials 389 389 |
dnephin
left a comment
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.
LGTM
|
ping @vdemeester PTAL 😅 |
vdemeester
left a comment
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.
LGTM 🐸
@thaJeztah one thing we should try to handle though is that, as of now, those tests might fail if there is no network (as it might fail with a different error)
|
@vdemeester good call; do we have a |
Found this code still lingering around on my computer 😄
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)

(image taken from https://sustainableutah.files.wordpress.com/2015/03/pika-pixdaus.jpg)