From b82f9a850926cdc8cd66b1e3309ee830aefa40ef Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Wed, 27 May 2015 17:59:51 -0700 Subject: [PATCH] Implemented integration tests for --tls-san option Signed-off-by: Sam Alba --- test/integration/certs-extra-san.bats | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/integration/certs-extra-san.bats diff --git a/test/integration/certs-extra-san.bats b/test/integration/certs-extra-san.bats new file mode 100644 index 0000000000..66ea492c83 --- /dev/null +++ b/test/integration/certs-extra-san.bats @@ -0,0 +1,26 @@ +#!/usr/bin/env bats + +load helpers + +export DRIVER=virtualbox +export NAME="bats-$DRIVER-test" +export MACHINE_STORAGE_PATH=/tmp/machine-bats-test-$DRIVER + +@test "$DRIVER: create" { + run machine --tls-san foo.bar.tld --tls-san 10.42.42.42 create -d $DRIVER $NAME +} + +@test "$DRIVER: verify that server cert contains the extra SANs" { + machine ssh $NAME -- openssl x509 -in /var/lib/boot2docker/server.pem -text | grep 'DNS:foo.bar.tld' + machine ssh $NAME -- openssl x509 -in /var/lib/boot2docker/server.pem -text | grep 'IP Address:10.42.42.42' +} + +@test "$DRIVER: verify that server cert SANs are still there after 'regenerate-certs'" { + machine regenerate-certs -f $NAME + machine ssh $NAME -- openssl x509 -in /var/lib/boot2docker/server.pem -text | grep 'DNS:foo.bar.tld' + machine ssh $NAME -- openssl x509 -in /var/lib/boot2docker/server.pem -text | grep 'IP Address:10.42.42.42' +} + +@test "cleanup" { + machine rm $NAME +}