kubo/test/sharness
2022-10-06 10:18:40 -04:00
..
lib feat(gateway): Gateway.FastDirIndexThreshold (#8853) 2022-04-28 19:36:57 +02:00
t0024-files fix t0024 on osx 2017-09-03 18:43:18 -07:00
t0051-object-data Add global --cid-base option and enable it for most commands. 2019-01-17 15:54:32 -05:00
t0053-dag-data fix printing out of binary escaped data for test 2017-02-09 10:31:18 -08:00
t0054-dag-car-import-export-data feat(cmds): add support for CAR v2 imports (#8854) 2022-04-07 04:33:13 +02:00
t0060-data feat: relay v2 discovery (go-libp2p v0.19.0) (#8868) 2022-04-28 17:13:15 +02:00
t0109-gateway-web-_redirects-data feat(gateway): _redirects file support (#8890) 2022-09-23 18:44:19 +02:00
t0110-gateway-data gateway: fix seeker can't seek on specific files 2017-10-18 20:10:22 +02:00
t0116-prometheus-data chore: bump go-libp2p v0.23.1 2022-09-21 23:16:03 +02:00
t0118-gateway-car feat(gateway): Block and CAR response formats (#8758) 2022-03-17 17:15:24 +01:00
t0165-keystore-data fix(cmds/keystore): do not allow to import keys we don't generate (#8733) 2022-02-18 23:42:40 +01:00
t0275-cid-security-data Fix t0275-cid-security.sh: rename bad block file 2021-12-02 09:46:23 -05:00
t0280-plugin-dag-jose-data Integrate go-dag-jose plugin (#8569) 2021-11-30 10:58:15 -08:00
t0280-plugin-data refactor: rename to kubo 2022-07-06 18:40:37 +02:00
t0280-plugin-git-data git: add git plugin tests 2017-07-12 23:38:32 +02:00
t0701-delegated-routing-reframe feat(routing): Delegated Routing (#8997) 2022-07-07 17:10:25 -04:00
.gitignore feat: relay v2 discovery (go-libp2p v0.19.0) (#8868) 2022-04-28 17:13:15 +02:00
GNUmakefile fix: require gmake 2019-08-01 12:18:56 -07:00
README.md Fix typos and cleanup 2020-04-20 22:00:01 +03:00
Rules.mk test(graphsync): test server-side graphsync 2020-02-26 09:11:17 -08:00
t0001-tests-work.sh Simplify grep in test to pass on MacOS 2020-03-12 04:42:53 +01:00
t0010-basic-commands.sh fix: kubo in daemon and cli stdout 2022-07-20 16:26:49 +02:00
t0011-completion.sh feat: programmatic shell completions 2021-07-01 08:46:49 -07:00
t0015-basic-sh-functions.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0018-indent.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0020-init.sh use --repo-dir in sharness/t0020-init.sh 2022-04-22 13:03:28 -03:00
t0021-config.sh --config-file test in sharness/t0021-config.sh 2022-04-22 13:03:28 -03:00
t0022-init-default.sh switch ipfs init default key 2020-08-19 08:31:44 -07:00
t0023-shutdown.sh propagate test_launch_ipfs_daemon_without_network name 2021-07-08 16:53:58 -03:00
t0024-datastore-config.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0025-datastores.sh switch ipfs init default key 2020-08-19 08:31:44 -07:00
t0026-id.sh fix: kubo in AgentVersion 2022-07-06 23:08:31 +02:00
t0027-rotate.sh test: add rotate self test 2020-08-21 20:08:24 +02:00
t0030-mount.sh test(sharness): test the local symlink 2020-05-19 18:59:54 -07:00
t0031-mount-publish.sh test(sharness): fix fuse tests 2020-05-14 13:14:38 -07:00
t0032-mount-sharded.sh feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
t0040-add-and-cat.sh feat(cmds/add): --to-files option automates files cp (#8927) 2022-09-21 18:08:36 +02:00
t0041-ping.sh feat: Delegated routing with custom configuration. (#9274) 2022-09-22 15:47:45 +02:00
t0042-add-skip.sh fix: ensure hasher is registered when using a hashing function 2022-09-26 10:05:26 +02:00
t0043-add-w.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0044-add-symlink.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0045-ls.sh chore: bump go-libp2p v0.22.0 & go1.18&go1.19 2022-09-09 17:09:38 +02:00
t0046-id-hash.sh test: handle id -> identity rename 2019-08-23 17:02:23 -07:00
t0050-block.sh fix(cmds): CIDv1 and correct multicodecs in 'block put' and 'cid codecs' (#8568) 2022-04-21 18:19:40 +02:00
t0051-object.sh feat(cmds): extend block size check for dag|block put (#8751) 2022-03-11 23:23:11 +01:00
t0052-object-diff.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0053-dag.sh feat(cmds): extend block size check for dag|block put (#8751) 2022-03-11 23:23:11 +01:00
t0054-dag-car-import-export.sh feat(cmds): add support for CAR v2 imports (#8854) 2022-04-07 04:33:13 +02:00
t0055-dag-put-json-new-line.sh remove dag put option shortcuts 2021-09-27 14:39:03 -04:00
t0060-daemon.sh feat: relay v2 discovery (go-libp2p v0.19.0) (#8868) 2022-04-28 17:13:15 +02:00
t0061-daemon-opts.sh feat: relay v2 discovery (go-libp2p v0.19.0) (#8868) 2022-04-28 17:13:15 +02:00
t0062-daemon-api.sh Fix typos and cleanup 2020-04-20 22:00:01 +03:00
t0063-daemon-init.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0063-external.sh add test for sharness locking 2018-07-05 14:33:01 -07:00
t0064-api-file.sh chore: fix undiallable api and gateway files 2022-08-30 11:03:17 +02:00
t0065-active-requests.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0066-migration.sh chore: switch to dist.ipfs.tech 2022-08-12 23:42:17 +02:00
t0067-unix-api.sh daemon: support unix domain sockets for the API/gateway 2019-09-30 17:21:28 -07:00
t0070-user-config.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0080-repo.sh chore: bump go-blockservice to only do put onces 2022-07-28 14:41:46 +00:00
t0081-repo-pinning.sh chore: bump go-ipld-format v0.4.0 and fix related sharness tests 2022-04-02 05:07:51 +02:00
t0082-repo-gc-auto.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0084-repo-read-rehash.sh Sharness: fix t0084-repo-read-rehash for raw multihashes 2021-12-02 09:46:23 -05:00
t0085-pins.sh chore: bump go-ipld-format v0.4.0 and fix related sharness tests 2022-04-02 05:07:51 +02:00
t0086-repo-verify.sh fix the repo verify test 2018-06-01 23:39:32 -07:00
t0087-repo-robust-gc.sh feat: upgrade to go-libp2p-kad-dht@v0.16.0 (#9005) 2022-06-03 16:56:30 -04:00
t0088-repo-stat-symlink.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0090-get.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0095-refs.sh propagate test_launch_ipfs_daemon_without_network name 2021-07-08 16:53:58 -03:00
t0100-name.sh propagate test_launch_ipfs_daemon_without_network name 2021-07-08 16:53:58 -03:00
t0101-iptb-name.sh Fix typos (#8548) 2021-11-17 21:16:06 +01:00
t0109-gateway-web-_redirects.sh feat(gateway): _redirects file support (#8890) 2022-09-23 18:44:19 +02:00
t0110-gateway.sh fix(gw): send 200 for empty files 2022-09-01 01:04:48 +02:00
t0111-gateway-writeable.sh test: update gateway tests for dir-index-html v1.1.0 2020-08-19 20:31:23 -04:00
t0112-gateway-cors.sh test(gw): cors preflight with custom hearder 2022-08-17 05:01:01 +02:00
t0113-gateway-symlink.sh fix(gw): ensure dir URLs have trailing slash 2022-07-21 21:06:18 +02:00
t0114-gateway-subdomains.sh fix(gw): ensure dir URLs have trailing slash 2022-07-21 21:06:18 +02:00
t0115-gateway-dir-listing.sh fix(gw): ensure dir URLs have trailing slash 2022-07-21 21:06:18 +02:00
t0116-gateway-cache.sh fix(gw): cache-control of index.html websites 2022-07-21 02:02:21 +00:00
t0117-gateway-block.sh fix(gw): cache-control of index.html websites 2022-07-21 02:02:21 +00:00
t0118-gateway-car.sh fix: correct cache-control in car responses 2022-07-06 18:34:12 +02:00
t0119-prometheus.sh test(rcmgr): regression test prometherus metrics 2022-08-17 01:27:50 +02:00
t0120-bootstrap.sh test(sharness): fix bootstrap test for quic bootstrap addrs 2020-05-22 16:57:58 -07:00
t0121-bootstrap-iptb.sh At some point the directory name changed to testbeds 2019-12-23 15:41:39 +01:00
t0125-twonode.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0130-multinode.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0131-multinode-client-routing.sh Fix typos and cleanup 2020-04-20 22:00:01 +03:00
t0139-swarm-rcmgr.sh Fix: swarm stats all command 2022-10-06 14:55:18 +02:00
t0140-swarm.sh feat: Addresses.AppendAnnounce (#8177) 2021-11-30 17:58:19 +01:00
t0141-addfilter.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0142-testfilter.sh quic: remove experimental status and add it to the default config 2020-05-22 04:54:19 +02:00
t0150-clisuggest.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0151-sysdiag.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0152-profile.sh feat: port collect-profiles.sh to 'ipfs diag profile' (#8786) 2022-04-12 11:58:03 -04:00
t0160-resolve.sh feat: upgrade to go-libp2p-kad-dht@v0.16.0 (#9005) 2022-06-03 16:56:30 -04:00
t0165-keystore.sh fix(cmds/keystore): do not allow to import keys we don't generate (#8733) 2022-02-18 23:42:40 +01:00
t0170-legacy-dht.sh feat(routing): Delegated Routing (#8997) 2022-07-07 17:10:25 -04:00
t0170-routing-dht.sh feat(routing): Delegated Routing (#8997) 2022-07-07 17:10:25 -04:00
t0171-peering.sh allow config to fail as we have no empty default 2022-03-21 19:03:37 -03:00
t0175-provider.sh Introduce first strategic provider: do nothing 2019-05-29 16:20:31 -07:00
t0175-reprovider.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0175-strategic-provider.sh Introduce first strategic provider: do nothing 2019-05-29 16:20:31 -07:00
t0180-p2p.sh sharness: switch p2p dnsaddr that was supposed to have only a single address in it to use a specific example 2020-08-24 19:11:01 -04:00
t0181-private-network.sh Fix typos (#8548) 2021-11-17 21:16:06 +01:00
t0182-circuit-relay.sh feat: relay v2 discovery (go-libp2p v0.19.0) (#8868) 2022-04-28 17:13:15 +02:00
t0183-namesys-pubsub.sh feat: enabling pubsub and ipns-pubsub via config flags (#8510) 2021-11-30 11:00:11 -08:00
t0184-http-proxy-over-p2p.sh p2p-proxy: earlier peerID validation check 2020-12-01 12:24:18 -05:00
t0185-autonat.sh feat: add autonat config options 2020-04-14 20:54:58 -07:00
t0190-quic-ping.sh feat: add a transport config section 2020-06-16 15:15:47 -07:00
t0191-webtransport-ping.sh feat: add webtransport as an optin transport 2022-09-23 19:50:55 +02:00
t0195-noise.sh feat: add webtransport as an optin transport 2022-09-23 19:50:55 +02:00
t0200-unixfs-ls.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0210-tar.sh Add global --cid-base option and enable it for most commands. 2019-01-17 15:54:32 -05:00
t0220-bitswap.sh humanize for ipfs bitswap stat 2019-04-26 02:54:48 -07:00
t0221-graphsync.sh test(graphsync): test server-side graphsync 2020-02-26 09:11:17 -08:00
t0230-channel-streaming-http-content-type.sh fix: kubo in AgentVersion 2022-07-06 23:08:31 +02:00
t0231-channel-streaming.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0235-cli-request.sh socat is not part of any default install, make tests conditional 2019-12-23 15:41:30 +01:00
t0236-cli-api-dns-resolve.sh socat is not part of any default install, make tests conditional 2019-12-23 15:41:30 +01:00
t0240-republisher.sh testing: slow down republisher sharness test 2018-12-18 20:57:30 -08:00
t0250-files-api.sh remove todo 2022-03-16 19:03:03 -03:00
t0251-files-flushing.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0252-files-gc.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0260-sharding.sh feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563) 2021-11-29 19:58:05 +01:00
t0270-filestore.sh Fix typos (#8548) 2021-11-17 21:16:06 +01:00
t0271-filestore-utils.sh fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
t0272-urlstore.sh Fix typos (#8548) 2021-11-17 21:16:06 +01:00
t0275-cid-security.sh feat: add blake3 support 2022-08-12 16:45:42 +00:00
t0276-cidv0v1.sh chore: bump go-libp2p v0.22.0 & go1.18&go1.19 2022-09-09 17:09:38 +02:00
t0280-plugin-dag-jose.sh feat: relay v2 discovery (go-libp2p v0.19.0) (#8868) 2022-04-28 17:13:15 +02:00
t0280-plugin-fx.sh feat: add fx options plugin 2022-08-12 17:04:29 -04:00
t0280-plugin-git.sh change names of ipfs dag put flags to make changes clearer 2021-09-27 14:39:03 -04:00
t0280-plugin-peerlog.sh ci: preload peerlog plugin, disable by default 2021-08-25 19:02:51 +00:00
t0280-plugin.sh feat: nice errors when failing to load plugins 2020-08-08 22:53:18 -04:00
t0290-cid.sh feat: add blake3 support 2022-08-12 16:45:42 +00:00
t0295-multibase.sh chore: update go-multibase 🚀 2022-07-07 23:29:47 +02:00
t0300-docker-image.sh feat(docker): /container-init.d for advanced initialization (#6577) 2022-04-12 19:44:03 +02:00
t0301-docker-migrate.sh feat(docker): /container-init.d for advanced initialization (#6577) 2022-04-12 19:44:03 +02:00
t0310-tracing.sh feat: upgrade to go-libp2p-kad-dht@v0.16.0 (#9005) 2022-06-03 16:56:30 -04:00
t0320-pubsub.sh ci: add stylecheck to golangci-lint (#9334) 2022-10-06 10:18:40 -04:00
t0321-pubsub-gossipsub.sh fix: multibase in pubsub http rpc (#8183) 2021-11-29 23:06:54 +01:00
t0322-pubsub-http-rpc.sh fix: multibase in pubsub http rpc (#8183) 2021-11-29 23:06:54 +01:00
t0400-api-no-gateway.sh fix: localhost API access via ipv6 2020-10-20 00:46:40 +02:00
t0401-api-browser-security.sh fix: allow ipfs-companion browser extension to access RPC API (#8690) 2022-03-17 00:07:52 +01:00
t0410-api-add.sh Fix typos and cleanup 2020-04-20 22:00:01 +03:00
t0500-issues-and-regressions-offline.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00
t0600-issues-and-regressions-online.sh propagate test_launch_ipfs_daemon_without_network name 2021-07-08 16:53:58 -03:00
t0700-remotepin.sh feat: warn user when 'pin remote add' while offline (#8621) 2022-02-15 17:19:53 -05:00
t0701-delegated-routing-reframe.sh feat: Delegated routing with custom configuration. (#9274) 2022-09-22 15:47:45 +02:00
t0800-blake3.sh feat: add blake3 support 2022-08-12 16:45:42 +00:00
x0601-pin-fail-test.sh sharness: Fix tests 2018-04-10 18:31:25 +02:00

ipfs whole tests using the sharness framework

Running all the tests

Just use make in this directory to run all the tests. Run with TEST_VERBOSE=1 to get helpful verbose output.

TEST_VERBOSE=1 make

The usual ipfs env flags also apply:

# the output will make your eyes bleed
IPFS_LOGGING=debug TEST_VERBOSE=1 make

To make the tests abort as soon as an error occurs, use the TEST_IMMEDIATE env variable:

# this will abort as soon the first error occurs
TEST_IMMEDIATE=1 make

Running just one test

You can run only one test script by launching it like a regular shell script:

$ ./t0010-basic-commands.sh

Debugging one test

You can use the -v option to make it verbose and the -i option to make it stop as soon as one test fails. For example:

$ ./t0010-basic-commands.sh -v -i

Sharness

When running sharness tests from main Makefile or when test_sharness_deps target is run dependencies for sharness will be downloaded from its github repo and installed in a "lib/sharness" directory.

Please do not change anything in the "lib/sharness" directory.

If you really need some changes in sharness, please fork it from its canonical repo and send pull requests there.

Writing Tests

Please have a look at existing tests and try to follow their example.

When possible and not too inefficient, that means most of the time, an ipfs command should not be on the left side of a pipe, because if the ipfs command fails (exit non zero), the pipe will mask this failure. For example after false | true, echo $? prints 0 (despite false failing).

It should be possible to put most of the code inside test_expect_success, or sometimes test_expect_failure, blocks, and to chain all the commands inside those blocks with &&, or || for diagnostic commands.

Diagnostics

Make your test case output helpful for when running sharness verbosely. This means cating certain files, or running diagnostic commands. For example:

test_expect_success ".ipfs/ has been created" '
  test -d ".ipfs" &&
  test -f ".ipfs/config" &&
  test -d ".ipfs/datastore" &&
  test -d ".ipfs/blocks" ||
  test_fsh ls -al .ipfs
'

The || ... is a diagnostic run when the preceding command fails. test_fsh is a shell function that echoes the args, runs the cmd, and then also fails, making sure the test case fails. (wouldn't want the diagnostic accidentally returning true and making it seem like the test case succeeded!).

Testing commands on daemon or mounted

Use the provided functions in lib/test-lib.sh to run the daemon or mount:

To init, run daemon, and mount in one go:

test_launch_ipfs_daemon_and_mount

test_expect_success "'ipfs add --help' succeeds" '
  ipfs add --help >actual
'

# other tests here...

# don't forget to kill the daemon!!
test_kill_ipfs_daemon

To init, run daemon, and then mount separately:

test_init_ipfs

# tests inited but not running here

test_launch_ipfs_daemon

# tests running but not mounted here

test_mount_ipfs

# tests mounted here

# don't forget to kill the daemon!!
test_kill_ipfs_daemon