test_helper

package
v0.0.0-...-23a1a97 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostgresImage = "postgres:alpine"
	NatsImage     = "nats:alpine"
	MinioImage    = "minio/minio:latest"
)
View Source
const (
	NetworkID = "foreverbull-testing-network"
)

Variables

This section is empty.

Functions

func CleanupEnv

func CleanupEnv(t *testing.T, workerService Service, backtestService Service, backtest Backtest,
	strategy *Strategy,
)

func Example

func Example(_ *pb.WorkerRequest) *pb.WorkerResponse

func LokiContainerAndLogging

func LokiContainerAndLogging(t *testing.T, networkID string) (ConnectionString string)

func MinioContainer

func MinioContainer(t *testing.T, networkID string) (ConnectionString, AccessKey, SecretKey string)

func NATSContainer

func NATSContainer(t *testing.T, networkID string) (ConnectionString string)

func PostgresContainer

func PostgresContainer(t *testing.T, networkID string) (ConnectionString string)

func Request

func Request(t *testing.T, method string, endpoint string, payload interface{}) *http.Response

func SetUpEnv

func SetUpEnv(t *testing.T, backtest Backtest, strategy *Strategy) error

func SetupEnvironment

func SetupEnvironment(t *testing.T, containers *Containers)

func WaitTillContainersAreRemoved

func WaitTillContainersAreRemoved(t *testing.T, networkID string, timeout time.Duration)

func WaitUntilCondition

func WaitUntilCondition(t *testing.T, condition func() (bool, error), timeout time.Duration) error

func WorkerSimulator

func WorkerSimulator(t *testing.T, functions ...*WorkerFunction) (*pb.Algorithm, func(socket mangos.Socket))

Types

type Backtest

type Backtest struct {
	Name       string
	Status     string
	Service    string
	Calendar   string
	Start      time.Time
	End        time.Time
	Benchmark  string
	Symbols    []string
	IngestedAt *time.Time
}

type Containers

type Containers struct {
	Postgres bool
	NATS     bool
	Minio    bool
	Loki     bool
}

type LokiLogger

type LokiLogger struct {
	LokiURL string
	// contains filtered or unexported fields
}

func (*LokiLogger) Publish

func (l *LokiLogger) Publish(t *testing.T)

func (*LokiLogger) Write

func (l *LokiLogger) Write(p []byte) (int, error)

type Service

type Service struct {
	Name        string
	CreatedAt   time.Time
	Image       string
	Status      string
	ServiceType *string
}

type ServiceInstance

type ServiceInstance struct {
	Host string
	Port int
	// contains filtered or unexported fields
}

func NewServiceInstance

func NewServiceInstance(t *testing.T) *ServiceInstance

func (*ServiceInstance) Close

func (s *ServiceInstance) Close() error

func (*ServiceInstance) Process

func (s *ServiceInstance) Process(ctx context.Context, responses map[string][]byte)

type Strategy

type Strategy struct {
	Name     string
	Backtest string
}

type WorkerFunction

type WorkerFunction struct {
	CB       func(*pb.WorkerRequest) *pb.WorkerResponse
	Name     string
	Parallel bool
	RunFirst bool
	RunLast  bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL