Commit graph

211 commits

Author SHA1 Message Date
Alexander Morozov
4ba1128c18 Merge pull request #10871 from ahmetalpbalkan/win-cli/TestBuildAddBadLinks-fix
integ-cli: Fix TestBuildAddBadLinks for windows
2015-02-20 17:27:36 -08:00
Ahmet Alp Balkan
d0dc14e5d6 integ-cli: Fix TestBuildAddBadLinks for windows
TestBuildAddBadLinks used to build a path by
concenating unix-style forward slashes. Fixed that
by providing a windows-equivalent using `runtime.GOOS`.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-20 13:24:59 -08:00
Ahmet Alp Balkan
4581240e58 integration-cli: pass platform-compatible paths to os.Symlink
Although this doesn't fix the test (os.Symlink is not yet
implemented for Windows), this prevents unix-style paths
from being passed to os.Symlink. Also makes code cleaner
for linux.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-20 12:25:10 -08:00
Jessie Frazelle
695bf3348f Merge pull request #10913 from ahmetalpbalkan/win-cli/UnixSpecific-skip
integ-cli: Skip some unix-specific cli tests
2015-02-20 10:33:28 -08:00
Ahmet Alp Balkan
492a58f05f integ-cli: Skip some unix-specific cli tests
Skipping some of the tests closely tied to running in a
unix environment. Windows does not support chmod/chown
and this causes some tests to fail creating desired
behavior.

- `TestBuildWithInaccessibleFilesInContext`: uses chown/chmod
- `TestBuildDockerfileOutsideContext`: uses os.Symlink, not implemented on
  windows
- `TestCpUnprivilegedUser`: uses chmod, and requires 'unprivilegeduser'
  created by Dockerfile (and thus requires to run inside container)
- `TestBuildChownSingleFile`: uses chown

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-20 09:51:10 -08:00
kargakis
6ecf23861e Map Commands instead of using them as a slice
The most obvious use case is when one wants to make sure as fast
as possible that a command is a valid Dockerfile command.

Signed-off-by: kargakis <kargakis@users.noreply.github.com>
2015-02-20 15:56:21 +01:00
Ahmet Alp Balkan
967d85a28f integ-cli: Fix path problems in TestBuildRenamedDockerfile
`TestBuildRenamedDockerfile` tests hard-code unix-style
path building. Made use of `path/filepath` to make these
tests work on Windows as well.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-19 14:45:26 -08:00
Jessie Frazelle
7829e7b40f Merge pull request #10555 from duglin/MoreRenamedDockerfileTests
Add more tests around using -f Dockerfile via the CLI
2015-02-19 13:59:35 -08:00
Doug Davis
c42d2625d1 Add more tests around using -f Dockerfile via the CLI
Mainly to make sure we don't treat the -f value as relative to the
root of the build context, but instead it must be relative to the current
dir.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-18 14:06:58 -08:00
Jason Sommer
0826ac1581 Fixed relative filepath check
Signed-off-by: Jason Sommer <jsdirv@gmail.com>
2015-02-16 20:38:52 -06:00
Ahmet Alp Balkan
2f53820ce4 TestBuildAddTarXz: xz with '-k' due to msys bug
TestBuildAddTarXz/TestBuildAddTarXzGz make exec calls like
'cd %SOME_TEMP_DIR%; xz test.gz' but this fails when called
from integration-cli tests (doesn't fail from msys or cmd shell).

It fails with error: "xz: test.tar: Cannot remove: Permission denied."
Proposing workaround of using the `xz --keep` argument since keeping
test.tar is harmless and it's already in os.TempDir().

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-12 15:42:27 -08:00
Ahmet Alp Balkan
ccde3a1f73 Create builder/command, cut libcontainer dependency on integration-cli
d1e9d07c introduces a dependency to libcontainer and other daemon
related packages through builder package. The only thing test needs
is set of the Dockerfile commands. Extracting them to a separate
package.

This was causing CI tests to not to compile on non-Linux platforms.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-11 21:44:31 -08:00
Doug Davis
1654dfdf14 Show err msg on empty 'scratch' Dockerfile
If you have a Dockefile with just:
   FROM scratch

An error is generated but its never shown to the CLI. This PR fixes that.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-10 11:43:45 -08:00
Alexander Morozov
d14751bf30 Merge pull request #10671 from tiborvass/remove-fail-word-from-tests
Remove word "fail" from tests
2015-02-09 20:53:15 -08:00
Tibor Vass
aadb6289cc Remove word "fail" from tests
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-02-09 18:01:52 -05:00
Doug Davis
d1e9d07c1b Get list of Dockerfile cmds from builder so we can be smarted in our tests
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-08 08:09:02 -08:00
Doug Davis
e4f02abb51 Add support for no-arg commands in Dockerfile
We're hoping to add some new commands that don't have any args so this
PR will enable that by removing all of the hard-coded checks that require
commands to have at least one arg.  It also adds some checks to each
command so we're consistent in the error message we get.  Added a test
for this too.

We actually had this check in at least 3 different places (twice in the
parser and once in most cmds), this removes 2 of them (the parser ones).

Had to remove/modify some testcases because its now legal to have certain
commands w/o args - e.g. RUN. This was actually inconsistent because
we used to allow "RUN []" but not "RUN" even though they would generate
(almost) the same net result.  Now we're consistent.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-08 03:36:49 -08:00
Alexander Morozov
f208201375 Merge pull request #10607 from chenhanxiao/enable-upper-proto
nat: enable upper case proto
2015-02-07 16:56:35 -08:00
Chen Hanxiao
0552f1a0ca docker_cli_build_test: add testcase of EXPOSE 5678/UDP
test whether we could use upper case proto in EXPOSE

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2015-02-08 07:04:22 +08:00
André Martins
ab4bc988bc Fixed one small typo of docker_cli_build_test.go
Signed-off-by: André Martins <martins@noironetworks.com>
2015-02-07 15:37:58 +00:00
Brian Goff
c73e3bf4dc Error out if file in container at volume path
Fixes #4393

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-02-06 18:00:00 -05:00
Doug Davis
3859c48531 Remove leading/trailing spaces in builder/parser
Per Erikh's suggestion at:
https://github.com/docker/docker/pull/9989#issuecomment-69832009
this PR will trim spaces in the parser to ensure that the user gets the same
results irrespetive of leading/trailing spaces.

Per @tiborvass's suggestion I added a test to make sure spaces in quotes
are not touched.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-02-06 08:52:18 -08:00
Tibor Vass
73d5baf585 builder: prevent Dockerfile to leave build context
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2015-02-02 23:40:24 -08:00
Tibor Vass
70fbd45a5c Merge pull request #10123 from duglin/Issue10097
Build CMD/ENTRYPOINT cache strings properly
2015-01-28 14:43:16 -05:00
Tianon Gravi
142369456d Update TestBuildWithTabs to allow for the "\t"-equivalent "\u0009" (for Go 1.3 support)
This is literally the only failing test on Go 1.3.3: 🎉
```
--- FAIL: TestBuildWithTabs (0.43 seconds)
	docker_cli_build_test.go:4307: Missing tabs.
		Got:["/bin/sh","-c","echo\u0009one\u0009\u0009two"]
		Exp:["/bin/sh","-c","echo\tone\t\ttwo"]
```

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2015-01-20 12:11:59 -07:00
Tibor Vass
50ff27caa1 Merge pull request #9826 from icecrime/8318_whitespace_add_copy
Support whitespace in paths for ADD and COPY
2015-01-19 18:37:53 -05:00
Doug Davis
88905793ad Build CMD/ENTRYPOINT cache strings properly
Make sure that as we build the CMD/ENTRYPOINT cache strings that we don't
treat ["echo","hi"] and ["echo hi"] as the same thing due to the fact that
we're just doing a strcat on the array.

Closes #10097

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-15 12:49:30 -08:00
Erik Hollensbe
39343b8618 Fix a panic where RUN [] would be supplied.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2015-01-14 16:55:56 -08:00
Arnaud Porterie
cf455017e0 Support whitespaces in ADD and COPY continued
Add tests and documentation for this new feature.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-01-13 11:34:15 -08:00
Alexander Morozov
99a15ec8bd Merge pull request #9973 from duglin/Issue9880
Make sure that ADD/COPY still populate the cache even if they don't use it
2015-01-13 11:17:34 -08:00
Doug Davis
32cde64c04 Merge pull request #9980 from erikh/parser-with-no-command
Fix a parser error where an empty RUN statement would cause a panic
2015-01-08 19:34:06 -05:00
Don Kjer
568f86eb18 Deprecating ResolveRepositoryName
Passing RepositoryInfo to ResolveAuthConfig, pullRepository, and pushRepository

Moving --registry-mirror configuration to registry config

Created resolve_repository job

Repo names with 'index.docker.io' or 'docker.io' are now synonymous with omitting an index name.

Adding test for RepositoryInfo

Adding tests for opts.StringSetOpts and registry.ValidateMirror

Fixing search term use of repoInfo

Adding integration tests for registry mirror configuration

Normalizing LookupImage image name to match LocalName parsing rules

Normalizing repository LocalName to avoid multiple references to an official image

Removing errorOut use in tests

Removing TODO comment

gofmt changes

golint comments cleanup.  renaming RegistryOptions => registry.Options, and RegistryServiceConfig => registry.ServiceConfig

Splitting out builtins.Registry and registry.NewService calls

Stray whitespace cleanup

Moving integration tests for Mirrors and InsecureRegistries into TestNewIndexInfo unit test

Factoring out ValidateRepositoryName from NewRepositoryInfo

Removing unused IndexServerURL

Allowing json marshaling of ServiceConfig.  Exposing ServiceConfig in /info

Switching to CamelCase for json marshaling

PR cleanup; removing 'Is' prefix from boolean members.  Removing unneeded json tags.

Removing non-cleanup related fix for 'localhost:[port]' in splitReposName

Merge fixes for gh9735

Fixing integration test

Reapplying #9754

Adding comment on config.IndexConfigs use from isSecureIndex

Remove unused error return value from isSecureIndex

Signed-off-by: Don Kjer <don.kjer@gmail.com>

Adding back comment in isSecureIndex

Signed-off-by: Don Kjer <don.kjer@gmail.com>
2015-01-08 20:14:58 +00:00
Erik Hollensbe
09e3467452 Fix a parser error where an empty RUN statement would cause a panic
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2015-01-08 11:30:08 -08:00
Doug Davis
6f20b957b0 Make sure that ADD/COPY still populate the cache even if they don't use it
Closes #9880

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-08 06:56:30 -08:00
Doug Davis
eb3ea3b43c Allow for Dockerfile to be named something else.
Add a check to make sure Dockerfile is in the build context
Add docs and a testcase
Make -f relative to current dir, not build context

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-06 16:33:26 -08:00
Doug Davis
6d801a3caa Have .dockerignore support Dockerfile/.dockerignore
If .dockerignore mentions either then the client will send them to the
daemon but the daemon will erase them after the Dockerfile has been parsed
to simulate them never being sent in the first place.

an events test kept failing for me so I tried to fix that too

Closes #8330

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-06 10:57:48 -08:00
Jessica Frazelle
367e66e972 Change url of robots.txt test to dockerproject.com
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2015-01-05 11:13:37 -08:00
Seongyeol Lim
abfb713887 Add support file name with whitespace for ADD and COPY command
Closes #8318

Signed-off-by: Seongyeol Lim <seongyeol37@gmail.com>
2014-12-26 16:28:03 -08:00
Alexander Morozov
a31c14cadc Fix TestBuildWithTabs for go 1.4
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2014-12-21 13:49:45 +02:00
Doug Davis
f21f9f856e Allow for relative paths on ADD/COPY
Moved Tianon's PR from: https://github.com/docker/docker/pull/7870
on top of the latest code

Closes: #3936

Signed-off-by: Andrew Page <admwiggin@gmail.com>
Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-12-18 05:13:04 -08:00
Michael Crosby
17cacf3326 Merge pull request #9643 from LK4D4/fix_vet_errors
Fix vet errors
2014-12-16 12:04:15 -08:00
Michael Crosby
eea9f0e781 Merge pull request #9610 from duglin/Issue9602
Wrap strings that could look like ints in quotes
2014-12-16 12:02:26 -08:00
Arnaud Porterie
a76f7c6ec3 Merge pull request #9122 from dqminh/debug-huge-expose
Expose a large number of ports should not slow down builder
2014-12-16 10:03:31 -08:00
Doug Davis
d942c59b69 Wrap strings that could look like ints in quotes
When we use the engine/env object we can run into a situation where
a string is passed in as the value but later on when we json serialize
the name/value pairs, because the string is made up of just numbers
it appears as an integer and not a string - meaning no quotes.  This
can cause parsing issues for clients.

I tried to find all spots where we call env.Set() and the type of the
name being set might end up having a value that could look like an int
(like author). In those cases I switched it to use env.SetJson() instead
because that will wrap it in quotes.

One interesting thing to note about the testcase that I modified is that
the escaped quotes should have been there all along and we were incorrectly
letting it thru. If you look at the metadata stored for that resource you
can see the quotes were escaped and we lost them during the serialization
steps because of the env.Set() stuff.  The use of env is probably not the
best way to do all of this.

Closes: #9602

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-12-15 05:10:49 -08:00
Michael Crosby
4856ec0754 Add test to enforce volume build content
This tests ensures that the content from a dir within a build is carried
over even if VOLUME for that dir is specified in the Dockerfile.  This
test ensures this long standing functionality.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-12 11:15:31 -08:00
Alexander Morozov
a7ae7fed73 Fix vet errors about formatting directives
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2014-12-12 10:58:56 -08:00
Arnaud Porterie
af2021955c Add integration test for xz path issue
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>

Conflicts:
	integration-cli/docker_cli_build_test.go
2014-12-11 16:29:15 -05:00
Cristian Staretu
e4ba82d50e Add build tests covering extraction in chroot
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-11 16:26:52 -05:00
unclejack
a57eee2229 integ-cli: add test for links in volumes
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-11 16:26:52 -05:00
unclejack
7496cbbccc integ-cli: add build test for absolute symlink
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2014-12-11 16:26:52 -05:00