install

package
v0.0.0-...-a224605 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const GITHUB = "GITHUB"

Variables

This section is empty.

Functions

func Validate

func Validate(ctx context.Context, client api.Client, config *ValidationSpec) error

Validate runs a series of validation checks such as cloning a repository, running search queries, and creating insights, based on the configuration provided.

Types

type Config

type Config struct {
	GitHub GitHub `yaml:"gitHub"`
}

Config for different types of code hosts.

type Executor

type Executor struct {
	Enabled bool `yaml:"enabled"`
	Count   bool `yaml:"count"`
}

type ExternalService

type ExternalService struct {
	// Type of code host, e.g. GITHUB.
	Kind string `yaml:"kind"`

	// Display name of external service, e.g. sourcegraph-test.
	DisplayName string `yaml:"displayName"`

	// Configuration for code host.
	Config Config `yaml:"config"`

	// Maximum retry attempts when cloning test repositories. Defaults to 5 retries.
	MaxRetries int `yaml:"maxRetries"`

	// Retry timeout in seconds. Defaults to 5 seconds
	RetryTimeoutSeconds int `yaml:"retryTimeoutSeconds"`

	// Delete code host when test is done. Defaults to true.
	DeleteWhenDone bool `yaml:"deleteWhenDone"`
}

type GitHub

type GitHub struct {
	// URL used to access your GitHub instance, e.g. https://github.com.
	URL string `yaml:"url" json:"url"`

	// Auth token used to authenticate to GitHub instance. This should be provided via env var SRC_GITHUB_TOKEN.
	Token string `yaml:"token" json:"token"`

	// List of organizations.
	Orgs []string `yaml:"orgs" json:"orgs"`

	// List of repositories to pull.
	Repos []string `yaml:"repos" json:"repos"`
}

GitHub configuration parameters.

type Insight

type Insight struct {
	Title          string           `yaml:"title"`
	DataSeries     []map[string]any `yaml:"dataSeries"`
	DeleteWhenDone bool             `yaml:"deleteWhenDone"`
}

type Smtp

type Smtp struct {
	Enabled bool   `yaml:"enabled"`
	To      string `yaml:"to"`
}

type ValidationSpec

type ValidationSpec struct {
	// Search queries used for validation testing, e.g. "repo:^github\\.com/gorilla/mux$ Router".
	SearchQuery []string `yaml:"searchQuery"`

	// External Service configuration.
	ExternalService ExternalService `yaml:"externalService"`

	// Insight used for validation testing.
	Insight Insight `yaml:"insight"`

	// Executor check configuration
	Executor Executor `yaml:"executor"`

	//Test SMTP configuration
	Smtp Smtp `yaml:"smtp"`
}

func DefaultConfig

func DefaultConfig() *ValidationSpec

DefaultConfig returns a default configuration to be used for testing.

func LoadJsonConfig

func LoadJsonConfig(userConfig []byte) (*ValidationSpec, error)

LoadJsonConfig will unmarshal a JSON configuration file into a ValidationSpec.

func LoadYamlConfig

func LoadYamlConfig(userConfig []byte) (*ValidationSpec, error)

LoadYamlConfig will unmarshal a YAML configuration file into a ValidationSpec.

Jump to

Keyboard shortcuts

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