Skip to content

Commit

Permalink
curio itest: reduce block time
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed May 24, 2024
1 parent c5a4499 commit 74ca5e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 10 additions & 3 deletions itests/curio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/docker/go-units"
"github.com/gbrlsnchs/jwt/v3"
"github.com/google/uuid"
logging "github.com/ipfs/go-log/v2"
manet "github.com/multiformats/go-multiaddr/net"
"github.com/stretchr/testify/require"
"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -107,6 +108,8 @@ func TestCurioHappyPath(t *testing.T) {
blockTime := 100 * time.Millisecond
esemble.BeginMining(blockTime)

full.WaitTillChain(ctx, kit.HeightAtLeast(15))

err := miner.LogSetLevel(ctx, "*", "ERROR")
require.NoError(t, err)

Expand Down Expand Up @@ -194,13 +197,17 @@ func TestCurioHappyPath(t *testing.T) {
}

require.Eventuallyf(t, func() bool {
h, err := full.ChainHead(ctx)
require.NoError(t, err)
t.Logf("head: %d", h.Height())

err = db.Select(ctx, &sectorParamsArr, `
SELECT sp_id, sector_number
FROM sectors_sdr_pipeline
WHERE after_commit_msg_success = True`)
require.NoError(t, err)
return len(sectorParamsArr) == 1
}, 5*time.Minute, 1*time.Second, "sector did not finish sealing in 5 minutes")
}, 10*time.Minute, 1*time.Second, "sector did not finish sealing in 5 minutes")

require.Equal(t, sectorParamsArr[0].SectorNumber, int64(0))
require.Equal(t, sectorParamsArr[0].SpID, int64(mid))
Expand Down Expand Up @@ -281,7 +288,7 @@ func createCliContext(dir string) (*cli.Context, error) {
sflag := fmt.Sprintf("--journal=%s", storage)

// Parse the flags with test values
err := set.Parse([]string{"--listen=0.0.0.0:12345", "--nosync", "--manage-fdlimit", sflag, cflag, "--layers=seal", "--layers=post"})
err := set.Parse([]string{"--listen=0.0.0.0:12345", "--nosync", "--manage-fdlimit", sflag, cflag, "--layers=seal"})
if err != nil {
return nil, xerrors.Errorf("Error setting flag: %s\n", err)
}
Expand Down Expand Up @@ -385,7 +392,7 @@ func ConstructCurioTest(ctx context.Context, t *testing.T, dir string, db *harmo
err = capi.StorageAddLocal(ctx, dir)
require.NoError(t, err)

err = capi.LogSetLevel(ctx, "harmonytask", "DEBUG")
logging.SetLogLevel("harmonytask", "DEBUG")

Check failure on line 395 in itests/curio_test.go

View workflow job for this annotation

GitHub Actions / Check (lint-all)

Error return value of `logging.SetLogLevel` is not checked (errcheck)

return capi, taskEngine.GracefullyTerminate, ccloser, finishCh
}
8 changes: 4 additions & 4 deletions lib/ffiselect/ffiselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ func subStrInSet(set []string, sub string) bool {
}

func call(logctx []any, fn string, args ...interface{}) ([]interface{}, error) {
if IsTest {
return callTest(logctx, fn, args...)
}

// get dOrdinal
dOrdinal := <-ch
defer func() {
ch <- dOrdinal
}()

if IsTest {
return callTest(logctx, fn, args...)
}

p, err := os.Executable()
if err != nil {
return nil, err
Expand Down

0 comments on commit 74ca5e6

Please sign in to comment.