test_helper

package
v0.0.0-...-2c4a42a Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostgresImage = "postgres:alpine"
	NatsImage     = "nats:alpine"
	MinioImage    = "minio/minio:latest"
)

Variables

This section is empty.

Functions

func CleanupEnv

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

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 SocketReplier

func SocketReplier(t *testing.T, socket mangos.Socket, replier func(interface{}) (proto.Message, error))

func SocketRequest

func SocketRequest(t *testing.T, socket mangos.Socket, task string, request proto.Message, response proto.Message)

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

Types

type Backtest

type Backtest struct {
	Name       string     `json:"name"`
	Status     string     `json:"status"`
	Service    string     `json:"service"`
	Calendar   string     `json:"calendar"`
	Start      time.Time  `json:"start"`
	End        time.Time  `json:"end"`
	Benchmark  string     `json:"benchmark"`
	Symbols    []string   `json:"symbols"`
	IngestedAt *time.Time `json:"ingested_at"`
}

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) (n int, err error)

type Service

type Service struct {
	Name        string    `json:"name" binding:"required"`
	CreatedAt   time.Time `json:"created_at"`
	Image       string    `json:"image"`
	Status      string    `json:"status"`
	ServiceType *string   `json:"type" mapstructure:"type"`
}

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 `json:"name"`
	Backtest string `json:"backtest"`
}

Jump to

Keyboard shortcuts

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