Commit Graph

19 Commits

Author SHA1 Message Date
Gus Eggert
3a15a0fc55
test: fix Docker tests in GH Actions (#9812)
GH Actions recently changed their Docker build implementation and it
has a different output than previously, causing the tests that parse
its output to fail.

This switches the test to not parse Docker build output. The parsing
was used to extract the image ID while still showing logs. A better
way to show logs and still know the image ID is to tag it, which is
what this now does.

This also renames the Docker tests so that they run earlier. This
takes better advantage of the fact that the sharness tests are run in
parallel. Since the Docker test are quite long, and are at the end of
the list, the test runner is not running other tests in parallel while
the Docker tests are running.
2023-04-12 09:03:11 +02:00
Caian Benedicto
63b0025664
feat(docker): /container-init.d for advanced initialization (#6577)
* 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>
2022-04-12 19:44:03 +02:00
Gus Eggert
46c3689b75
feat: re-enable docker sharness tests (#8808)
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.
2022-03-30 11:07:26 -04:00
Dimitris Apostolou
1e437c7e97
Fix typos and cleanup 2020-04-20 22:00:01 +03:00
Steven Allen
1054826ac4 switch base64 decoder based on OS
Less magical.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2018-01-28 14:13:16 -08:00
Steven Allen
d0998a926d make base64 decoding cross-platform
support both the -D and the -d flag.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2018-01-27 13:45:36 -08:00
Steven Allen
de02525594 strip ANSI sequences from docker build output
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>
2017-12-14 08:37:27 -08:00
Christian Couder
2489dfe8a9 ipfs-test-lib: fix test_fsh arg quoting
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>
2016-08-15 12:10:15 +02:00
Christian Couder
7d80512a4c test-lib: add test_path_cmp()
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2016-02-12 17:20:23 -08:00
Lars Gierth
81c8cffee9 Rework the Dockerfile
- 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>
2016-02-04 10:46:26 -08:00
Tommi Virtanen
531f0579a4 sharness: Don't assume we know all things that can create garbage
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>
2016-01-12 08:21:13 -08:00
Christian Couder
29ec4c06e4 test/ipfs-test-lib: add docker support
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>
2016-01-10 20:19:23 +01:00
Christian Couder
088aa1a623 ipfs-test-lib: clarify and simplify shellquote()
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>
2015-10-03 23:35:44 +02:00
Christian Couder
4cab9fe37e ipfs-test-lib: fix shellquote() on Mac OS
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-10-03 16:06:40 +02:00
Christian Couder
1bd182055b ipfs-test-lib: add shellquote()
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>
2015-09-27 09:11:25 +02:00
Christian Couder
408a818b4a ipfs-test-lib: use test_seq from sharness
As Sharness now includes test_seq we can remove
our implementation.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-14 11:21:32 +02:00
Christian Couder
3c2e0ba586 ipfs-test-lib: implement test_seq()
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-03 23:51:50 +02:00
Christian Couder
1f1507106a test: implement test_sort_cmp()
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-04-04 07:37:37 +02:00
Christian Couder
65cbbdff84 Add ipfs-test-lib.sh and source it in sharness test-lib.sh
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>
2015-02-04 21:50:07 +01:00