-
Notifications
You must be signed in to change notification settings - Fork 35
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 #2 from Parallels/release-1.0
Release v1.0.0
- Loading branch information
Showing
12 changed files
with
549 additions
and
15 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,2 @@ | ||
docker-machine-driver-parallels | ||
*.log |
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 |
---|---|---|
@@ -1,12 +1,17 @@ | ||
default: build | ||
|
||
build: | ||
go build -i -o docker-machine-driver-parallels ./bin | ||
bin/docker-machine-driver-parallels: | ||
go build -i -o ./bin/docker-machine-driver-parallels ./bin | ||
|
||
build: clean bin/docker-machine-driver-parallels | ||
|
||
clean: | ||
$(RM) docker-machine-driver-parallels | ||
$(RM) bin/docker-machine-driver-parallels | ||
|
||
install: bin/docker-machine-driver-parallels | ||
cp -f ./bin/docker-machine-driver-parallels $(GOPATH)/bin/ | ||
|
||
install: build | ||
cp -r ./docker-machine-driver-parallels /usr/local/bin/ | ||
test-acceptance: | ||
test/integration/run-bats.sh test/integration/bats/ | ||
|
||
.PHONY: install | ||
.PHONY: clean build install test-acceptance |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ${BASE_TEST_DIR}/helpers.bash | ||
|
||
export BAD_URL="http://dev.null:9111/bad.iso" | ||
|
||
@test "$DRIVER: Should not allow machine creation with bad ISO" { | ||
run machine create -d parallels --parallels-boot2docker-url $BAD_URL $NAME | ||
[[ ${status} -eq 1 ]] | ||
} |
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,19 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ${BASE_TEST_DIR}/helpers.bash | ||
|
||
@test "$DRIVER: create" { | ||
run machine create -d $DRIVER $NAME | ||
} | ||
|
||
@test "$DRIVER: verify that server cert checksum matches local checksum" { | ||
# 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} ]] | ||
} |
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,153 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ${BASE_TEST_DIR}/helpers.bash | ||
|
||
@test "$DRIVER: machine should not exist" { | ||
run machine inspect $NAME | ||
echo ${output} | ||
[ "$status" -eq 1 ] | ||
[[ ${lines[0]} == "Host \"$NAME\" does not exist" ]] | ||
} | ||
|
||
@test "$DRIVER: create" { | ||
run machine create -d $DRIVER $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: appears with ls" { | ||
run machine ls -q | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[0]} == "$NAME" ]] | ||
} | ||
|
||
@test "$DRIVER: has status 'started' appearing in ls" { | ||
run machine ls -q --filter state=Running | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[0]} == "$NAME" ]] | ||
} | ||
|
||
@test "$DRIVER: create with same name again fails" { | ||
run machine create -d $DRIVER $NAME | ||
echo ${output} | ||
[ "$status" -eq 1 ] | ||
[[ ${lines[0]} == "Host already exists: \"$NAME\"" ]] | ||
} | ||
|
||
@test "$DRIVER: run busybox container" { | ||
run docker $(machine config $NAME) run busybox echo hello world | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: url" { | ||
run machine url $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: ip" { | ||
run machine ip $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: ssh" { | ||
run machine ssh $NAME -- ls -lah / | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[0]} =~ "total" ]] | ||
} | ||
|
||
@test "$DRIVER: docker commands with the socket should work" { | ||
run machine ssh $NAME -- sudo docker version | ||
echo ${output} | ||
} | ||
|
||
@test "$DRIVER: shared folder is mounted" { | ||
run machine ssh $NAME -- "mount | grep prl_fs | awk '{ print $3 }'" | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${output} == *"/Users"* ]] | ||
} | ||
|
||
@test "$DRIVER: stop" { | ||
run machine stop $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: machine should show stopped after stop" { | ||
run machine ls | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[1]} == *"Stopped"* ]] | ||
} | ||
|
||
@test "$DRIVER: url should show an error when machine is stopped" { | ||
run machine url $NAME | ||
echo ${output} | ||
[ "$status" -eq 1 ] | ||
[[ ${output} == *"not running"* ]] | ||
} | ||
|
||
@test "$DRIVER: env should show an error when machine is stopped" { | ||
run machine env $NAME | ||
echo ${output} | ||
[ "$status" -eq 1 ] | ||
[[ ${output} == *"not running. Please start"* ]] | ||
} | ||
|
||
@test "$DRIVER: machine should not allow upgrade when stopped" { | ||
run machine upgrade $NAME | ||
echo ${output} | ||
[[ "$status" -eq 1 ]] | ||
} | ||
|
||
@test "$DRIVER: start" { | ||
run machine start $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: machine should show running after start" { | ||
run machine ls | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[1]} == *"Running"* ]] | ||
} | ||
|
||
@test "$DRIVER: kill" { | ||
run machine kill $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: machine should show stopped after kill" { | ||
run machine ls | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[1]} == *"Stopped"* ]] | ||
} | ||
|
||
@test "$DRIVER: restart" { | ||
run machine restart $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: machine should show running after restart" { | ||
run machine ls | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[1]} == *"Running"* ]] | ||
} | ||
|
||
@test "$DRIVER: status" { | ||
run machine status $NAME | ||
echo ${output} | ||
[ "$status" -eq 0 ] | ||
[[ ${output} == *"Running"* ]] | ||
} |
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,49 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ${BASE_TEST_DIR}/helpers.bash | ||
|
||
# Default memsize is 1024MB and disksize is 20000MB | ||
# These values are defined in parallels.go | ||
export DEFAULT_MEMSIZE=1024 | ||
export DEFAULT_DISKSIZE=20000 | ||
export CUSTOM_MEMSIZE=1536 | ||
export CUSTOM_DISKSIZE=10000 | ||
export CUSTOM_CPUCOUNT=1 | ||
|
||
function findDiskSize() { | ||
run bash -c "prlctl list -i $NAME | grep 'hdd0.*sata' | grep -o '\d*Mb' | awk -F 'Mb' '{print $1}'" | ||
} | ||
|
||
function findMemorySize() { | ||
run bash -c "prlctl list -i $NAME | grep 'memory ' | grep -o '[0-9]\+'" | ||
} | ||
|
||
function findCPUCount() { | ||
run bash -c "prlctl list -i $NAME | grep -o 'cpus=\d*' | cut -d'=' -f2" | ||
} | ||
|
||
@test "$DRIVER: create with custom disk, cpu count and memory size flags" { | ||
run machine create -d $DRIVER --parallels-cpu-count $CUSTOM_CPUCOUNT --parallels-disk-size $CUSTOM_DISKSIZE --parallels-memory $CUSTOM_MEMSIZE $NAME | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "$DRIVER: check custom machine memory size" { | ||
findMemorySize | ||
[[ ${output} == "$CUSTOM_MEMSIZE" ]] | ||
} | ||
|
||
@test "$DRIVER: check custom machine disksize" { | ||
findDiskSize | ||
[[ ${output} == *"$CUSTOM_DISKSIZE"* ]] | ||
} | ||
|
||
@test "$DRIVER: check custom machine cpucount" { | ||
findCPUCount | ||
[[ ${output} == "$CUSTOM_CPUCOUNT" ]] | ||
} | ||
|
||
@test "$DRIVER: machine should show running after create" { | ||
run machine ls | ||
[ "$status" -eq 0 ] | ||
[[ ${lines[1]} == *"Running"* ]] | ||
} |
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,13 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ${BASE_TEST_DIR}/helpers.bash | ||
|
||
@test "$DRIVER: create with disabled sharing" { | ||
run machine create -d $DRIVER --parallels-no-share $NAME | ||
} | ||
|
||
@test "$DRIVER: shared folder is not mounted mounted" { | ||
run machine ssh $NAME -- "mount | grep prl_fs" | ||
echo ${output} | ||
[ "$status" -eq 1 ] | ||
} |
Oops, something went wrong.