Documentation
¶
Index ¶
- Constants
- Variables
- func BaseCacheName() (string, error)
- func BaseConfigName() (string, error)
- func BaseConfigPath() (string, error)
- func BlockScoutDown(url string) error
- func BlockScoutUp(url, chainID string) error
- func BuildImage(dctx, dfile, nameAndTag string, buildArgs map[string]string) error
- func BuildImageOnce(once *sync.Once, dctx, dfile, nameAndTag string, buildArgs map[string]string) error
- func CheckCLNodeContainerErrors() error
- func CheckOut(ref string) error
- func DefaultNetwork(_ *sync.Once) error
- func DefaultTCLabels() map[string]string
- func DefaultTCName(name string) string
- func ExecCmd(command string) ([]byte, error)
- func ExecCmdWithContext(ctx context.Context, command string) ([]byte, error)
- func ExecCmdWithOpts(ctx context.Context, command string, stdoutFunc func(string), ...) ([]byte, error)
- func FilterSemverTags(versions []string, include []string, exclude []string) []string
- func FindNOPsVersionsByProduct(url string, product string, exclude []string) ([]string, error)
- func FindSemVerRefSequence(tagsBack int, include, exclude []string) ([]string, error)
- func GenerateCustomPortsData(portsProvided []string) ([]string, nat.PortMap, error)
- func GetHost(container tc.Container) (string, error)
- func GetHostWithContext(ctx context.Context, container tc.Container) (string, error)
- func HostDockerInternal() string
- func IsDockerRunning() bool
- func Load[X any](t *testing.T) (*X, error)
- func LoadCache[X any](t *testing.T) (*X, error)
- func MapTheSamePort(ports ...string) nat.PortMap
- func MustParseDuration(s string) time.Duration
- func NewPromtail() error
- func NoDNS(noDNS bool, hc *container.HostConfig)
- func ObservabilityDown() error
- func ObservabilityUp() error
- func ObservabilityUpFull() error
- func ObservabilityUpOnlyLoki() error
- func RemoveTestContainers() error
- func RemoveTestStack(name string) error
- func RenderTemplate(tmpl string, data interface{}) (string, error)
- func ResourceLimitsFunc(h *container.HostConfig, resources *ContainerResources)
- func RunCommand(name string, args ...string) error
- func RunCommandDir(dir, name string, args ...string) error
- func RunInitialUpgradeSetup(ctx context.Context, u UpgradeContext) error
- func SaveAndCheckLogs(t *testing.T) error
- func SaveContainerLogs(dir string) ([]string, error)
- func SearchLogFile(fp string, regex string) ([]string, error)
- func Store[T any](cfg *T) error
- func StreamContainerLogs(listOptions container.ListOptions, logOptions container.LogsOptions) (map[string]io.ReadCloser, error)
- func ToLabelsMap(response *PrometheusQueryResponse) map[string][]interface{}
- func UpgradeContainer(ctx context.Context, containerName, newImage string) error
- func UpgradeNProductUniqueVersionsRolling(ctx context.Context, u UpgradeContext) error
- func UpgradeNRolling(ctx context.Context, u UpgradeContext) error
- func WriteRollingNUpgradeSummary(tmpl UpgradeNRollingSummaryTemplate) error
- func WriteSOTDONUpgradeSummary(tmpl UpgradeSOTDONSummary) error
- type APIError
- type Annotation
- type BasicAuth
- type CIECRAuthAction
- type CILoadChaosParams
- type CISmokeParams
- type CLDFParams
- type CLICompletionParams
- type CLIParams
- type Config
- type ConfigParams
- type ConfigTOMLParams
- type ContainerResources
- type DevEnvInterfaceParams
- type DockerClient
- func (dc *DockerClient) CopyFile(containerName, sourceFile, targetPath string) error
- func (dc *DockerClient) ExecContainer(containerName string, command []string) (string, error)
- func (dc *DockerClient) ExecContainerOptions(containerName string, execConfig container.ExecOptions) (string, error)
- func (dc *DockerClient) ExecContainerOptionsWithContext(ctx context.Context, containerName string, execConfig container.ExecOptions) (string, error)
- func (dc *DockerClient) ExecContainerWithContext(ctx context.Context, containerName string, command []string) (string, error)
- type EnvBuilder
- type EnvCodegen
- func (g *EnvCodegen) GenerateCIFunctional() (string, error)
- func (g *EnvCodegen) GenerateCIPerf() (string, error)
- func (g *EnvCodegen) GenerateCLI(dashboardUUID string) (string, error)
- func (g *EnvCodegen) GenerateCLICompletion() (string, error)
- func (g *EnvCodegen) GenerateConfig() (string, error)
- func (g *EnvCodegen) GenerateDefaultTOMLConfig() (string, error)
- func (g *EnvCodegen) GenerateECRAuthAction() (string, error)
- func (g *EnvCodegen) GenerateEnvironment() (string, error)
- func (g *EnvCodegen) GenerateFakesDockerfile() (string, error)
- func (g *EnvCodegen) GenerateFakesGoModule() (string, error)
- func (g *EnvCodegen) GenerateFakesImpl() (string, error)
- func (g *EnvCodegen) GenerateFakesJustfile() (string, error)
- func (g *EnvCodegen) GenerateGitIgnore() (string, error)
- func (g *EnvCodegen) GenerateGoMod() (string, error)
- func (g *EnvCodegen) GenerateGrafanaDashboard(uuid string) (string, error)
- func (g *EnvCodegen) GenerateJD() (string, error)
- func (g *EnvCodegen) GenerateJustfile() (string, error)
- func (g *EnvCodegen) GenerateLoadTests() (string, error)
- func (g *EnvCodegen) GenerateProductBasicConfigParams() (string, error)
- func (g *EnvCodegen) GenerateProductCommon() (string, error)
- func (g *EnvCodegen) GenerateProductImpl() (string, error)
- func (g *EnvCodegen) GenerateProductSoakConfigParams() (string, error)
- func (g *EnvCodegen) GenerateProductsConfig() (string, error)
- func (g *EnvCodegen) GenerateProductsInterface() (string, error)
- func (g *EnvCodegen) GenerateReadme() (string, error)
- func (g *EnvCodegen) GenerateServiceImpl() (string, error)
- func (g *EnvCodegen) GenerateSmokeTests() (string, error)
- func (g *EnvCodegen) GenerateTableTest() (string, error)
- func (g *EnvCodegen) GenerateTestCases() ([]TestCaseParams, error)
- func (g *EnvCodegen) Read() error
- func (g *EnvCodegen) Write() error
- func (g *EnvCodegen) WriteFakes() error
- func (g *EnvCodegen) WriteProducts() error
- func (g *EnvCodegen) WriteServices() error
- type EnvParams
- type GitIgnoreParams
- type GoModParams
- type GrafanaClient
- type GrafanaDashboardParams
- type JSONStrDuration
- type JustfileParams
- type LoadTestParams
- type LogEntry
- type LokiClient
- type PostAnnotationResponse
- type ProductBasicConfigParams
- type ProductCommonParams
- type ProductConfigParams
- type ProductConfigurationSimple
- type ProductFakesDockerfileParams
- type ProductFakesGoModuleParams
- type ProductFakesImplParams
- type ProductFakesJustfileParams
- type ProductImplParams
- type ProductSoakConfigParams
- type PromQueryResponseData
- type PromQueryResponseResult
- type PrometheusQueryClient
- type PrometheusQueryResponse
- type QueryParams
- type QueryRangeParams
- type QueryRangeResponse
- type RaneSOTResponseBody
- type ReadmeParams
- type Response
- type SmokeTestParams
- type SvcImplParams
- type TableTestParams
- type TestCaseParams
- type UpgradeContext
- type UpgradeNRollingSummaryTemplate
- type UpgradeSOTDONSummary
- type ValidationError
Constants ¶
const ( EnvVarTestConfigs = "CTF_CONFIGS" //nolint 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" )
const ( DefaultConfigFilePath = "env.toml" DefaultOverridesFilePath = "overrides.toml" )
const ( LocalGrafanaBaseURL = "http://localhost:3000" LocalLokiBaseURL = "http://localhost:3030" LocalPrometheusBaseURL = "http://localhost:9099" LocalPyroscopeBaseURL = "http://localhost:4040" LocalCLNodeErrorsURL = "http://localhost:3000/d/a7de535b-3e0f-4066-bed7-d505b6ec9ef1/cl-node-errors?orgId=1&refresh=5s" LocalWorkflowEngineURL = "http://localhost:3000/d/ce589a98-b4be-4f80-bed1-bc62f3e4414a/workflow-engine?orgId=1&refresh=5s&from=now-15m&to=now" LocalLogsURL = "" /* 410-byte string literal not displayed */ LocalPrometheusURL = "" /* 350-byte string literal not displayed */ LocalPostgresDebugURL = "" /* 262-byte string literal not displayed */ LocalPyroScopeURL = "" /* 134-byte string literal not displayed */ CTFObservabilityCacheDir = ".local/share/ctf" CTFLocalDashboardsDirRelative = "dashboards" )
const ( // ProductDashboardUUID is a default product dashboard uuid, can be static since it's our local environment ProductDashboardUUID = "f8a04cef-653f-46d3-86df-87c532300672" ReadmeTmpl = `## Chainlink Developer Environment This template provides a complete Chainlink development environment with pre-configured infrastructure and observability tools. The goal of this local environment is to: - Provide a simple and modular environment harness for developers to accelerate "inner" developer loop - Implement standard functional system-level tests - Implement standard non-functional system-level tests - Implement standard 3rd party dependencies fakes so other teams can see your product requirements clearly 💻 Enter the shell to start: ` + "```" + `bash just cli && {{ .CLIName }} sh ` + "```" + ` ## Functional Testing 🔍 Implement your product configuration (see comnents in [configurator.go](./products/productone/configurator.go)) Add any additional product services using this [template](./services/svc.go) Start the environment. ` + "```" + `bash up ↵ ` + "```" + ` 🔍 Implement system-level functional tests [func_test.go](./tests/{{ .ProductName }}/func_test.go) and run them: ` + "```" + `bash test func ↵ ` + "```" + ` You can use ` + "`" + `restart ↵` + "`" + ` for quick iteration or ` + "`" + `{{ .CLIName }} r` + "`" + ` 🔄 **Enforce** quality standards in CI: copy [workflow](.github/workflows/devenv-func-test.yml) to your CI folder, commit and make them pass ## Non-functional Testing 📈 Start the observability stack ` + "```" + `bash obs u -f ↵ ` + "```" + ` 📈 Implement your product observability and [dashboard](http://localhost:3000/dashboards) (your dashboard is local/{{ .ProductName }} Services) To reflect changes you can restart the environment and it'd be uploaded automatically from [dashboards](./dashboards/{{ .ProductName }}.json) 📈 Implement load/chaos tests [perf_test.go](./tests/{{ .ProductName }}/perf_test.go) and run them: ` + "```" + `bash obs up -f ↵ # spin up the observability stack first test perf ↵ ` + "```" + ` You can use ` + "`" + `restart ↵` + "`" + ` for quick iteration or ` + "`" + `mycli r` + "`" + ` The same works for observability stack: ` + "`" + `obs r -f ↵` + "`" + ` or ` + "`" + `{{ .CLIName }} obs r -f` + "`" + ` We are using WASP load generator to make our tests composable and protocol agnostic, read more [here](https://smartcontractkit.github.io/chainlink-testing-framework/libs/wasp/overview.html?highlight=wasp#wasp---overview). 🔄 **Enforce** quality standards in CI: copy [workflow](.github/workflows/devenv-perf-test.yml) to your CI folder, commit and make them pass ## Fakes (HTTP) To speed up development and integration with 3rd party services we have a "fakes" Docker container ready. 🔍 Implement [fakes](./fakes/main.go) for 3rd party services your need, rebuild the container and run: ` + "```" + `bash just build-fakes ` + "```" + ` See how you can access your fake HTTP methods in [functional tests](./tests/{{ .ProductName }}/func_test.go) ## Running multiple instances of a product on a single environment Just increase the amount of instances in [env.toml](./env.toml) ` + "```" + `bash [[products]] name = "{{ .ProductName }}" instances = 20 ` + "```" + ` Your implementation of ` + "`" + `ConfigureJobsAndContracts` + "`" + ` method should be able to deploy multiple instances. You may use ` + "`" + `instanceIdx` + "`" + ` to run different deployments for each instance. ## Running multiple products in a single environment Is simple, just copy [{{ .ProductName }}](./products/{{ .ProductName }})) and [tests/{{ .ProductName }}](./tests/{{ .ProductName }}) directories and add a new entry [here](./environment.go) in "newProduct" function. ## Adding more Node sets (DONs) See [env.toml](./env.toml) comments. ` // ProductsInterfaceTmpl common interface for arbitrary products deployed in devenv ProductsInterfaceTmpl = `` /* 1860-byte string literal not displayed */ // GoModTemplate go module template GoModTemplate = `` /* 725-byte string literal not displayed */ // GitIgnoreTmpl default gitignore template GitIgnoreTmpl = `compose/ blockscout/ env-out.toml` // GrafanaDashboardTmpl is a Grafana dashboard template for your product GrafanaDashboardTmpl = `` /* 18430-byte string literal not displayed */ // ConfigTOMLTmpl is a default env.toml template for devenv describind components configuration ConfigTOMLTmpl = `` /* 1132-byte string literal not displayed */ // CINonFunctionalTmpl is a continuous integration template for end-to-end load/chaos tests CINonFunctionalTmpl = `` /* 2443-byte string literal not displayed */ CIECRAuthActionTmpl = `` /* 1049-byte string literal not displayed */ // CIFunctionalTmpl is a continuous integration template for end-to-end smoke tests CIFunctionalTmpl = `` /* 2469-byte string literal not displayed */ // CompletionTmpl is a go-prompt library completion template providing interactive prompt CompletionTmpl = `` /* 5211-byte string literal not displayed */ // CLITmpl is a Cobra library CLI template with basic devenv commands CLITmpl = `` /* 8258-byte string literal not displayed */ // LoadTestTmpl is a load/chaos test template LoadTestTmpl = `` /* 3252-byte string literal not displayed */ SmokeTestImplTmpl = `` /* 1136-byte string literal not displayed */ // JDTmpl is a JobDistributor client wrappers JDTmpl = `` /* 1998-byte string literal not displayed */ // DebugToolsTmpl is a template for various debug tools, tracing, tx debug, etc DebugToolsTmpl = `` /* 304-byte string literal not displayed */ // ConfigTmpl is a template for reading and writing devenv configuration (env.toml, env-out.toml) ConfigTmpl = `` /* 3672-byte string literal not displayed */ // EnvironmentTmpl is an environment.go template - main file for environment composition EnvironmentTmpl = `package {{ .PackageName }} import ( "context" "errors" "fmt" "os" "strings" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/framework" "github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake" "github.com/smartcontractkit/chainlink-testing-framework/framework/components/jd" "github.com/smartcontractkit/{{ .ProductName }}/devenv/products/{{ .ProductName }}" "github.com/smartcontractkit/{{ .ProductName }}/devenv/services" ns "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set" ) var L = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).Level(zerolog.DebugLevel).With().Fields(map[string]any{"component": "{{ .ProductName }}"}).Logger() type ProductInfo struct { Name string ` + "`" + `toml:"name"` + "`" + ` Instances int ` + "`" + `toml:"instances"` + "`" + ` } type Cfg struct { Products []*ProductInfo ` + "`" + `toml:"products"` + "`" + ` Service *services.ExampleSvcInput ` + "`" + `toml:"example_service"` + "`" + ` Blockchains []*blockchain.Input ` + "`" + `toml:"blockchains" validate:"required"` + "`" + ` FakeServer *fake.Input ` + "`" + `toml:"fake_server" validate:"required"` + "`" + ` NodeSets []*ns.Input ` + "`" + `toml:"nodesets" validate:"required"` + "`" + ` JD *jd.Input ` + "`" + `toml:"jd"` + "`" + ` } func newProduct(name string) (Product, error) { switch name { case "{{ .ProductName }}": return {{ .ProductName }}.NewConfigurator(), nil default: return nil, fmt.Errorf("unknown product type: %s", name) } } func NewEnvironment(ctx context.Context) error { if err := framework.DefaultNetwork(nil); err != nil { return err } in, err := Load[Cfg]() if err != nil { return fmt.Errorf("failed to load configuration: %w", err) } for _, bcNet := range in.Blockchains { _, err = blockchain.NewBlockchainNetwork(bcNet) if err != nil { return fmt.Errorf("failed to create blockchain network %s: %w", bcNet.ChainID, err) } } if os.Getenv("FAKE_SERVER_IMAGE") != "" { in.FakeServer.Image = os.Getenv("FAKE_SERVER_IMAGE") } _, err = fake.NewDockerFakeDataProvider(in.FakeServer) if err != nil { return fmt.Errorf("failed to create fake data provider: %w", err) } if err := services.NewService(in.Service); err != nil { return fmt.Errorf("failed to create example service: %w", err) } // get all the product orchestrations, generate product specific overrides productConfigurators := make([]Product, 0) nodeConfigs := make([]string, 0) nodeSecrets := make([]string, 0) for _, product := range in.Products { p, err := newProduct(product.Name) if err != nil { return err } if err = p.Load(); err != nil { return fmt.Errorf("failed to load product config: %w", err) } cfg, err := p.GenerateNodesConfig(ctx, in.FakeServer, in.Blockchains, in.NodeSets) if err != nil { return fmt.Errorf("failed to generate CL nodes config: %w", err) } nodeConfigs = append(nodeConfigs, cfg) secrets, err := p.GenerateNodesSecrets(ctx, in.FakeServer, in.Blockchains, in.NodeSets) if err != nil { return fmt.Errorf("failed to generate CL nodes config: %w", err) } nodeSecrets = append(nodeSecrets, secrets) productConfigurators = append(productConfigurators, p) } // merge overrides, spin up node sets and write infrastructure outputs // infra is always common for all the products, if it can't be we should fail // user should use different infra layout in env.toml then for _, nodeSet := range in.NodeSets { for _, nodeSpec := range nodeSet.NodeSpecs { nodeSpec.Node.TestConfigOverrides = strings.Join(nodeConfigs, "\n") nodeSpec.Node.TestSecretsOverrides = strings.Join(nodeSecrets, "\n") if os.Getenv("CHAINLINK_IMAGE") != "" { nodeSpec.Node.Image = os.Getenv("CHAINLINK_IMAGE") } } _, err = ns.NewSharedDBNodeSet(nodeSet, nil) if err != nil { return fmt.Errorf("failed to create new shared db node set: %w", err) } } if err := Store(in); err != nil { return err } // deploy all products and all instances, // product config function controls what to read and how to orchestrate each instance // via their own TOML part, we only deploy N instances of product M for productIdx, productInfo := range in.Products { for productInstance := range productInfo.Instances { err = productConfigurators[productIdx].ConfigureJobsAndContracts( ctx, productInstance, in.FakeServer, in.Blockchains, in.NodeSets, ) if err != nil { return fmt.Errorf("failed to setup default product deployment: %w", err) } if err := productConfigurators[productIdx].Store("env-out.toml", productInstance); err != nil { return errors.New("failed to store product config") } } } for nsIdx, ns := range in.NodeSets { L.Info().Int("Idx", nsIdx).Str("Name", ns.Name).Msg("Created node set") for _, n := range ns.Out.CLNodes { L.Info().Str("Node", n.Node.ExternalURL).Send() } } return nil } ` // JustFileTmpl is a Justfile template used for building and publishing Docker images JustFileTmpl = `` /* 311-byte string literal not displayed */ )
const ( ProductSoakConfigTmpl = `` /* 272-byte string literal not displayed */ ProductBasicConfigTmpl = `` /* 211-byte string literal not displayed */ ProductsImplTmpl = `package {{ .ProductName }} import ( "context" "fmt" "os" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake" "github.com/smartcontractkit/chainlink-testing-framework/framework/clclient" nodeset "github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_node_set" "github.com/smartcontractkit/{{ .ProductName }}/devenv/products" ) /* This is the implementation of your product configuration running on Chainlink platform. */ var L = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).Level(zerolog.DebugLevel).With().Fields(map[string]any{"component": "{{ .ProductName }}"}).Logger() // ProductConfig contains fields you want to be configurable for your product setup, don't forget to add "toml" annotations, use snake_case. // Out field is mandatory if you want tests to read some data about your product. type ProductConfig struct { Out *ProductConfigOutput ` + "`" + `toml:"out"` + "`" + ` } // ProductConfigOutput contains fields that are exposed after your product is deployed, // for example: contract addresses, services URLs, etc. type ProductConfigOutput struct { ExampleField string ` + "`" + `toml:"example"` + "`" + ` } // Configurator is your product configurator, it may contain configs for multiple instances of your product deployed on a single environment. // For example, for soak/volume testing it makes sense to deploy 10-100 feeds with slightly different configurations to figure out performance and resource consumption. type Configurator struct { Config []*ProductConfig ` + "`" + `toml:"{{ .ProductName }}"` + "`" + ` } // NewConfigurator creates new configurator instance func NewConfigurator() *Configurator { return &Configurator{} } // Load implements loading product-specific config from TOML file, see products/config.go // Most of the time you don't need to change anything here. func (m *Configurator) Load() error { cfg, err := products.Load[Configurator]() if err != nil { return fmt.Errorf("failed to load product config: %w", err) } m.Config = cfg.Config return nil } // Store implements storing your configuration outputs in "env-out.toml" file. // You may store different outputs for each instance of your product (for example different outputs for each OCR feed when you deploy tens of them). // Most of the time you don't need to change anything here. func (m *Configurator) Store(path string, idx int) error { if err := products.Store(".", m); err != nil { return fmt.Errorf("failed to store product config: %w", err) } return nil } // GenerateNodesConfig implements how your product configures Chainlink nodes via TOML config // Use Chainlink client from framework if needed and generate TOML config for Chainlink nodes. func (m *Configurator) GenerateNodesConfig( ctx context.Context, fs *fake.Input, bc []*blockchain.Input, ns []*nodeset.Input, ) (string, error) { L.Info().Msg("Generating Chainlink node config") // in this case we have only a single node set firstNodeSet := ns[0] _ = firstNodeSet // in this case we only have a single blockchain type firstBlockchain := bc[0] // environment config for CL nodes _ = firstBlockchain.Out.Nodes[0] // chain ID _ = firstBlockchain.Out.ChainID return "", nil } func (m *Configurator) GenerateNodesSecrets( ctx context.Context, fs *fake.Input, bc []*blockchain.Input, ns []*nodeset.Input, ) (string, error) { L.Info().Msg("Generating Chainlink node secrets") // in this case we only have a single blockchain type firstBlockchain := bc[0] // blockchain info for blockchain 0 and node 0 _ = firstBlockchain.Out.Nodes[0] // chain ID for blockchain 0 _ = firstBlockchain.Out.ChainID return "", nil } func (m *Configurator) ConfigureJobsAndContracts( ctx context.Context, productIdx int, fake *fake.Input, bc []*blockchain.Input, ns []*nodeset.Input, ) error { // in this case we have only a single node set firstNodeSet := ns[0] // connect to Chainlink nodes and use the client to get keys and other data if needed cl, err := clclient.New(firstNodeSet.Out.CLNodes) if err != nil { return err } _ = cl // write an example output of your product configuration // contract addresses, URLs, etc // in soak test case it may hold multiple configs and have different outputs // for each instance m.Config[0].Out = &ProductConfigOutput{ExampleField: "my_data"} L.Info().Msg("Configuring product: {{ .ProductName }}") return nil } ` ProductsConfigTmpl = `` /* 2435-byte string literal not displayed */ ProductsCommonTmpl = `` /* 4951-byte string literal not displayed */ )
const ( ProductFakesJustfile = `` /* 708-byte string literal not displayed */ ProductFakesImplTmpl = `` /* 700-byte string literal not displayed */ ProductFakesGoModuleTmpl = `` /* 363-byte string literal not displayed */ ProductFakesDockerfileTmpl = `` /* 314-byte string literal not displayed */ )
const (
CISummaryFile = "ci_summary.txt"
)
const (
DefaultCTFLogsDir = "logs/docker"
)
const (
DefaultConfigDir = "."
)
const (
EnvVarIgnoreCriticalLogs = "CTF_IGNORE_CRITICAL_LOGS"
)
const (
EnvVarLogLevel = "CTF_LOG_LEVEL"
)
const (
ProductComponentImpl = `
package services
/*
* A simple template to add your project services to devenv.
* Each service should have a file with Input/Output struct and a function deploying it.
*/
import (
"context"
"fmt"
"os"
"strconv"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/testcontainers/testcontainers-go"
)
var L = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).Level(zerolog.DebugLevel).With().Fields(map[string]any{"component": "datastreams"}).Logger()
const (
DefaultExampleSvcName = "example-service"
DefaultExampleSvcImage = "busybox:latest"
)
// ExampleSvcInput example service input
type ExampleSvcInput struct {
Image string ` + "`" + `toml:"image"` + "`" + `
Port int ` + "`" + `toml:"port"` + "`" + `
ContainerName string ` + "`" + `toml:"container_name"` + "`" + `
EnvVars map[string]string ` + "`" + `toml:"env_vars"` + "`" + `
Out *ExampleSvcOutput ` + "`" + `toml:"out"` + "`" + `
}
// Default is a default input configuration
func (s *ExampleSvcInput) Default() {
if s.Image == "" {
s.Image = DefaultExampleSvcImage
}
if s.Port == 0 {
s.Port = 9501
}
if s.ContainerName == "" {
s.ContainerName = DefaultExampleSvcName
}
}
// ExampleSvcOutput represents service connection details which can be consumed by tests
// or environment.go, or any other metadata your need to expose to clients
type ExampleSvcOutput struct {
ServiceURL string ` + "`" + `toml:"service_url"` + "`" + `
}
// NewService deploys an example service and populates output data
func NewService(in *ExampleSvcInput) error {
if in == nil || in.Out != nil {
// either service key is not present in configuration
// or it is already deployed because we have an output, skipping
L.Info().Str("ServiceName", DefaultExampleSvcName).Msg("service is skipped or already deployed")
return nil
}
ctx := context.Background()
// read and apply default inputs
in.Default()
// create your service container, use static ports
req := testcontainers.ContainerRequest{
Image: in.Image,
Name: in.ContainerName,
Labels: framework.DefaultTCLabels(),
Networks: []string{framework.DefaultNetworkName},
NetworkAliases: map[string][]string{
framework.DefaultNetworkName: {in.ContainerName},
},
Env: in.EnvVars,
Cmd: []string{"sleep", "infinity"},
// add more internal ports here with /tcp suffix, ex.: 9501/tcp
ExposedPorts: []string{"9501/tcp"},
HostConfigModifier: func(h *container.HostConfig) {
h.PortBindings = nat.PortMap{
// add more internal/external pairs here, ex.: 9501/tcp as a key and HostPort is the exposed port (no /tcp prefix!)
"9501/tcp": []nat.PortBinding{
{HostPort: strconv.Itoa(in.Port)},
},
}
},
// for complex services wait for specific log message
// WaitingFor: wait.ForLog("Some log message").
// WithStartupTimeout(120 * time.Second).
// WithPollInterval(3 * time.Second),
}
_, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
})
if err != nil {
return fmt.Errorf("failed to setup %s service", in.ContainerName)
}
// write outputs on a shared struct
in.Out = &ExampleSvcOutput{
ServiceURL: "https://example.com",
}
return nil
}
`
)
Variables ¶
var ( DefaultNetworkName = "ctf" Validator = validator.New(validator.WithRequiredStructEnabled()) ValidatorTranslator ut.Translator )
var EmbeddedObservabilityFiles embed.FS
var ExitedCtfContainersListOpts = container.ListOptions{ All: true, Filters: dfilter.NewArgs(dfilter.KeyValuePair{ Key: "label", Value: "framework=ctf", }, dfilter.KeyValuePair{ Key: "status", Value: "exited"}, dfilter.KeyValuePair{ Key: "status", Value: "dead"}), }
var (
L zerolog.Logger
)
var (
PathRoot = filepath.Join(filepath.Dir(b), ".")
)
Functions ¶
func BaseCacheName ¶ added in v0.1.17
BaseCacheName returns base cache file name, ex.: env.toml -> env-cache.toml
func BaseConfigName ¶ added in v0.1.17
BaseConfigName returns base config name, ex. env.toml -> env
func BaseConfigPath ¶ added in v0.1.17
BaseConfigPath returns base config path, ex. env.toml,overrides.toml -> env.toml
func BlockScoutDown ¶ added in v0.1.17
func BlockScoutUp ¶ added in v0.1.17
func BuildImage ¶ added in v0.1.17
func BuildImageOnce ¶ added in v0.1.17
func CheckCLNodeContainerErrors ¶ added in v0.1.17
func CheckCLNodeContainerErrors() error
CheckCLNodeContainerErrors check if any CL node container logs has errors
func DefaultNetwork ¶ added in v0.1.1
func DefaultTCLabels ¶
func DefaultTCName ¶
func ExecCmdWithContext ¶ added in v0.14.4
ExecCmdWithContext a command and logs the output interactively
func ExecCmdWithOpts ¶ added in v0.14.4
func FilterSemverTags ¶ added in v0.14.6
FilterSemverTags parses valid versions and returns them sorted from latest to lowest
func FindNOPsVersionsByProduct ¶ added in v0.15.6
FindNOPsVersionsByProduct finds all the versions of a given product from a RANE SOT source across all the NOPs
func FindSemVerRefSequence ¶ added in v0.14.6
FindSemVerRefSequence gets all semver tags, sorts them, and rolls back to the earliest tag returns all the tags starting from the oldest one
func GenerateCustomPortsData ¶ added in v0.1.17
GenerateCustomPortsData generate custom ports data: exposed and forwarded port map
func GetHostWithContext ¶ added in v0.11.6
func HostDockerInternal ¶ added in v0.1.17
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 MapTheSamePort ¶
func MustParseDuration ¶ added in v0.1.17
MustParseDuration parses a duration string in Go's format and returns the corresponding time.Duration. It panics if the string cannot be parsed, ensuring that the caller receives a valid duration.
func NewPromtail ¶ added in v0.1.6
func NewPromtail() error
func NoDNS ¶ added in v0.1.17
func NoDNS(noDNS bool, hc *container.HostConfig)
NoDNS removes default DNS server and sets it to localhost
func ObservabilityDown ¶ added in v0.1.17
func ObservabilityDown() error
func ObservabilityUp ¶ added in v0.1.17
func ObservabilityUp() error
ObservabilityUp standard stack with logs/metrics for load testing and observability
func ObservabilityUpFull ¶ added in v0.1.17
func ObservabilityUpFull() error
ObservabilityUpFull full stack for load testing and performance investigations
func ObservabilityUpOnlyLoki ¶ added in v0.11.10
func ObservabilityUpOnlyLoki() error
ObservabilityUpOnlyLoki slim stack with only Loki to verify specific logs of CL nodes or services in tests
func RemoveTestContainers ¶ added in v0.1.17
func RemoveTestContainers() error
RemoveTestContainers removes all test containers, volumes and CTF docker network
func RemoveTestStack ¶ added in v0.1.17
func RenderTemplate ¶
func ResourceLimitsFunc ¶ added in v0.1.17
func ResourceLimitsFunc(h *container.HostConfig, resources *ContainerResources)
ResourceLimitsFunc returns a function to configure container resources based on the human-readable CPUs and memory in Mb
func RunCommand ¶ added in v0.1.17
RunCommand executes a command and prints the output.
func RunCommandDir ¶ added in v0.1.17
RunCommandDir executes a command in some directory and prints the output
func RunInitialUpgradeSetup ¶ added in v0.15.6
func RunInitialUpgradeSetup(ctx context.Context, u UpgradeContext) error
func SaveAndCheckLogs ¶ added in v0.1.17
func SaveContainerLogs ¶ added in v0.1.17
SaveContainerLogs writes all Docker container logs to some directory
func SearchLogFile ¶ added in v0.1.17
SearchLogFile searches logfile using regex and return matches or error
func StreamContainerLogs ¶ added in v0.11.1
func StreamContainerLogs(listOptions container.ListOptions, logOptions container.LogsOptions) (map[string]io.ReadCloser, error)
func ToLabelsMap ¶ added in v0.1.17
func ToLabelsMap(response *PrometheusQueryResponse) map[string][]interface{}
ToLabelsMap converts PrometheusQueryResponse.Data.Result into a map where keys are metric labels in "k:v" format and values are slices of all values with that label
func UpgradeContainer ¶ added in v0.14.4
UpgradeContainer stops a container, removes it, and creates a new one with the specified image
func UpgradeNProductUniqueVersionsRolling ¶ added in v0.15.6
func UpgradeNProductUniqueVersionsRolling(ctx context.Context, u UpgradeContext) error
UpgradeNProductUniqueVersionsRolling models multiple product DONs as one having all unique versions first upgrades the current version of each node to modelled DON version in parallel and tests it once then upgrades each node to the target version and tests it after each upgrade [v1.0, v1.0, v1.1, v1.1] -> test it [v1.0, v1.1, v1.3, v1.4] -> get N unique refs and boot up DON to simulate a real one [vX.X, v1.1, v1.3, v1.4] -> upgrade a single node, test [vX.X, vX.X, v1.3, v1.4] -> upgrade a single node, test ... etc [v1.0, v1.1, v1.3, v1.4] -> get N unique refs and boot up DON to simulate a real one [vX.X, v1.1, v1.3, v1.4] -> upgrade a single node, test [vX.X, vX.X, v1.3, v1.4] -> upgrade a single node, test ... etc
func UpgradeNRolling ¶ added in v0.15.6
func UpgradeNRolling(ctx context.Context, u UpgradeContext) error
UpgradeNRolling upgrades nodes to the given refs in rolling fashion, testing with the given testcmd after each upgrade [v1.0, v1.0, v1.1, v1.1] -> test [v1.0, v1.0, v1.2, v1.2] -> test [v1.0, v1.0, v1.3, v1.3] -> test etc
func WriteRollingNUpgradeSummary ¶ added in v0.15.6
func WriteRollingNUpgradeSummary(tmpl UpgradeNRollingSummaryTemplate) error
WriteRollingNUpgradeSummary renders an upgrade summary and writes it to ci_summary.txt
func WriteSOTDONUpgradeSummary ¶ added in v0.15.6
func WriteSOTDONUpgradeSummary(tmpl UpgradeSOTDONSummary) error
WriteSOTDONUpgradeSummary renders an upgrade summary and writes it to ci_summary.txt
Types ¶
type APIError ¶ added in v0.1.17
APIError is a custom error type for handling non-200 responses from the Loki API
type Annotation ¶ added in v0.1.17
type CIECRAuthAction ¶ added in v0.13.13
type CIECRAuthAction struct{}
CIECRAuthAction params for generating CI share action for auth
type CILoadChaosParams ¶ added in v0.12.0
CILoadChaosParams params for generating CI load&chaos tests file
type CISmokeParams ¶ added in v0.12.0
CISmokeParams params for generating CI smoke tests file
type CLDFParams ¶ added in v0.12.0
type CLDFParams struct {
PackageName string
}
CLDFParams cldf.go file params
type CLICompletionParams ¶ added in v0.12.0
CLICompletionParams cli.go file params
type CLIParams ¶ added in v0.12.0
type CLIParams struct {
PackageName string
CLIName string
DevEnvPkgImport string
ProductName string
DashboardUUID string
}
CLIParams cli.go file params
type ConfigParams ¶ added in v0.12.0
type ConfigParams struct {
PackageName string
}
ConfigParams config.go file params
type ConfigTOMLParams ¶ added in v0.12.0
ConfigTOMLParams default env.toml params
type ContainerResources ¶ added in v0.1.17
type DevEnvInterfaceParams ¶ added in v0.13.4
type DevEnvInterfaceParams struct {
PackageName string
}
DevEnvInterfaceParams interface.go file params
type DockerClient ¶ added in v0.1.17
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient wraps a Docker API client and provides convenience methods
func NewDockerClient ¶ added in v0.1.17
func NewDockerClient() (*DockerClient, error)
NewDockerClient creates a new instance of DockerClient
func (*DockerClient) CopyFile ¶ added in v0.1.17
func (dc *DockerClient) CopyFile(containerName, sourceFile, targetPath string) error
CopyFile copies a file into a container by name
func (*DockerClient) ExecContainer ¶ added in v0.1.17
func (dc *DockerClient) ExecContainer(containerName string, command []string) (string, error)
ExecContainer executes a command inside a running container by name and returns the combined stdout/stderr.
func (*DockerClient) ExecContainerOptions ¶ added in v0.10.36
func (dc *DockerClient) ExecContainerOptions(containerName string, execConfig container.ExecOptions) (string, error)
ExecContainer executes a command inside a running container by name and returns the combined stdout/stderr.
func (*DockerClient) ExecContainerOptionsWithContext ¶ added in v0.11.6
func (dc *DockerClient) ExecContainerOptionsWithContext(ctx context.Context, containerName string, execConfig container.ExecOptions) (string, error)
ExecContainerOptionsWithContext executes a command inside a running container by name and returns the combined stdout/stderr.
func (*DockerClient) ExecContainerWithContext ¶ added in v0.11.6
func (dc *DockerClient) ExecContainerWithContext(ctx context.Context, containerName string, command []string) (string, error)
ExecContainerWithContext executes a command inside a running container by name and returns the combined stdout/stderr.
type EnvBuilder ¶ added in v0.12.0
type EnvBuilder struct {
// contains filtered or unexported fields
}
EnvBuilder builder for perf test codegen
func NewEnvBuilder ¶ added in v0.12.0
func NewEnvBuilder(cliName string, nodes int, productName string) *EnvBuilder
NewEnvBuilder creates a new Chainlink Cluster developer environment
func (*EnvBuilder) Build ¶ added in v0.12.0
func (g *EnvBuilder) Build() (*EnvCodegen, error)
Validate validate generation params for now it's empty but for more complex mutually exclusive cases we should add validation here
func (*EnvBuilder) OutputDir ¶ added in v0.12.0
func (g *EnvBuilder) OutputDir(dir string) *EnvBuilder
OutputDir sets the output directory for generated files
type EnvCodegen ¶ added in v0.12.0
type EnvCodegen struct {
// contains filtered or unexported fields
}
EnvCodegen is a perf test code generator that creates workload and chaos experiments
func (*EnvCodegen) GenerateCIFunctional ¶ added in v0.13.8
func (g *EnvCodegen) GenerateCIFunctional() (string, error)
GenerateCIFunctional generates a functional test CI workflow
func (*EnvCodegen) GenerateCIPerf ¶ added in v0.13.8
func (g *EnvCodegen) GenerateCIPerf() (string, error)
GenerateCIPerf generates a load&chaos test CI workflow
func (*EnvCodegen) GenerateCLI ¶ added in v0.12.0
func (g *EnvCodegen) GenerateCLI(dashboardUUID string) (string, error)
GenerateCLI generate Cobra CLI
func (*EnvCodegen) GenerateCLICompletion ¶ added in v0.12.0
func (g *EnvCodegen) GenerateCLICompletion() (string, error)
GenerateCLICompletion generate CLI completion for "go-prompt" library
func (*EnvCodegen) GenerateConfig ¶ added in v0.12.0
func (g *EnvCodegen) GenerateConfig() (string, error)
GenerateConfig generate read/write utilities for TOML configs
func (*EnvCodegen) GenerateDefaultTOMLConfig ¶ added in v0.12.0
func (g *EnvCodegen) GenerateDefaultTOMLConfig() (string, error)
GenerateDefaultTOMLConfig generate default env.toml config
func (*EnvCodegen) GenerateECRAuthAction ¶ added in v0.13.13
func (g *EnvCodegen) GenerateECRAuthAction() (string, error)
GenerateECRAuthAction generates a shared ECR Auth action
func (*EnvCodegen) GenerateEnvironment ¶ added in v0.12.0
func (g *EnvCodegen) GenerateEnvironment() (string, error)
GenerateEnvironment generate environment.go, our environment composition function
func (*EnvCodegen) GenerateFakesDockerfile ¶ added in v0.13.4
func (g *EnvCodegen) GenerateFakesDockerfile() (string, error)
func (*EnvCodegen) GenerateFakesGoModule ¶ added in v0.13.4
func (g *EnvCodegen) GenerateFakesGoModule() (string, error)
func (*EnvCodegen) GenerateFakesImpl ¶ added in v0.13.4
func (g *EnvCodegen) GenerateFakesImpl() (string, error)
func (*EnvCodegen) GenerateFakesJustfile ¶ added in v0.13.4
func (g *EnvCodegen) GenerateFakesJustfile() (string, error)
func (*EnvCodegen) GenerateGitIgnore ¶ added in v0.12.0
func (g *EnvCodegen) GenerateGitIgnore() (string, error)
GenerateGitIgnore generate .gitignore file
func (*EnvCodegen) GenerateGoMod ¶ added in v0.12.0
func (g *EnvCodegen) GenerateGoMod() (string, error)
GenerateGoMod generates a go.mod file
func (*EnvCodegen) GenerateGrafanaDashboard ¶ added in v0.12.0
func (g *EnvCodegen) GenerateGrafanaDashboard(uuid string) (string, error)
GenerateGrafanaDashboard generate default Grafana dashboard
func (*EnvCodegen) GenerateJD ¶ added in v0.13.4
func (g *EnvCodegen) GenerateJD() (string, error)
GenerateJD generate JD helpers
func (*EnvCodegen) GenerateJustfile ¶ added in v0.12.0
func (g *EnvCodegen) GenerateJustfile() (string, error)
GenerateJustfile generate Justfile to build and publish Docker images
func (*EnvCodegen) GenerateLoadTests ¶ added in v0.12.0
func (g *EnvCodegen) GenerateLoadTests() (string, error)
GenerateSmokeTests generates a smoke test template
func (*EnvCodegen) GenerateProductBasicConfigParams ¶ added in v0.13.4
func (g *EnvCodegen) GenerateProductBasicConfigParams() (string, error)
func (*EnvCodegen) GenerateProductCommon ¶ added in v0.13.4
func (g *EnvCodegen) GenerateProductCommon() (string, error)
func (*EnvCodegen) GenerateProductImpl ¶ added in v0.13.4
func (g *EnvCodegen) GenerateProductImpl() (string, error)
func (*EnvCodegen) GenerateProductSoakConfigParams ¶ added in v0.13.4
func (g *EnvCodegen) GenerateProductSoakConfigParams() (string, error)
func (*EnvCodegen) GenerateProductsConfig ¶ added in v0.13.4
func (g *EnvCodegen) GenerateProductsConfig() (string, error)
func (*EnvCodegen) GenerateProductsInterface ¶ added in v0.13.4
func (g *EnvCodegen) GenerateProductsInterface() (string, error)
GenerateProductsInterface generate devenv interface to run arbitrary products
func (*EnvCodegen) GenerateReadme ¶ added in v0.12.0
func (g *EnvCodegen) GenerateReadme() (string, error)
GenerateReadme generates a readme file
func (*EnvCodegen) GenerateServiceImpl ¶ added in v0.13.11
func (g *EnvCodegen) GenerateServiceImpl() (string, error)
GenerateServiceImpl generates example service implementation
func (*EnvCodegen) GenerateSmokeTests ¶ added in v0.12.0
func (g *EnvCodegen) GenerateSmokeTests() (string, error)
GenerateSmokeTests generates a smoke test template
func (*EnvCodegen) GenerateTableTest ¶ added in v0.12.0
func (g *EnvCodegen) GenerateTableTest() (string, error)
GenerateTableTest generates all possible experiments for a namespace first generate all small pieces then insert into a table test template
func (*EnvCodegen) GenerateTestCases ¶ added in v0.12.0
func (g *EnvCodegen) GenerateTestCases() ([]TestCaseParams, error)
GenerateTestCases generates table test cases
func (*EnvCodegen) Read ¶ added in v0.12.0
func (g *EnvCodegen) Read() error
Read read K8s namespace and find all the pods some pods may be crashing but it doesn't matter for code generation
func (*EnvCodegen) Write ¶ added in v0.12.0
func (g *EnvCodegen) Write() error
Write generates a complete devenv boilerplate, can be multiple files
func (*EnvCodegen) WriteFakes ¶ added in v0.13.4
func (g *EnvCodegen) WriteFakes() error
WriteFakes writes all files related to fake services used in testing
func (*EnvCodegen) WriteProducts ¶ added in v0.13.4
func (g *EnvCodegen) WriteProducts() error
WriteProducts generates a complete products boilerplate
func (*EnvCodegen) WriteServices ¶ added in v0.13.11
func (g *EnvCodegen) WriteServices() error
WriteServices write all things related to example service template
type GitIgnoreParams ¶ added in v0.12.0
type GitIgnoreParams struct{}
GitIgnoreParams default .gitignore params
type GoModParams ¶ added in v0.12.0
GoModParams params for generating go.mod file
type GrafanaClient ¶ added in v0.1.17
type GrafanaClient struct {
// contains filtered or unexported fields
}
func NewGrafanaClient ¶ added in v0.1.17
func NewGrafanaClient(url, bearerToken string) *GrafanaClient
NewGrafanaClient initializes a new Grafana client with the specified URL and API key.
func (*GrafanaClient) Annotate ¶ added in v0.1.17
func (c *GrafanaClient) Annotate(annotation Annotation) ([]PostAnnotationResponse, []*resty.Response, error)
Annotate adds annotation to all the dashboards, works for both single point annotation with just StartTime and for ranges with StartTime/EndTime
type GrafanaDashboardParams ¶ added in v0.12.0
GrafanaDashboardParams default Grafana dashboard params
type JSONStrDuration ¶ added in v0.1.1
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 JustfileParams ¶ added in v0.12.0
JustfileParams Justfile params
type LoadTestParams ¶ added in v0.12.0
LoadTestParams params for generating end-to-end test template
type LogEntry ¶ added in v0.1.17
LogEntry represents a single log entry with a timestamp and raw log message
type LokiClient ¶ added in v0.1.17
type LokiClient struct {
BaseURL string
TenantID string
BasicAuth BasicAuth
QueryParams QueryParams
RestyClient *resty.Client
}
LokiClient represents a client to interact with Loki for querying logs
func NewLokiQueryClient ¶ added in v0.1.17
func NewLokiQueryClient(baseURL, tenantID string, auth BasicAuth, queryParams QueryParams) *LokiClient
NewLokiQueryClient creates a new Loki client with the given parameters, initializes a logger, and configures Resty with debug mode
func (*LokiClient) QueryRange ¶ added in v0.1.17
func (lc *LokiClient) QueryRange(ctx context.Context) ([]LogEntry, error)
QueryRange queries Loki logs based on the query parameters and returns the raw log entries
type PostAnnotationResponse ¶ added in v0.1.17
type ProductBasicConfigParams ¶ added in v0.13.4
type ProductBasicConfigParams struct {
ProductName string
}
type ProductCommonParams ¶ added in v0.13.4
type ProductCommonParams struct{}
type ProductConfigParams ¶ added in v0.13.4
type ProductConfigParams struct{}
type ProductConfigurationSimple ¶ added in v0.12.0
type ProductConfigurationSimple struct {
PackageName string
}
ProductConfigurationSimple product_configuration.go file params
type ProductFakesDockerfileParams ¶ added in v0.13.4
type ProductFakesDockerfileParams struct{}
type ProductFakesGoModuleParams ¶ added in v0.13.4
type ProductFakesImplParams ¶ added in v0.13.4
type ProductFakesImplParams struct {
ProductName string
}
type ProductFakesJustfileParams ¶ added in v0.13.4
type ProductFakesJustfileParams struct {
ProductName string
}
type ProductImplParams ¶ added in v0.13.4
type ProductImplParams struct {
ProductName string
}
type ProductSoakConfigParams ¶ added in v0.13.4
type ProductSoakConfigParams struct {
ProductName string
}
type PromQueryResponseData ¶ added in v0.13.1
type PromQueryResponseData struct {
ResultType string `json:"resultType"`
Result []PromQueryResponseResult `json:"result"`
}
type PromQueryResponseResult ¶ added in v0.13.1
type PrometheusQueryClient ¶ added in v0.1.17
type PrometheusQueryClient struct {
// contains filtered or unexported fields
}
PrometheusQueryClient is a client for querying Prometheus metrics
func NewPrometheusQueryClient ¶ added in v0.1.17
func NewPrometheusQueryClient(baseURL string) *PrometheusQueryClient
NewPrometheusQueryClient creates a new PrometheusQueryClient
func (*PrometheusQueryClient) Query ¶ added in v0.1.17
func (p *PrometheusQueryClient) Query(query string, timestamp time.Time) (*PrometheusQueryResponse, error)
Query executes an instant query against the Prometheus API
func (*PrometheusQueryClient) QueryRange ¶ added in v0.1.17
func (p *PrometheusQueryClient) QueryRange(params QueryRangeParams) (*QueryRangeResponse, error)
QueryRange executes a range query against the Prometheus API
type PrometheusQueryResponse ¶ added in v0.1.17
type PrometheusQueryResponse struct {
Status string `json:"status"`
Data *PromQueryResponseData `json:"data"`
}
PrometheusQueryResponse represents the response from Prometheus API
type QueryParams ¶ added in v0.1.17
QueryParams holds the parameters required for querying Loki
type QueryRangeParams ¶ added in v0.1.17
QueryRangeParams contains parameters for range queries
type QueryRangeResponse ¶ added in v0.1.17
type QueryRangeResponse struct {
Status string `json:"status"`
Data struct {
ResultType string `json:"resultType"`
Result []struct {
Metric map[string]string `json:"metric"`
Values [][]interface{} `json:"values"`
} `json:"result"`
} `json:"data"`
}
QueryRangeResponse represents the response from Prometheus range query API
type RaneSOTResponseBody ¶ added in v0.14.4
type ReadmeParams ¶ added in v0.12.0
ReadmeParams params for generating README.md file
type Response ¶ added in v0.1.17
type Response struct {
Data struct {
Result []struct {
Stream map[string]string `json:"stream"`
Values [][]interface{} `json:"values"`
} `json:"result"`
} `json:"data"`
}
Response represents the structure of the response from Loki
type SmokeTestParams ¶ added in v0.12.0
SmokeTestParams params for generating end-to-end test template
type SvcImplParams ¶ added in v0.13.11
type SvcImplParams struct{}
SvcImplParams service template params
type TableTestParams ¶ added in v0.12.0
type TableTestParams struct {
Package string
TableTestName string
TestCases []TestCaseParams
WorkloadCode string
GunCode string
}
TableTestParams params for generating a table test
type TestCaseParams ¶ added in v0.12.0
TestCaseParams params for generating a test case
type UpgradeContext ¶ added in v0.15.6
type UpgradeContext struct {
ProductName string
Refs []string
DonNodes int
UpgradeNodes int
NodeNameTemplate string
Registry string
Buildcmd string
Envcmd string
Testcmd string
SkipPull bool
}
UpgradeContext contains all the data needed for an upgrade test run
type UpgradeNRollingSummaryTemplate ¶ added in v0.15.6
type UpgradeNRollingSummaryTemplate struct {
Total int
Earliest string
Latest string
Sequence []string
}
UpgradeNRollingSummaryTemplate holds the data for rendering a rolling N upgrade summary
type UpgradeSOTDONSummary ¶ added in v0.15.6
type UpgradeSOTDONSummary struct {
ProductName string
TotalRefs int
DONSize int
Earliest string
Latest string
Sequence []string
SequenceChunks [][]string
}
UpgradeSOTDONSummary holds the data for rendering a SOT DON upgrade summary
type ValidationError ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
gql
command
|
|
|
gql/schema
Package schema is used to read schema files
|
Package schema is used to read schema files |
|
components
|
|
|
dockercompose
module
|
|
|
fake
module
|
|