From 648f765afa429fd35302fd168c2a9559ae621276 Mon Sep 17 00:00:00 2001 From: Marcin Rataj <lidel@lidel.org> Date: Mon, 2 Jan 2023 14:51:02 +0100 Subject: [PATCH] fix(test): stabilize flaky provider tests --- test/sharness/t0175-provider.sh | 2 +- test/sharness/t0240-republisher.sh | 4 ++-- test/sharness/t0600-issues-and-regressions-online.sh | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/sharness/t0175-provider.sh b/test/sharness/t0175-provider.sh index 364df60e9..cca110fe1 100755 --- a/test/sharness/t0175-provider.sh +++ b/test/sharness/t0175-provider.sh @@ -22,7 +22,7 @@ test_expect_success 'use strategic providing' ' startup_cluster ${NUM_NODES} test_expect_success 'add test object' ' - HASH_0=$(echo "foo" | ipfsi 0 add -q) + HASH_0=$(date +"%FT%T.%N%z" | ipfsi 0 add -q) ' findprovs_expect '$HASH_0' '$PEERID_0' diff --git a/test/sharness/t0240-republisher.sh b/test/sharness/t0240-republisher.sh index e498007a8..e52b8bee5 100755 --- a/test/sharness/t0240-republisher.sh +++ b/test/sharness/t0240-republisher.sh @@ -74,7 +74,7 @@ num_test_nodes=4 setup_iptb "$num_test_nodes" test_expect_success "publish succeeds" ' - HASH=$(echo "foobar" | ipfsi 1 add -q) && + HASH=$(date +"%FT%T.%N%z" | ipfsi 1 add -q) && ipfsi 1 name publish -t 10s $HASH ' @@ -99,7 +99,7 @@ KEY2=`ipfsi 1 key gen beepboop --type ed25519` ' test_expect_success "publish with new key succeeds" ' - HASH=$(echo "barfoo" | ipfsi 1 add -q) && + HASH=$(date +"%FT%T.%N%z" | ipfsi 1 add -q) && ipfsi 1 name publish -t 10s -k "$KEY2" $HASH ' diff --git a/test/sharness/t0600-issues-and-regressions-online.sh b/test/sharness/t0600-issues-and-regressions-online.sh index 315a9d117..3468f23d6 100755 --- a/test/sharness/t0600-issues-and-regressions-online.sh +++ b/test/sharness/t0600-issues-and-regressions-online.sh @@ -34,15 +34,15 @@ test_expect_success "metrics work" ' ' test_expect_success "pin add api looks right - #3753" ' - HASH=$(echo "foo" | ipfs add -q) && + HASH=$(date +"%FT%T.%N%z" | ipfs add -q) && curl -X POST "http://$API_ADDR/api/v0/pin/add/$HASH" > pinadd_out && - echo "{\"Pins\":[\"QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6\"]}" > pinadd_exp && + echo "{\"Pins\":[\"$HASH\"]}" > pinadd_exp && test_cmp pinadd_out pinadd_exp ' test_expect_success "pin add api looks right - #3753" ' curl -X POST "http://$API_ADDR/api/v0/pin/rm/$HASH" > pinrm_out && - echo "{\"Pins\":[\"QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6\"]}" > pinrm_exp && + echo "{\"Pins\":[\"$HASH\"]}" > pinrm_exp && test_cmp pinrm_out pinrm_exp ' -- GitLab