make it easier to set up more than 2 VMs for testing
This commit is contained in:
1 parent
8f18df7a43
commit
5967d5de20
3 files changed
+25
-11
No files matched your search
Vendored
+9
-8
@@ -1,7 +1,9 @@
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
host1_ip = "192.168.48.19" # arbitrary private IP
|
||||
host2_ip = "192.168.48.15" # arbitrary private IP
|
||||
# these ought to match what is in config.sh
|
||||
n_machines = 2
|
||||
ip_prefix = "192.168.48"
|
||||
ip_suffix_base = 10
|
||||
|
||||
def configure_docker(host, ip)
|
||||
pkgs = "lxc-docker"
|
||||
@@ -30,12 +32,11 @@ end
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
config.vm.define "host1" do |host1|
|
||||
configure_docker(host1, host1_ip)
|
||||
end
|
||||
|
||||
config.vm.define "host2" do |host2|
|
||||
configure_docker(host2, host2_ip)
|
||||
(1..n_machines).each do |i|
|
||||
config.vm.define "host#{i}" do |host|
|
||||
ip_suffix = ip_suffix_base + i
|
||||
configure_docker(host, "#{ip_prefix}.#{ip_suffix}")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
+15
-2
@@ -2,11 +2,24 @@
|
||||
|
||||
set -e
|
||||
|
||||
# these ought to match what is in Vagrantfile
|
||||
N_MACHINES=${N_MACHINES:-2}
|
||||
IP_PREFIX=${IP_PREFIX:-192.168.48}
|
||||
IP_SUFFIX_BASE=${IP_SUFFIX_BASE:-10}
|
||||
|
||||
HOSTS=
|
||||
for i in $(seq 1 $N_MACHINES); do
|
||||
IP="${IP_PREFIX}.$((${IP_SUFFIX_BASE}+$i))"
|
||||
HOSTS="$HOSTS $IP"
|
||||
done
|
||||
|
||||
# these are used by the tests
|
||||
HOST1="${IP_PREFIX}.$((${IP_SUFFIX_BASE}+1))"
|
||||
HOST2="${IP_PREFIX}.$((${IP_SUFFIX_BASE}+2))"
|
||||
|
||||
. ./assert.sh
|
||||
|
||||
SSH=${SSH:-ssh -l vagrant -i ./insecure_private_key -o UserKnownHostsFile=./.ssh_known_hosts -o CheckHostIP=no -o StrictHostKeyChecking=no}
|
||||
HOST1=${HOST1:-192.168.48.19}
|
||||
HOST2=${HOST2:-192.168.48.15}
|
||||
|
||||
remote() {
|
||||
rem=$1
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ curl -sS https://raw.githubusercontent.com/lehmannro/assert.sh/master/assert.sh
|
||||
. ./config.sh
|
||||
|
||||
echo Copying weave images and script to hosts
|
||||
for HOST in $HOST1 $HOST2; do
|
||||
for HOST in $HOSTS; do
|
||||
docker_on $HOST load -i /var/tmp/weave.tar
|
||||
docker_on $HOST load -i /var/tmp/weavedns.tar
|
||||
docker_on $HOST load -i /var/tmp/weavetools.tar
|
||||
|
||||
Reference in new issue
Block a user