drivertest

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package drivertest stands in for what the executor drivers talk to — a container runtime's CLI and a Kubernetes API server — so a test can drive the real drivers end to end (Task 20403): the container driver's staged lease files on disk, and the Kubernetes driver's lease Secret in the stand-in API server, are what a revocation has to reach.

Neither runs anything. The runtime reports one image as present and every container as running until it is removed or killed; the API server keeps every Pod pending. Both are test-only: production code must not import this package (tests/arch enforces it).

Index

Constants

View Source
const Image = "docker.io/library/alpine@sha256:" +
	"d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc"

Image is a pinned reference the stand-in runtime reports as present.

Variables

This section is empty.

Functions

func ContainerRuntime

func ContainerRuntime(t testing.TB, dir string) string

ContainerRuntime writes, into dir, a `docker` that answers the container driver as a running container would and stops it when removed or killed, and returns its path. Its name has to be docker: the driver accepts no other runtime.

Types

type KubeAPI

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

KubeAPI serves the Pod and Secret calls the Kubernetes driver makes, and keeps every Pod pending — running, as far as a revocation is concerned — so a test can see what a revocation does to a live Pod's lease Secret.

func NewKubeAPI

func NewKubeAPI(t testing.TB) *KubeAPI

NewKubeAPI starts one, closed when the test ends.

func (*KubeAPI) KeyHolding

func (f *KubeAPI) KeyHolding(secret, value string) string

KeyHolding returns the key of secret holding value, or "".

func (*KubeAPI) PodDeleted

func (f *KubeAPI) PodDeleted() bool

PodDeleted reports whether any Pod was deleted.

func (*KubeAPI) REST

func (f *KubeAPI) REST() *kubernetes.RESTConfig

REST is the connection a driver uses to reach it.

func (*KubeAPI) SecretData

func (f *KubeAPI) SecretData(secret string) map[string][]byte

SecretData returns a copy of secret's data.

func (*KubeAPI) WaitSecret

func (f *KubeAPI) WaitSecret(t testing.TB, prefix string) string

WaitSecret waits for a Secret whose name starts with prefix, and returns its name.

type KubeSource

type KubeSource struct{ Rest *kubernetes.RESTConfig }

KubeSource hands the Kubernetes driver the stand-in API server's connection.

func (KubeSource) Acquire

Acquire implements kubernetes.CredentialSource.

func (KubeSource) Describe

func (s KubeSource) Describe() string

Describe implements kubernetes.CredentialSource.

func (KubeSource) Release

func (s KubeSource) Release(string)

Release implements kubernetes.CredentialSource.

func (KubeSource) Renew

Renew implements kubernetes.CredentialSource.

Jump to

Keyboard shortcuts

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