Skip to content

Commit

Permalink
fix: happy path itests (#33)
Browse files Browse the repository at this point in the history
* fix itests

* fix yb connection

* fix lotus env var, update yb image

* add params

* fix param-fetch

* db cleanup

* mv cleanup in DB constructor
  • Loading branch information
LexLuthr authored Jun 4, 2024
1 parent 06bef43 commit 98ffab4
Show file tree
Hide file tree
Showing 4 changed files with 443 additions and 365 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ commands:
name: Restore parameters cache
keys:
- 'v26-2k-lotus-params'
- run: ./lotus fetch-params 2048
- run: ./curio fetch-params 2048
- save_cache:
name: Save parameters cache
key: 'v26-2k-lotus-params'
Expand Down Expand Up @@ -157,7 +157,8 @@ jobs:
- image: cimg/go:1.21
environment:
CURIO_HARMONYDB_HOSTS: yugabyte
- image: yugabytedb/yugabyte:2.18.0.0-b65
LOTUS_HARMONYDB_HOSTS: yugabyte
- image: yugabytedb/yugabyte:2.21.0.1-b1
command: bin/yugabyted start --daemon=false
name: yugabyte
resource_class: << parameters.resource_class >>
Expand Down Expand Up @@ -272,3 +273,4 @@ workflows:
- build
suite: itest-curio
target: "./itests/curio_test.go"
get-params: true
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ require (
github.com/ipfs/go-fs-lock v0.0.7 // indirect
github.com/ipfs/go-graphsync v0.17.0 // indirect
github.com/ipfs/go-ipfs-blockstore v1.3.0 // indirect
github.com/ipfs/go-ipfs-blocksutil v0.0.1 // indirect
github.com/ipfs/go-ipfs-delay v0.0.1 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 // indirect
Expand All @@ -189,6 +190,7 @@ require (
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jessevdk/go-flags v1.4.0 // indirect
Expand Down
26 changes: 16 additions & 10 deletions harmony/harmonydb/harmonydb.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"strings"
"sync"
"sync/atomic"
"testing"
"time"

logging "github.com/ipfs/go-log/v2"
Expand Down Expand Up @@ -57,17 +58,22 @@ func NewFromConfig(cfg config.HarmonyDB) (*DB, error) {
)
}

func NewFromConfigWithITestID(cfg config.HarmonyDB) func(id ITestID) (*DB, error) {
return func(id ITestID) (*DB, error) {
return New(
cfg.Hosts,
cfg.Username,
cfg.Password,
cfg.Database,
cfg.Port,
id,
)
func NewFromConfigWithITestID(t *testing.T, cfg config.HarmonyDB, id ITestID) (*DB, error) {
db, err := New(
cfg.Hosts,
cfg.Username,
cfg.Password,
cfg.Database,
cfg.Port,
id,
)
if err != nil {
return nil, err
}
t.Cleanup(func() {
db.ITestDeleteAll()
})
return db, nil
}

// New is to be called once per binary to establish the pool.
Expand Down
Loading

0 comments on commit 98ffab4

Please sign in to comment.