Documentation ¶
Index ¶
- Constants
- func ConfigDocLink() string
- func GetKubeClient(kubeconfig string) (client kubernetes.Interface, err error)
- func UntarFile(tarName, target string) (err error)
- func WritePathsToTar(tw *tar.Writer, paths []string) (err error)
- func WriteToTar(tw *tar.Writer, r io.Reader, hdr *tar.Header) error
- type Config
- type FakeTestRunner
- type PodTestRunner
- func (r PodTestRunner) Cleanup(ctx context.Context) (err error)
- func (r PodTestRunner) CreateConfigMap(ctx context.Context, bundleData []byte) (configMapName string, err error)
- func (r *PodTestRunner) Initialize(ctx context.Context) error
- func (r PodTestRunner) RunTest(ctx context.Context, test Test) (result *v1alpha3.TestStatus, err error)
- type Scorecard
- type Test
- type TestRunner
Constants ¶
const ( ConfigDirName = "scorecard" ConfigDirPath = "/tests/" + ConfigDirName + "/" )
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 ¶
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 WritePathsToTar ¶ added in v0.19.0
WritePathsToTar walks paths to create tar file tarName
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 ¶
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 }
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 }