93 Commits

Author SHA1 Message Date
Jaroslav Prokop
5208032594 Docker provider: catch container name when using podman.
When user is using podman's docker CLI emulation the containers would
fail to enter running state because the docker driver could not catch
the container name. This commit fixes that by adding a check if podman
docker emulation is used and pick the container hash correctly from the
output.
2020-03-25 19:34:31 +01:00
Sophia Castellarin
2dadeb3ee5
Merge pull request #11461 from soapy1/get-docker-image-id
Get correct docker image from build output
2020-03-24 09:27:20 -05:00
Terry Burton
b566b0ee13
rmi docker provider tests: May also be in use by a stopped container 2020-03-23 23:28:18 +00:00
sophia
114742f3f8 Test rmi functionality for docker provider 2020-03-23 15:39:30 -05:00
sophia
ea7cc687f2 Add test for multiple Successsfully built messages 2020-03-23 09:55:30 -05:00
Brian Cain
4d70856b8a
Enhance docker build matching for determining built container ID
Prior to this commit, docker would look for a container ID based on
"Successfully built" string. This output does not exist if a user has
enabled the experimental feature buildkit. This commit updates the build
behavior to match against both kinds of outputs, and instead of using
`scan`, it uses MatchData and groups the container id with match group
name `:id` instead of making hard assumptions with the matches being
contained inside arrays from scan.
2019-11-19 10:59:28 -08:00
Dan Čermák
fe4743a22b
Mock call to PrepareNetworks.list_interfaces in docker prepare_networks_test
The test "generates a network name and configuration" calls at the end
`process_public_network()`, which can return an empty list if the currently
executing machine has no usable network interfaces (this is typically the case
for workers that build rpm packages in OBS or Koji). This results in an
exception of type Errors::NetworkNoInterfaces to be thrown and causing this test
to fail.

This commit adds a mock of the PrepareNetworks.list_interfaces call that returns
a single entry with just the required defaults.
2019-11-01 17:36:31 +01:00
Brian Cain
7c93151f67
Add test for listing interfaces with docker networks 2019-10-10 11:38:57 -07:00
Brian Cain
8458a21657
Determine prefix with netmask 2019-10-09 15:40:36 -07:00
Brian Cain
62b7e35169
Fixes #11094: Determine prefix for docker public networks
Prior to this commit, the docker action was using the method `prefix` on
an IPv4 and IPv6 address. This works fine for ruby versions 2.5 and
newer, however the ruby shipped with Vagrant is before 2.5, and
therefore the IPv4 and IPv6 classes do not have the prefix method,
resulting in an error. This commit fixes that by using a different
method of determining the prefix.
2019-10-09 09:56:59 -07:00
Brian Cain
f1ea4eaac0
Ensure build_args are passed into docker compose config file
Prior to this commit, the docker compose build method would not properly
set build_args if given in a Vagrantfile. This commit fixes that by
using the passed in key `extra_args` from the docker build action.
2019-10-07 12:48:59 -07:00
Brian Cain
c7b1f8821d
Try to mock up docker version subprocess result in test 2019-09-11 09:36:11 -07:00
Brian Cain
d4002aa74d
Add vagrantfile mock to iso_env machine 2019-09-11 09:17:14 -07:00
Brian Cain
e820b5df8e
Add vagrantfile double for environment class 2019-09-11 09:01:35 -07:00
Brian Cain
f14cf09af6
Add allow for docker driver execute method 2019-09-11 08:37:07 -07:00
Brian Cain
21db2db9ac
Add machine config to machine double for rspec tests
This commit mocks up the docker machines test config so that it doesn't
actually invoke the docker driver in circle-ci
2019-09-11 08:09:26 -07:00
Brian Cain
ebe1f3f1c9
Remove virtualbox context from docker tests 2019-09-11 07:46:40 -07:00
Anders Kaseorg
5b4dcf9443
providers/docker: Fix usability check
In commit 7980178d194bb21bde2e21858fbc969e4cc7eb3f (#10879) I added a
`usable?` class method to `VagrantPlugins::DockerProvider::Provider`.
However, commit 34e53a5a4b208edcc3e25c1f0e3aa0ef56e8d8d9 (#10890)
incorrectly changed it to an instance method.  This rendered it
ineffective because it’s called on the class, not an instance.  Change
it back to a class method.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-09-10 15:10:43 -07:00
Brian Cain
09af983caa
Fixes #11051: Only use host vm if specified
Prior to this commit, the docker login action assumed that if there was
a password to authenticate with, Vagrant was using a host vm to run
docker. This is likely due to some legacy decisions with how Vagrant
used to manage running docker. This commit fixes that by only grabbing a
host_vm lock if the host_vm is actually in use, otherwise login
normally.
2019-09-05 14:54:40 -07:00
Chris Roberts
2f2d1f9cb2 Fix docker test to not call docker executable 2019-06-19 11:59:09 -07:00
Brian Cain
fb80e8da9f
Merge pull request #10890 from briancain/add-usability-check-for-docker-plus-tests
Add usability check for docker plus tests
2019-06-05 07:58:23 -07:00
Brian Cain
34e53a5a4b
Add docker provider class test
This commit introduces aa provider_test class for the Docker provider
2019-06-04 13:24:07 -07:00
Brian Cain
ca0fd64ded
Fixes #10798: Enhance how docker compose driver path expands
Prior to this commit, the docker compose driver would _always_ path
expand a host volume no matter what. This is not always the correct
option, for example if that host volume is actually a reference to a key
inside a `volumes` hash instead of a path on disk. This commit changes
that by looking to see if the requested host volume is actually a
defined key inside the compose config, and if not, it will path expand
it like before. Otherwise it will leave the key "as is".
2019-04-29 16:14:37 -07:00
Brian Cain
f8744b66f0
Add connect cli argument tests 2019-03-22 09:24:26 -07:00
Brian Cain
4f80a9e6d5
Add test for requesting public ip range for docker network provider 2019-03-22 09:02:40 -07:00
Brian Cain
36f2aaf55e
Add test for public network gateway request 2019-03-22 08:45:14 -07:00
Brian Cain
b56f89775d
Add more mocks for public network
Ensure test values are used rather than real values from machine
2019-03-22 08:24:22 -07:00
Brian Cain
6bffdca972
Add beginning of connect network tests for docker provider 2019-03-21 16:06:24 -07:00
Brian Cain
88a18fe2c5
Add public network tests for docker provider 2019-03-21 16:06:11 -07:00
Brian Cain
82700d95b3
Ensure subnet is used if specified from user config options 2019-03-21 15:29:04 -07:00
Brian Cain
2bc6fa854a
Add tests for validating network configurations 2019-03-21 13:51:24 -07:00
Brian Cain
36a41957c9
Fix travis ci tests for public gateway and ip range issues 2019-03-21 13:51:07 -07:00
Brian Cain
98e41eb936
Mock out public/private network calls for existing subnet tests 2019-03-21 13:26:37 -07:00
Brian Cain
32807d70c7
Mock up public/private network calls for #call test 2019-03-21 13:03:39 -07:00
Brian Cain
8c169714c5
Ensure variable names exist in method 2019-03-21 11:39:16 -07:00
Brian Cain
6ce453ab70
Delete old file and add blank describe blocks for remaining tests 2019-03-21 11:16:26 -07:00
Brian Cain
96a19aa00c
Fix how options to cli args are handled
Since options could also be defined as strings, convert it all to string
and compare those instead
2019-03-21 11:15:41 -07:00
Brian Cain
5215354d16
Fix missing docker error classes, and finish out initial #call tests 2019-03-21 10:50:45 -07:00
Brian Cain
75d6c17386
Fix up call method and add todo for prepare networks 2019-03-20 16:41:42 -07:00
Brian Cain
1027636e41
Split up and rename unit tests for docker network operations 2019-03-20 15:14:39 -07:00
Brian Cain
eb75431c4a
Update docker driver and docker driver unit tests 2019-03-20 14:50:28 -07:00
Brian Cain
c09bce5386
Fixup docker action destroy_network test 2019-03-20 13:35:46 -07:00
Brian Cain
5ed5868067
Inspect networks before creating new ones
This commit updates the behavior of how the docker provider creates new
docker networks. It looks at each existing network to see if the
requested subnet has already been configured in the docker engine. If
so, Vagrant will use that network rather than creating a new one. This
includes networks not created by Vagrant. Vagrant will not clean up
these networks if created outside of Vagrant.
2019-03-12 10:36:57 -07:00
Brian Cain
2be0bc2d81
Add unit tests for docker network actions 2019-03-05 09:49:15 -08:00
Brian Cain
ba2a1224e0
Update driver to include network tests 2019-03-01 08:34:43 -08:00
Brian Cain
91e351b937
Add unit test for dockers compare_synced_folders 2019-02-04 11:12:55 -08:00
Brian Cain
94bb50fa7e
Add test for syncing folders with docker provider 2018-10-17 14:14:27 -07:00
Oleksiy Protas
de6a1794c7
Config, validation and test 2018-09-19 10:24:09 -07:00
Brian Cain
c2cff0dc07
Merge pull request #10100 from briancain/DOCKER-TOOLBOX
Convert windows paths for volume mounts on docker driver
2018-08-17 15:08:59 -07:00
Brian Cain
5d2d784ae7
(#9085) - Add test for converting windows paths
This commit adds a test for checking that a windows path for mounting a
volume in a container is properly converted into something that's
usable.
2018-08-08 10:30:04 -07:00