Files
docker-machine/test/integration/certs-checksum.bats
Nathan LeClaire 7f6d19ff47 Fix a few issues with certs
- regenerate-certs was busted, because of recent changes I made to
  Provision() method
- checksum was different between local certs and remote certs

This PR fixes both issues and adds tests to verify that both conditions
are checked in the future.

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
2015-05-12 15:11:23 -07:00

28 lines
896 B
Bash

#!/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 create -d $DRIVER $NAME
}
@test "$DRIVER: verify that server cert checksum matches local checksum" {
# TODO: Does this test work OK on Linux? cc @ehazlett
# Have to create this directory and file or else the OpenSSL checksum will barf.
machine ssh $NAME -- sudo mkdir -p /usr/local/ssl
machine ssh $NAME -- sudo touch /usr/local/ssl/openssl.cnf
SERVER_CHECKSUM=$(machine ssh $NAME -- openssl dgst -sha256 /var/lib/boot2docker/ca.pem | awk '{ print $2 }')
LOCAL_CHECKSUM=$(openssl dgst -sha256 $MACHINE_STORAGE_PATH/certs/ca.pem | awk '{ print $2 }')
echo ${SERVER_CHECKSUM}
echo ${LOCAL_CHECKSUM}
[[ ${SERVER_CHECKSUM} == ${LOCAL_CHECKSUM} ]]
}
@test "cleanup" {
machine rm $NAME
}