Skip to content

Commit

Permalink
test: use offline mode whenever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Apr 12, 2023
1 parent 290f29a commit 11d9846
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
12 changes: 3 additions & 9 deletions test/sharness/t0114-gateway-subdomains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ test_expect_success "ipfs init" '
ipfs init --profile=test > /dev/null
'

test_launch_ipfs_daemon
test_launch_ipfs_daemon_without_network

# Import test case
# See the static fixtures in ./t0114-gateway-subdomains/
Expand All @@ -114,14 +114,8 @@ IPNS_ED25519_B36CID=k51qzi5uqu5dk3v4rmjber23h16xnr23bsggmqqil9z2gduiis5se8dht36d

test_expect_success "Add the test fixtures" '
ipfs dag import ../t0114-gateway-subdomains/fixtures.car &&
ipfs routing put /ipns/${RSA_KEY} ../t0114-gateway-subdomains/${RSA_KEY}.ipns-record &&
ipfs routing put /ipns/${ED25519_KEY} ../t0114-gateway-subdomains/${ED25519_KEY}.ipns-record
'

test_expect_success "Getting back the fixtures" '
ipfs get ${CIDv1} &&
ipfs routing get /ipns/${RSA_KEY} &&
ipfs routing get /ipns/${ED25519_KEY}
ipfs routing put --allow-offline /ipns/${RSA_KEY} ../t0114-gateway-subdomains/${RSA_KEY}.ipns-record &&
ipfs routing put --allow-offline /ipns/${ED25519_KEY} ../t0114-gateway-subdomains/${ED25519_KEY}.ipns-record
'

# ensure we start with empty Gateway.PublicGateways
Expand Down
4 changes: 2 additions & 2 deletions test/sharness/t0116-gateway-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test_description="Test HTTP Gateway Cache Control Support"
. lib/test-lib.sh

test_init_ipfs
test_launch_ipfs_daemon
test_launch_ipfs_daemon_without_network

# Cache control support is based on logical roots (each path segment == one logical root).
# To maximize the test surface, we want to test:
Expand Down Expand Up @@ -36,7 +36,7 @@ TEST_IPNS_ID=k51qzi5uqu5dlxdsdu5fpuu7h69wu4ohp32iwm9pdt9nq3y5rpn3ln9j12zfhe
# See the static fixtures in ./t0116-gateway-cache/
test_expect_success "Add the test directory" '
ipfs dag import ../t0116-gateway-cache/fixtures.car
ipfs routing put /ipns/${TEST_IPNS_ID} ../t0116-gateway-cache/${TEST_IPNS_ID}.ipns-record
ipfs routing put --allow-offline /ipns/${TEST_IPNS_ID} ../t0116-gateway-cache/${TEST_IPNS_ID}.ipns-record
'

# GET /ipfs/
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0123-gateway-json-cbor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test_description="Test HTTP Gateway DAG-JSON (application/vnd.ipld.dag-json) and
. lib/test-lib.sh

test_init_ipfs
test_launch_ipfs_daemon
test_launch_ipfs_daemon_without_network

# Import test case
# See the static fixtures in ./t0123-gateway-json-cbor/
Expand Down Expand Up @@ -167,8 +167,8 @@ IPNS_ID_DAG_JSON=k51qzi5uqu5dhjghbwdvbo6mi40htrq6e2z4pwgp15pgv3ho1azvidttzh8yy2
IPNS_ID_DAG_CBOR=k51qzi5uqu5dghjous0agrwavl8vzl64xckoqzwqeqwudfr74kfd11zcyk3b7l

test_expect_success "Add ipns records for path traversal and DAG-PB representation tests" '
ipfs routing put /ipns/${IPNS_ID_DAG_JSON} ../t0123-gateway-json-cbor/${IPNS_ID_DAG_JSON}.ipns-record &&
ipfs routing put /ipns/${IPNS_ID_DAG_CBOR} ../t0123-gateway-json-cbor/${IPNS_ID_DAG_CBOR}.ipns-record
ipfs routing put --allow-offline /ipns/${IPNS_ID_DAG_JSON} ../t0123-gateway-json-cbor/${IPNS_ID_DAG_JSON}.ipns-record &&
ipfs routing put --allow-offline /ipns/${IPNS_ID_DAG_CBOR} ../t0123-gateway-json-cbor/${IPNS_ID_DAG_CBOR}.ipns-record
'

test_expect_success "GET DAG-JSON traversal returns 501 if there is path remainder" '
Expand Down

0 comments on commit 11d9846

Please sign in to comment.