Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.
Change-Id: I0dfc37bd9aad42914e1cd4b2bfadb71358d62bf4
Closes-bug: #1280522
With the -D flag present, the only extra output is of type:
time="2015-12-17T10:50:24+01:00" level=debug msg="framesize: 74"
between every single STDOUT line. This shouldn't be needed, as you would
expect the debug flag to influence dox things, not Docker
Change-Id: I224c9e13f5f2a0775afb0ca5f74dd7abf69adc45
Newer docker versions don't allow images' names starting with `_`. This
patch removes the `_` prefix from the code.
Change-Id: Ibbc82f0c8c86c149835f66f84f1664b347ae76c1
When running dox with an user_map check whether the user is root and
skip the useradd command on image build if so. Most (all?) images have a
root user anyway.
Change-Id: I08eb60254fb437e02c61025d0a7761eb774c11f3
Instead of:
ERROR|dox.cmd|Operation failed, aborting dox.
we get:
ERROR|dox.cmd|Operation failed, aborting dox.
Traceback (most recent call last):
File "/Users/marca/dev/git-repos/dox/dox/cmd.py", line 99, in run_dox
map(run, images)
File "/Users/marca/dev/git-repos/dox/dox/runner.py", line 209, in run
self.build_test_image(image, command)
File "/Users/marca/dev/git-repos/dox/dox/runner.py", line 157, in build_test_image
shutil.copy(add_file, os.path.join(tempd, add_file))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy
copyfile(src, dst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: 'tests_require.txt'
Change-Id: Icdb25ae2c2f06ffab416d215a7f8b360f9b65c1e
Image name were named exactly the same no matter which
environement/section we were running.
We now have :
_dox/$project_name_$environment_(base|test)
as image name, the _dox and not dox is cause docker wants a namespace
with at least three chars.
Change-Id: I3ea05c0907fb911aaca96a18215c5a44ce2a6ebc
Allow section to have parent like tox.ini, i.e:
foo:
images:
- image1
foo:bar:
commands:
- blah
would have foo:bar getting the image image1 since dependent of foo
Change-Id: I613db9ed9ac16c978ef8a42a604992ce2205bc08
Try to mimics tox by default with allowing things like :
-e section1,section2
Change-Id: Iab98667c5d26aa80fe31227ded9d21983eb7d7eb
TODO: if none was specified run all targets not the default ones
Try to emulate tox -e type of target/environment.
This works natively in tox.ini as long we have commands to run there
(doesn't support inheritance).
For dox.yml the format has been improved, the format looks now like this :
target1:
images:
commands:
add:
prep:
target2:
images:
commands:
add:
prep:
we still support old format with single target.
Follow up patches in this series improve this implementation.
Change-Id: I2a30aaa63fd4e47fd76f29ed5e5cb025ca326016
For some reasons why but os.getlogin() is broken on containers :
http://stackoverflow.com/questions/4399617/python-os-getlogin-problem
when a user is not controlling the terminal.
Let's use instead pwd.getpwuid instead of os.getlogin which would work
in any cases, and would make the function safer to run under containers.
Change-Id: I0cc62e3d13b0e89a0ea1c166ea3ac06cfcc931b3
The docker -v command takes the directory structure where the
docker itself is running. So when using with osx using boot2docker
or just a ubuntu with docker, we need to use say sshfs or virtual
box additions to first make the osx file system available on the
operating system where docker is running (vm in boot2docker). Then
we need to be able to specify how the osx directory maps to the
directory on the vm using the new --path-map parameter.
Change-Id: I8543c94accf5e809323f0f348e9729e32d942b80
Adds -k/--keep options to allow the user to keep the test container
around instead of deleting it after the given command completes.
Change-Id: If7063c1a93436f4b477adb9b2c869d4cd027205a
the ini.get() thing is weird between python2 and python3 but it seems
that the fourth argument is unnecessary and not implemented in py3
anyway.
Change-Id: Ic42c3ca144ee9dd1aab372bc7d70bdca34cb7a93
This changes the 'commands' YAML portion to be an array. E.g.:
commands:
- ls
- ps
- echo 'Have you tried turning it off and on again?'
Docker doesn't really support issuing multiple commands to a container
on the command line very well. You have to either munge it with something
like:
sh -c 'ls && ps'
or place all of the commands to execute into a master script, then execute
that script.
This change proposes the second option and creates a master script if the
number of commands is more than one.
The master script file will be created in a .dox subdirectory of the
current directory, and named master_script.sh. Right now, it is created
as a Bourne shell script. We could easily add support later for different
shells.
If the -c option is used, then the command specified is the only command
that will run.
If -c is NOT used, but extra arguments are supplied, these extra arguments
will be used to replace the {posargs} placeholders in tox.ini files. The
extra args are not currently used elsewhere.
This change REMOVES the ability to add extra_args to the end of the
command when {posargs} is NOT present. That does not make sense in
a multi-command situation.
Change-Id: I78dbc0613f5db22cea0ed714f5f30ef0207fac24
The configuration file parsers have a defined API, but we aren't
enforcing use of that. This adds an abstract base class that they
all will now inherit from. Additionally, new tests are added to
ensure the classes inherit from the new base class.
Moves tests for files in the config/ directory into their own
test directory.
Fixes the test class name for the ToxIni tests.
Change-Id: I003b4add6060075676da0f23cc37445ea50ffe88
Popen.communicate returns a tuple (stdoutdata, stderrdata) which implies
the result length check is useless.
Change-Id: Id5ee7328d8e31bf584c9069183213cc8c2a19da1
Replace the pattern:
func(open(...))
by the pattern:
with open(...) as f:
func(f)
It ensures files are closed after use.
Change-Id: I7cdd08993ae4a094d101a1bf68ce700817e7fb92
This patch adds support for running tests on multiple images. Instead of
parsing just 1 image, it attempts to always parse multiple images from
config files and/or CLI.
To run dox on multiple images from the CLI, you'll have to:
$ dox -i infra/trusty,infra/f20
The tox.ini `docker:images` option is now a comma-separated list of
images, whereas the dox.yml one is an array of images.
Change-Id: I124c299b208be5c31c63187af754705c48de5693
The current error when docker is missing is not very helpful:
ERROR: Operation failed, aborting dox.
The debug one doesn't help more, this change start 'docker version'
command earlier to have a clear error message.
Change-Id: I1e6ac247b0a619915600f604d5f316d5f053e8c1
Add module name to logging lines. Kind of nice to see where they
come from.
Also, INFO level would only appear with the --debug option because
the default level was WARN. This makes INFO appear by default, WARN
is used for --quiet mode.
Change-Id: If9618e08744d3c03d7b78e44cbb52f0b1f040074
testr writes files into the local dir, which is cool and works
because of the bind mount - but if we don't run as the same UID
as the executing user, then we'll write unreadable data into
.testrepository.