* Add initialization directory support to Docker image
* Add sharness test, fix bugs in init script
Fixed in init script:
- Added some missing quotes around expansions
- Fixed INIT_ARGS to not pass any args if IPFS_PROFILE isn't specified
- Use printf instead of "echo -e"
- Only run scripts in top-level of init dir
- Handle filenames correctly when finding init scripts (by using find + xargs)
* chore: docker cleanup
cleans up containers and images (useful when run on developer machine)
* remove container init documentation from README
There is already IPFS Docker documentation where this should live:
https://docs.ipfs.io/how-to/run-ipfs-inside-docker/
Co-authored-by: Caian <caian@ggaunicamp.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Gus Eggert <gus@gus.dev>
The Docker sharness tests were disabled years ago when go-ipfs moved
from Travis to CircleCI. This makes the tweaks necessary to re-enable
them.
The Docker image has since moved to be based on BusyBox which doesn't
have the requisite wget version for the existing tests to work, so
this adds some functionality to the pollEndpoint program to support
polling HTTP endpoints as well.
sharness was failing because an ANSI reset sequence was getting inserted at the
beginning of the line.
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
test_fsh() should quote its arguments before passing them
to `eval` otherwise there are problems when the arguments
contain spaces.
For example when running the following program:
```
#!/bin/sh
. ./ipfs-test-lib.sh
die () {
printf >&2 "%s\n" "$@"
exit 1
}
DIR1="test dir 1"
DIR2="test dir 2"
mkdir "$DIR1" "$DIR2" || die "Could not mkdir '$DIR1' '$DIR2'"
echo "in dir 1" >"$DIR1/file1" || die "Could not write into '$DIR1/file1'"
echo "in dir 2" >"$DIR2/file2" || die "Could not write into '$DIR2/file2'"
if test_cmp "$DIR1/file1" "$DIR2/file2"
then
echo "test_cmp succeeded!"
else
echo "test_cmp failed!"
fi
rm -rf "$DIR1" "$DIR2" || die "Could not rm -rf '$DIR1' '$DIR2'"
```
we get:
```
> diff -u test dir 1/file1 test dir 2/file2
diff: extra operand '1/file1'
diff: Try 'diff --help' for more information.
test_cmp failed!
```
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
- Have two Dockerfiles doing essentially the same,
but optimized for build time (for tests)
and image size (for Docker Hub)
- Fetch gx dependencies
- Expose port 4002 for utp
- Specify go version, currently 1.5.3-r0
- Create ephemeral fs-repo if none is mounted
- Have t0300-docker-image actually test IPFS, not just an echo
- Make everything a bit less hardcoded
- Remove dead shacheck
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
sharness: Don't assume we know all things that can create garbage
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
We have to do something special for CircleCI in docker_exec()
because "docker exec" doesn't work on CircleCi:
https://circleci.com/docs/docker#docker-exec
We indeed get "Unsupported: Exec is not supported by the lxc
driver" with CircleCi, when using "docker exec".
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Let's first add a comment to explain why the wrapper printf()
is needed.
Then let's replace the last instructions by quotes inside the
wrapper printf() first argument, and let's also put there the
eventual space so that we can remove the printf on the above
line.
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This function can be usefull in many places.
See for example:
https://github.com/ipfs/go-ipfs/pull/1742
Git has `git rev-parse --sq-quote` that does the same thing.
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
The new ipfs-test-lib.sh file contains generic test
functions.
We also start replacing fsh with a shell function named
test_fsh() in ipfs-test-lib.sh.
And we move our custom test_cmp in ipfs-test-lib.sh.
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>