Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
c817f09b
Unverified
Commit
c817f09b
authored
Feb 16, 2017
by
Jeromy
Committed by
Jakub Sztandera
Feb 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests to make sure docker requests correct migrations version
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
26770b7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
27 deletions
+76
-27
test/sharness/t0066-migration.sh
test/sharness/t0066-migration.sh
+0
-27
test/sharness/t0301-docker-migrate.sh
test/sharness/t0301-docker-migrate.sh
+76
-0
No files found.
test/sharness/t0066-migration.sh
View file @
c817f09b
...
...
@@ -49,31 +49,4 @@ test_expect_success "output looks good" '
grep "Please get fs-repo-migrations from https://dist.ipfs.io" daemon_out > /dev/null
'
test_launch_ipfs_daemon
test_expect_success
"build fake dist.ipfs.io"
'
mkdir -p fakedist/fs-repo-migrations/v1.0.0/
echo "v1.0.0" > fakedist/fs-repo-migrations/versions
echo "#!/bin/sh" > fakedist/linux
echo "echo linux $@" >> fakedist/linux
tar -czf fakedist/fs-repo-migrations/fs-repo-migrations_v1.0.0_linux-amd64.tar.gz fakedist/linux
echo "#!/bin/sh" > fakedist/linux-musl
echo "echo linux-musl $@" >> fakedist/linux-musl
tar -czf fakedist/fs-repo-migrations/fs-repo-migrations_v1.0.0_linux-musl-amd64.tar.gz fakedist/linux-musl
ipfs add -q -r fakedist/ > fakedisthash
'
test_expect_success
"detect musl"
'
IPFS_DIST_PATH="http://172.17.0.1:$GWAY_PORT" echo $IPFS_DIST_PATH
'
# make fakedist with executables that just echo "I'm $GOOS-$variant with $ARGV"
# ipfs add -r fakedist
# find out IPFS_DIST_PATH
# run daemon --migrate end-to-end
# check for correct output
test_done
test/sharness/t0301-docker-migrate.sh
0 → 100755
View file @
c817f09b
#!/bin/sh
#
# Copyright (c) 2017 Whyrusleeping
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test docker image migration"
.
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_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 "$TEST_TESTS_DIR/../Dockerfile.fast" "$APP_ROOT_DIR" >actual &&
IMAGE_ID=$(tail -n1 actual | cut -d " " -f 3)
'
test_init_ipfs
test_expect_success
"make repo be version 4"
'
echo 4 > "$IPFS_PATH/version"
'
test_expect_success
"setup http response"
'
echo "HTTP/1.1 200 OK" > vers_resp &&
echo "Content-Length: 7" >> vers_resp &&
echo "" >> vers_resp &&
echo "v1.1.1" >> vers_resp
'
pretend_server
()
{
cat
vers_resp | nc
-l
-i
1
-p
17233
}
test_expect_success
"startup fake dists server"
'
pretend_server > dist_serv_out &
echo $! > netcat_pid
'
test_expect_success
"docker image runs"
'
DOC_ID=$(docker run -d -v "$IPFS_PATH":/data/ipfs --net=host -e IPFS_DIST_PATH="http://localhost:17233" "$IMAGE_ID" --migrate)
'
test_expect_success
"docker container tries to pull migrations from netcat"
'
sleep 4 &&
cat dist_serv_out
'
test_expect_success
"see logs"
'
docker logs $DOC_ID
'
test_expect_success
"stop docker container"
'
docker_stop "$DOC_ID"
'
test_expect_success
"kill the net cat"
'
kill $(cat netcat_pid) || true
'
test_expect_success
"correct version was requested"
'
grep "/fs-repo-migrations/v1.1.1/fs-repo-migrations_v1.1.1_linux-musl-amd64.tar.gz" dist_serv_out > /dev/null
'
test_done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment