This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 670
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #890 from awh/use_container_name_as_hostname
Use container name as hostname Closes #750.
- Loading branch information
Showing
9 changed files
with
136 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#! /bin/bash | ||
|
||
. ./config.sh | ||
|
||
NAME=c1 | ||
DOMAIN=weave.local. | ||
HOSTNAME=$NAME-hostname.$DOMAIN | ||
|
||
# Docker inspect hostname + domainname of container $2 on host $1 | ||
docker_inspect_fqdn() { | ||
docker_on $1 inspect --format='{{.Config.Hostname}}.{{.Config.Domainname}}' $2 | ||
} | ||
|
||
# Start container with args $2.. and assert fqdn of $1 | ||
assert_expected_fqdn() { | ||
EXPECTED_FQDN=$1 | ||
shift | ||
start_container_with_dns $HOST1 "$@" | ||
assert "docker_inspect_fqdn $HOST1 $NAME" $EXPECTED_FQDN | ||
docker_on $HOST1 rm -f $NAME | ||
} | ||
|
||
start_suite "Use container name as hostname" | ||
|
||
weave_on $HOST1 launch -iprange 10.2.0.0/24 | ||
|
||
assert_expected_fqdn "$NAME.$DOMAIN" --name=$NAME | ||
assert_expected_fqdn "$NAME.$DOMAIN" --name $NAME | ||
assert_expected_fqdn "$HOSTNAME" --name=$NAME -h $HOSTNAME | ||
assert_expected_fqdn "$HOSTNAME" --name=$NAME --hostname=$HOSTNAME | ||
assert_expected_fqdn "$HOSTNAME" --name=$NAME --hostname $HOSTNAME | ||
assert_expected_fqdn "$HOSTNAME" -h $HOSTNAME --name=$NAME | ||
assert_expected_fqdn "$HOSTNAME" --hostname=$HOSTNAME --name=$NAME | ||
assert_expected_fqdn "$HOSTNAME" --hostname $HOSTNAME --name=$NAME | ||
|
||
end_suite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters