Remove 'weave run', 'start' and 'restart'
Replace with informative message. Also fix up tests which were calling these commands.
This commit is contained in:
1 parent
19a31a5b82
commit
98e6571059
11 files changed
+72
-193
No files matched your search
@@ -27,8 +27,9 @@ start_container $HOST2 net:$SUBNET_2 --name=c6
|
||||
C6=$(container_ip $HOST2 c6)
|
||||
assert_raises "exec_on $HOST1 c5 $PING $C6"
|
||||
|
||||
# check that restart retains the same IP, and reclaims it in IPAM
|
||||
weave_on $HOST2 restart c6
|
||||
# check that restart+attach retains the same IP, and reclaims it in IPAM
|
||||
docker_on $HOST2 restart c6
|
||||
weave_on $HOST2 attach net:$SUBNET_2 c6
|
||||
assert_raises "exec_on $HOST1 c5 $PING $C6"
|
||||
# check that restart does not create any additional DNS entry
|
||||
assert "weave_on $HOST2 report -f \"{{len .DNS.Entries}}\"" "6"
|
||||
|
||||
@@ -15,10 +15,12 @@ weave_local_on $HOST1 reset
|
||||
weave_local_on $HOST1 launch --ipalloc-range 10.2.5.0/24
|
||||
assert_raises "docker_on $HOST1 ps | grep weave"
|
||||
|
||||
weave_local_on $HOST1 run 10.2.6.5/24 -ti --name=c1 $SMALL_IMAGE /bin/sh
|
||||
docker_on $HOST1 run -dti --name=c1 $SMALL_IMAGE /bin/sh
|
||||
weave_local_on $HOST1 attach 10.2.6.5/24 c1
|
||||
wait_for_attached $HOST1 c1
|
||||
|
||||
weave_local_on $HOST1 run -ti --name=c2 $SMALL_IMAGE /bin/sh
|
||||
docker_on $HOST1 run -dti --name=c2 $SMALL_IMAGE /bin/sh
|
||||
weave_local_on $HOST1 attach c2
|
||||
wait_for_attached $HOST1 c2
|
||||
|
||||
assert "weave_local_on $HOST1 ps | wc -l" 3
|
||||
|
||||
@@ -16,7 +16,8 @@ weave_on $HOST1 launch-router
|
||||
weave_on $HOST1 launch-proxy --no-multicast-route
|
||||
weave_on $HOST1 launch-plugin # plugin defaults to multicast off except for 'net=weave'
|
||||
|
||||
start_container $HOST1 --no-multicast-route --name c1
|
||||
docker_on $HOST1 run --name c1 -dt $SMALL_IMAGE /bin/sh
|
||||
weave_on $HOST1 attach --no-multicast-route c1
|
||||
proxy_start_container $HOST1 --name c2
|
||||
start_container_local_plugin $HOST1 --name=c3
|
||||
|
||||
|
||||
@@ -12,12 +12,6 @@ assert "weave_on $HOST1 dns-args" ""
|
||||
|
||||
C=$(start_container_with_dns $HOST1 $C1/24 --name=c1)
|
||||
|
||||
# hostname is left untouched; equals short container id
|
||||
assert "exec_on $HOST1 c1 hostname" $(echo $C | cut -c1-12)
|
||||
|
||||
# domainname is left empty
|
||||
assert "exec_on $HOST1 c1 dnsdomainname" ""
|
||||
|
||||
# external name resolution works
|
||||
assert_raises "exec_on $HOST1 c1 getent hosts www.weave.works"
|
||||
|
||||
|
||||
@@ -26,8 +26,4 @@ docker_on $HOST1 run $DOPTS -dt $SMALL_IMAGE /bin/sh
|
||||
weave_on $HOST1 attach $C2/24 c2
|
||||
check
|
||||
|
||||
docker_on $HOST1 create $DOPTS -t $SMALL_IMAGE /bin/sh
|
||||
weave_on $HOST1 start $C2/24 c2
|
||||
check
|
||||
|
||||
end_suite
|
||||
@@ -34,8 +34,4 @@ assert_expected_fqdn "$HOSTNAME" -h $HOSTNAME --name=$NAME
|
||||
assert_expected_fqdn "$HOSTNAME" --hostname=$HOSTNAME --name=$NAME
|
||||
assert_expected_fqdn "$HOSTNAME" --hostname $HOSTNAME --name=$NAME
|
||||
|
||||
# Ensure we can launch a container with a name that is too long for hostname derivation
|
||||
SIXTY_FIVE_CHARS=01234567890123456789012345678901234567890123456789012345678901234
|
||||
assert_raises "start_container $HOST1 --name=$SIXTY_FIVE_CHARS"
|
||||
|
||||
end_suite
|
||||
@@ -12,7 +12,8 @@ check_dns() {
|
||||
chk=$1
|
||||
shift
|
||||
|
||||
container=$(weave_on $HOST1 run $@ $IP/24 -t --add-host=$STATIC:$STATIC_IP $DNS_IMAGE /bin/sh)
|
||||
container=$(docker_on $HOST1 run $(dns_args $HOST1 "$@") -dt $DNS_IMAGE /bin/sh)
|
||||
weave_on $HOST1 attach $IP/24 "$@" --rewrite-hosts --add-host=$STATIC:$STATIC_IP $container
|
||||
$chk $HOST1 $container $TARGET
|
||||
assert_dns_record $HOST1 $container $STATIC $STATIC_IP
|
||||
rm_containers $HOST1 $container
|
||||
|
||||
@@ -62,7 +62,7 @@ assert_equal() {
|
||||
assert "echo $result" "$expected"
|
||||
}
|
||||
|
||||
start_suite "Weave run/start/attach/detach/expose/hide with multiple cidr arguments"
|
||||
start_suite "Weave attach/detach/expose/hide with multiple cidr arguments"
|
||||
|
||||
# also check that these commands understand all address flavours
|
||||
|
||||
@@ -73,15 +73,8 @@ start_suite "Weave run/start/attach/detach/expose/hide with multiple cidr argume
|
||||
weave_on $HOST1 launch-router --ipalloc-range 10.2.3.0/24
|
||||
|
||||
# Run container with three cidrs
|
||||
CID=$(start_container $HOST1 10.2.1.1/24 ip:10.2.2.1/24 net:10.2.3.0/24 --name=multicidr -h $NAME)
|
||||
assert_ips_and_dns $HOST1 $CID $NAME. 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24
|
||||
|
||||
# Stop the container
|
||||
docker_on $HOST1 stop -t 1 $CID
|
||||
assert_ips_and_dns $HOST1 $CID $NAME.
|
||||
|
||||
# Restart with three IPs
|
||||
weave_on $HOST1 start 10.2.1.1/24 ip:10.2.2.1/24 net:10.2.3.0/24 $CID
|
||||
CID=$(docker_on $HOST1 run --name=multicidr -h $NAME -dt $SMALL_IMAGE /bin/sh)
|
||||
weave_on $HOST1 attach 10.2.1.1/24 ip:10.2.2.1/24 net:10.2.3.0/24 $CID
|
||||
assert_ips_and_dns $HOST1 $CID $NAME. 10.2.1.1/24 10.2.2.1/24 10.2.3.1/24
|
||||
|
||||
# Remove two of them
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
. "$(dirname "$0")/config.sh"
|
||||
|
||||
C1=10.2.1.13
|
||||
|
||||
start_suite "Start containers with 'weave run' via proxy"
|
||||
|
||||
weave_on $HOST1 launch
|
||||
|
||||
proxy start_container $HOST1 $C1/24 --name=c1
|
||||
# check we get exactly one IP back, the one specified
|
||||
assert "weave_on $HOST1 ps c1 | cut -d ' ' -f 3-" $C1/24
|
||||
|
||||
end_suite
|
||||
+53
-6
@@ -46,6 +46,15 @@ DOCKER_PORT=2375
|
||||
|
||||
CHECKPOINT_DISABLE=true
|
||||
|
||||
# The regexp here is far from precise, but good enough. (taken from weave script)
|
||||
IP_REGEXP="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
|
||||
CIDR_REGEXP="(ip:|net:)?$IP_REGEXP/[0-9]{1,2}"
|
||||
|
||||
is_cidr() {
|
||||
[ $1 = "net:default" ] && return
|
||||
echo "$1" | grep -E "^$CIDR_REGEXP$" >/dev/null
|
||||
}
|
||||
|
||||
upload_executable() {
|
||||
host=$1
|
||||
file=$2
|
||||
@@ -140,16 +149,54 @@ exec_on() {
|
||||
docker -H tcp://$host:$DOCKER_PORT exec $container "$@"
|
||||
}
|
||||
|
||||
# Look through 'docker run' args and try to make the hostname match the name
|
||||
dns_args() {
|
||||
local host=$1 NAME_ARG="" HOSTNAME_SPECIFIED=""
|
||||
shift
|
||||
weave_on $host dns-args "$@"
|
||||
while [ $# -gt 0 ] ; do
|
||||
case "$1" in
|
||||
--name)
|
||||
NAME_ARG="$2"
|
||||
shift
|
||||
;;
|
||||
--name=*)
|
||||
NAME_ARG="${1#*=}"
|
||||
;;
|
||||
-h|--hostname|--hostname=*)
|
||||
HOSTNAME_SPECIFIED=1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ -n "$NAME_ARG" -a -z "$HOSTNAME_SPECIFIED" ] ; then
|
||||
echo " --hostname=$NAME_ARG.weave.local"
|
||||
fi
|
||||
}
|
||||
|
||||
start_container_image() {
|
||||
local image=$1 host=$2 cidr="" weave_dns_args="" container
|
||||
shift 2
|
||||
if [ "$1" = "--without-dns" ] ; then
|
||||
shift
|
||||
else
|
||||
weave_dns_args=$(dns_args $host "$@")
|
||||
fi
|
||||
is_cidr $1 && { cidr=$1; shift; }
|
||||
container=$(docker_on $host run $weave_dns_args $name_args "$@" -dt $image /bin/sh)
|
||||
if ! weave_on $host attach $cidr $container >/dev/null ; then
|
||||
docker_on $host rm -f $container
|
||||
return 1
|
||||
fi
|
||||
echo $container
|
||||
}
|
||||
|
||||
start_container() {
|
||||
host=$1
|
||||
shift 1
|
||||
weave_on $host run "$@" -t $SMALL_IMAGE /bin/sh
|
||||
start_container_image $SMALL_IMAGE "$@"
|
||||
}
|
||||
|
||||
start_container_with_dns() {
|
||||
host=$1
|
||||
shift 1
|
||||
weave_on $host run "$@" -t $DNS_IMAGE /bin/sh
|
||||
start_container_image $DNS_IMAGE "$@"
|
||||
}
|
||||
|
||||
start_container_local_plugin() {
|
||||
|
||||
Reference in new issue
Block a user