framework

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 38 Imported by: 0

README

Framework

Modular and data-driven harness for Chainlink on-chain and off-chain components.

Documentation

Documentation

Index

Constants

View Source
const (
	EnvVarTestConfigs       = "CTF_CONFIGS"
	EnvVarAWSSecretsManager = "CTF_AWS_SECRETS_MANAGER"
	// EnvVarCI this is a default env variable many CI runners use so code can detect we run in CI
	EnvVarCI = "CI"
)
View Source
const (
	OutputFieldNameTOML = "out"
	OutputFieldName     = "Out"
	OverridesFieldName  = "Overrides"
)
View Source
const (
	DefaultCTFLogsDir = "logs/docker"
)
View Source
const (
	DefaultConfigDir = "."
)
View Source
const (
	EnvVarIgnoreCriticalLogs = "CTF_IGNORE_CRITICAL_LOGS"
)
View Source
const (
	EnvVarLogLevel = "CTF_LOG_LEVEL"
)

Variables

View Source
var (

	// Secrets is a singleton AWS Secrets Manager
	// Loaded once on start inside Load and is safe to call concurrently
	Secrets *AWSSecretsManager

	DefaultNetworkName string

	AllowedEmptyConfigurationFields = []string{OutputFieldName, OverridesFieldName}
)
View Source
var (
	PathRoot = filepath.Join(filepath.Dir(b), ".")
)

Functions

func BuildImage added in v0.3.1

func BuildImage(dctx, dfile, nameAndTag string) error

func BuildImageOnce added in v0.2.13

func BuildImageOnce(once *sync.Once, dctx, dfile, nameAndTag string) error

func DefaultNetwork added in v0.1.1

func DefaultNetwork(once *sync.Once) error

func DefaultTCLabels

func DefaultTCLabels() map[string]string

func DefaultTCName

func DefaultTCName(name string) string

func GetHost

func GetHost(container tc.Container) (string, error)

func HostDockerInternal added in v0.2.10

func HostDockerInternal() string

HostDockerInternal returns host.docker.internal that works both locally and in GHA

func IsDockerRunning added in v0.1.6

func IsDockerRunning() bool

func Load

func Load[X any](t *testing.T) (*X, error)

func MapTheSamePort

func MapTheSamePort(port string) nat.PortMap

func NewPromtail added in v0.1.6

func NewPromtail() error

func RenderTemplate

func RenderTemplate(tmpl string, data interface{}) (string, error)

func RunCommandDir added in v0.3.1

func RunCommandDir(dir, name string, args ...string) error

RunCommandDir executes a command in some directory and prints the output

func Store

func Store[T any](cfg *T) error

func WriteAllContainersLogs added in v0.2.11

func WriteAllContainersLogs(dir string) error

WriteAllContainersLogs writes all Docker container logs to the default logs directory

Types

type AWSSecret

type AWSSecret string

AWSSecret is a wrapper preventing accidental printing or marshalling

func (AWSSecret) GoString

func (s AWSSecret) GoString() string

The GoString method is used to print values passed as an operand to a %#v format.

func (AWSSecret) MarshalJSON

func (s AWSSecret) MarshalJSON() ([]byte, error)

MarshalJSON Marshaler is the interface implemented by types that can marshal themselves into valid JSON.

func (AWSSecret) MarshalText

func (s AWSSecret) MarshalText() ([]byte, error)

MarshalText encodes the receiver into UTF-8-encoded text and returns the result.

func (AWSSecret) String

func (s AWSSecret) String() string

The String method is used to print values passed as an operand to any format that accepts a string or to an unformatted printer such as Print.

func (AWSSecret) Value

func (s AWSSecret) Value() string

Value is used to return masked secret value

type AWSSecretsManager

type AWSSecretsManager struct {
	Client         *secretsmanager.Client
	RequestTimeout time.Duration
	// contains filtered or unexported fields
}

AWSSecretsManager is an AWS Secrets Manager service wrapper

func NewAWSSecretsManager

func NewAWSSecretsManager(requestTimeout time.Duration) (*AWSSecretsManager, error)

NewAWSSecretsManager create a new connection to AWS Secrets Manager

func (*AWSSecretsManager) CreateSecret

func (sm *AWSSecretsManager) CreateSecret(key string, val string, override bool) error

CreateSecret creates a specific secret by key

func (*AWSSecretsManager) GetSecret

func (sm *AWSSecretsManager) GetSecret(key string) (AWSSecret, error)

GetSecret gets a specific secret by key

func (*AWSSecretsManager) RemoveSecret

func (sm *AWSSecretsManager) RemoveSecret(key string, noRecovery bool) error

RemoveSecret removes a specific secret by key

type Config

type Config struct {
	LokiURL               string
	LokiTenantID          string
	LokiBasicAuthUsername string
	LokiBasicAuthPassword string
}

type DockerClient added in v0.2.7

type DockerClient struct {
	// contains filtered or unexported fields
}

DockerClient wraps a Docker API client and provides convenience methods

func NewDockerClient added in v0.2.7

func NewDockerClient() (*DockerClient, error)

NewDockerClient creates a new instance of DockerClient

func (*DockerClient) CopyFile added in v0.2.7

func (dc *DockerClient) CopyFile(containerName, sourceFile, targetPath string) error

CopyFile copies a file into a container by name

type JSONStrDuration added in v0.1.1

type JSONStrDuration struct {
	time.Duration
}

JSONStrDuration is JSON friendly duration that can be parsed from "1h2m0s" Go format

func (*JSONStrDuration) MarshalJSON added in v0.1.1

func (d *JSONStrDuration) MarshalJSON() ([]byte, error)

func (*JSONStrDuration) UnmarshalJSON added in v0.1.1

func (d *JSONStrDuration) UnmarshalJSON(b []byte) error

type ValidationError

type ValidationError struct {
	Field   string
	Value   interface{}
	Message string
}

Directories

Path Synopsis
components
jd

Jump to

Keyboard shortcuts

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