Skip to content

Commit

Permalink
testing: fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Feb 27, 2024
1 parent cfea189 commit 47bec50
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 3 additions & 0 deletions bus/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func newTestClient(dir string) (*client.Client, func() error, func(context.Conte
}

// create bus
network, genesis := build.Network()
b, cleanup, _, err := node.NewBus(node.BusConfig{
Bus: config.Bus{
AnnouncementMaxAgeHours: 24 * 7 * 52, // 1 year
Expand All @@ -77,6 +78,8 @@ func newTestClient(dir string) (*client.Client, func() error, func(context.Conte
UsedUTXOExpiry: time.Minute,
SlabBufferCompletionThreshold: 0,
},
Network: network,
Genesis: genesis,
SlabPruningInterval: time.Minute,
SlabPruningCooldown: time.Minute,
}, filepath.Join(dir, "bus"), types.GeneratePrivateKey(), zap.New(zapcore.NewNopCore()))
Expand Down
7 changes: 1 addition & 6 deletions stores/hostdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"os"
"reflect"
"testing"
"time"
Expand Down Expand Up @@ -711,11 +710,7 @@ func TestSQLHostAllowlist(t *testing.T) {
}

func TestSQLHostBlocklist(t *testing.T) {
cfg := defaultTestSQLStoreConfig
cfg.persistent = true
cfg.dir = "/Users/peterjan/testing"
os.RemoveAll(cfg.dir)
ss := newTestSQLStore(t, cfg)
ss := newTestSQLStore(t, defaultTestSQLStoreConfig)
defer ss.Close()

ctx := context.Background()
Expand Down
2 changes: 1 addition & 1 deletion stores/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func NewSQLStore(cfg Config) (*SQLStore, error) {
}

if err := os.MkdirAll(cfg.PartialSlabDir, 0700); err != nil {
return nil, fmt.Errorf("failed to create partial slab dir: %v", err)
return nil, fmt.Errorf("failed to create partial slab dir '%s': %v", cfg.PartialSlabDir, err)
}
db, err := gorm.Open(cfg.Conn, &gorm.Config{
Logger: cfg.GormLogger, // custom logger
Expand Down

0 comments on commit 47bec50

Please sign in to comment.