alpha

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigDirName = "scorecard"
	ConfigDirPath = "/tests/" + ConfigDirName + "/"
)
View Source
const (
	// PodBundleRoot is the directory containing all bundle data within a test pod.
	PodBundleRoot = "/bundle"

	// PodLabelsDir is the name of the directory containing bundle labels.
	PodLabelsDirName = "labels"
	// PodLabelsDir is the directory containing an annotations.yaml file that is
	// the source of truth for bundle metadata. These labels come from the
	// bundle image if applicable.
	PodLabelsDir = PodBundleRoot + "/" + PodLabelsDirName
)

Variables

This section is empty.

Functions

func ConfigDocLink() string

func GetKubeClient added in v0.18.0

func GetKubeClient(kubeconfig string) (client kubernetes.Interface, err error)

GetKubeClient will get a kubernetes client from the following sources:

  • a path to the kubeconfig file passed on the command line (--kubeconfig)
  • an environment variable that specifies the path (export KUBECONFIG)
  • the user's $HOME/.kube/config file
  • in-cluster connection for when the sdk is run within a cluster instead of the command line

func UntarFile added in v0.18.0

func UntarFile(tarName, target string) (err error)

untar a file into a location

func WritePathsToTar added in v0.19.0

func WritePathsToTar(tw *tar.Writer, paths []string) (err error)

WritePathsToTar walks paths to create tar file tarName

func WriteToTar added in v0.19.0

func WriteToTar(tw *tar.Writer, r io.Reader, hdr *tar.Header) error

Types

type Config

type Config struct {
	Tests []Test `yaml:"tests"`
}

Config represents the set of test configurations which scorecard would run based on user input

func LoadConfig

func LoadConfig(configFilePath string) (Config, error)

LoadConfig will find and return the scorecard config, the config file is found from a bundle location (TODO bundle image) scorecard config.yaml is expected to be in the bundle at the following location: tests/scorecard/config.yaml the user can override this location using the --config CLI flag

type FakeTestRunner added in v0.18.0

type FakeTestRunner struct {
	TestStatus *v1alpha3.TestStatus
	Error      error
}

func (FakeTestRunner) Cleanup added in v0.18.0

func (r FakeTestRunner) Cleanup(ctx context.Context) (err error)

func (FakeTestRunner) Initialize added in v0.18.0

func (r FakeTestRunner) Initialize(ctx context.Context) (err error)

func (FakeTestRunner) RunTest added in v0.18.0

func (r FakeTestRunner) RunTest(ctx context.Context, test Test) (result *v1alpha3.TestStatus, err error)

RunTest executes a single test

type PodTestRunner added in v0.18.0

type PodTestRunner struct {
	Namespace      string
	ServiceAccount string
	BundlePath     string
	BundleLabels   registryutil.Labels
	Client         kubernetes.Interface
	// contains filtered or unexported fields
}

func (PodTestRunner) Cleanup added in v0.18.0

func (r PodTestRunner) Cleanup(ctx context.Context) (err error)

Cleanup deletes pods and configmap resources from this test run

func (PodTestRunner) CreateConfigMap added in v0.18.0

func (r PodTestRunner) CreateConfigMap(ctx context.Context, bundleData []byte) (configMapName string, err error)

CreateConfigMap creates a ConfigMap that will hold the bundle contents to be mounted into the test Pods

func (*PodTestRunner) Initialize added in v0.18.0

func (r *PodTestRunner) Initialize(ctx context.Context) error

Initialize sets up the bundle configmap for tests

func (PodTestRunner) RunTest added in v0.18.0

func (r PodTestRunner) RunTest(ctx context.Context, test Test) (result *v1alpha3.TestStatus, err error)

RunTest executes a single test

type Scorecard added in v0.18.0

type Scorecard struct {
	Config      Config
	Selector    labels.Selector
	TestRunner  TestRunner
	SkipCleanup bool
}

func (Scorecard) ListTests added in v0.18.0

func (o Scorecard) ListTests() (output v1alpha3.Test, err error)

ListTests lists the scorecard tests as configured that would be run based on user selection

func (Scorecard) RunTests added in v0.18.0

func (o Scorecard) RunTests(ctx context.Context) (testOutput v1alpha3.Test, err error)

RunTests executes the scorecard tests as configured

type Test added in v0.18.0

type Test struct {
	Name  string `yaml:"name"`  // The container test name
	Image string `yaml:"image"` // The container image name
	// An list of commands and arguments passed to the test image
	Entrypoint  []string          `yaml:"entrypoint,omitempty"`
	Labels      map[string]string `yaml:"labels"`      // User defined labels used to filter tests
	Description string            `yaml:"description"` // User readable test description
}

type TestRunner added in v0.18.0

type TestRunner interface {
	Initialize(context.Context) error
	RunTest(context.Context, Test) (*v1alpha3.TestStatus, error)
	Cleanup(context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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