Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
refactor testing / harness to separate packages
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott committed Aug 9, 2023
1 parent 91e6e7d commit 5f2ab23
Show file tree
Hide file tree
Showing 8 changed files with 391 additions and 335 deletions.
11 changes: 11 additions & 0 deletions caboose.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/ipfs/go-cid"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"

"github.com/filecoin-saturn/caboose/internal/state"
)

const (
Expand Down Expand Up @@ -69,6 +71,9 @@ type Config struct {

// CoolOff is the cool off duration for a node once we determine that we shouldn't be sending requests to it for a while.
CoolOff time.Duration

// Harness is an internal test harness that is set during testing.
Harness *state.State
}

const DefaultLoggingInterval = 5 * time.Second
Expand Down Expand Up @@ -155,6 +160,12 @@ func NewCaboose(config *Config) (*Caboose, error) {
c.config.MaxRetrievalAttempts = defaultMaxRetries
}

// Set during testing to leak internal state to the harness.
if c.config.Harness != nil {
c.config.Harness.ActiveNodes = c.pool.ActiveNodes
c.config.Harness.AllNodes = c.pool.AllNodes
}

// start the pool
c.pool.Start()

Expand Down
260 changes: 0 additions & 260 deletions caboose_harness_test.go

This file was deleted.

Loading

0 comments on commit 5f2ab23

Please sign in to comment.