-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 #2064 from ipfs/ipfs-volume
Docker image volume fix and Sharness tests
- Loading branch information
Showing
7 changed files
with
102 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2015 Christian Couder | ||
# MIT Licensed; see the LICENSE file in this repository. | ||
# | ||
|
||
test_description="Test docker image" | ||
|
||
. lib/test-lib.sh | ||
|
||
# if in travis CI on OSX, docker is not available | ||
if ! test_have_prereq DOCKER; then | ||
skip_all='skipping docker tests, docker not available' | ||
|
||
test_done | ||
fi | ||
|
||
test_expect_success "'docker --version' works" ' | ||
docker --version >actual | ||
' | ||
|
||
test_expect_success "'docker --version' output looks good" ' | ||
egrep "^Docker version" actual | ||
' | ||
|
||
test_expect_success "current user is in the 'docker' group" ' | ||
groups | egrep "\bdocker\b" | ||
' | ||
|
||
TEST_TRASH_DIR=$(pwd) | ||
TEST_SCRIPTS_DIR=$(dirname "$TEST_TRASH_DIR") | ||
TEST_TESTS_DIR=$(dirname "$TEST_SCRIPTS_DIR") | ||
APP_ROOT_DIR=$(dirname "$TEST_TESTS_DIR") | ||
|
||
test_expect_success "docker image build succeeds" ' | ||
docker_build "$APP_ROOT_DIR" >actual | ||
' | ||
|
||
test_expect_success "docker image build output looks good" ' | ||
SUCCESS_LINE=$(egrep "^Successfully built" actual) && | ||
IMAGE_ID=$(expr "$SUCCESS_LINE" : "^Successfully built \(.*\)") || | ||
test_fsh cat actual | ||
' | ||
|
||
test_expect_success "docker image runs" ' | ||
DOC_ID=$(docker_run "$IMAGE_ID") | ||
' | ||
|
||
test_expect_success "simple command can be run in docker container" ' | ||
docker_exec "$DOC_ID" "echo Hello Worlds" >actual | ||
' | ||
|
||
test_expect_success "simple command output looks good" ' | ||
echo "Hello Worlds" >expected && | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "stop docker container" ' | ||
docker_stop "$DOC_ID" | ||
' | ||
|
||
test_done | ||
|