Documentation
¶
Index ¶
- func AssertContainerProfileContains(t *testing.T, cp *v1beta1.ContainerProfile, ...)
- func AssertContainerProfileNotContains(t *testing.T, cp *v1beta1.ContainerProfile, ...)
- func AssertContains(t *testing.T, alerts []Alert, expectedRuleName string, expectedCommand string, ...)
- func AssertNotContains(t *testing.T, alerts []Alert, notExpectedRuleName string, ...)
- func AssertUIDFieldsPopulated(t *testing.T, alerts []Alert, namespace string)
- func ExecIntoPod(podName, podNamespace string, command []string, container string) (string, string, error)
- func ExecIntoPodNoTTY(podName, podNamespace string, command []string, container string) (string, string, error)
- func GetNodeAgentAverageCPUUsage(start, end time.Time) (map[string]float64, error)
- func IncreaseNodeAgentSniffingTime(newDuration string)
- func PlotNodeAgentPrometheusCPUUsage(testcase string, startTime, endTime time.Time) error
- func PrintAppLogs(t *testing.T, app string)
- func RestartDaemonSet(namespace, name string) error
- func RestartDeployment(namespace, name string) error
- func RunCommand(name string, args ...string) int
- type Alert
- type TestNamespace
- type TestWorkload
- func (w *TestWorkload) AddEphemeralContainer(name, image string, command []string, maxRetries uint64) error
- func (w *TestWorkload) Delete() error
- func (w *TestWorkload) ExecIntoPod(command []string, container string) (string, string, error)
- func (w *TestWorkload) ExecIntoPodNoTTY(command []string, container string) (string, string, error)
- func (w *TestWorkload) GetContainerProfile(containerName string) (*v1beta1.ContainerProfile, error)
- func (w *TestWorkload) GetContainerProfiles() ([]v1beta1.ContainerProfile, error)
- func (w *TestWorkload) GetPods() ([]v1.Pod, error)
- func (w *TestWorkload) GetWorkloadEvents() ([]eventsv1.Event, error)
- func (w *TestWorkload) WaitForContainerProfile(maxRetries uint64, expectedStatus string) error
- func (w *TestWorkload) WaitForContainerProfileCompletion(maxRetries uint64) error
- func (w *TestWorkload) WaitForContainerProfileCompletionWithDenylist(maxRetries uint64, denylist []string) error
- func (w *TestWorkload) WaitForReady(maxRetries uint64) error
- type WorkloadMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertContainerProfileContains ¶ added in v0.3.194
func AssertContainerProfileContains(t *testing.T, cp *v1beta1.ContainerProfile, expectedEgress, expectedIngress []string)
AssertContainerProfileContains asserts that all of the given egress/ingress DNS names appear in the container profile's learnt network surface.
func AssertContainerProfileNotContains ¶ added in v0.3.194
func AssertContainerProfileNotContains(t *testing.T, cp *v1beta1.ContainerProfile, notExpectedEgress, notExpectedIngress []string)
AssertContainerProfileNotContains asserts that none of the given egress/ingress DNS names appear in the container profile's learnt network surface. The ContainerProfile is already scoped to a single container, so there is no container-name argument (unlike the former per-workload NetworkNeighborhood).
func AssertContains ¶
func AssertNotContains ¶
func AssertUIDFieldsPopulated ¶ added in v0.3.6
AssertUIDFieldsPopulated verifies that pod_uid and workload_uid fields are populated in alerts
func ExecIntoPod ¶
func ExecIntoPodNoTTY ¶ added in v0.3.165
func ExecIntoPodNoTTY(podName, podNamespace string, command []string, container string) (string, string, error)
ExecIntoPodNoTTY is ExecIntoPod without a controlling terminal.
Every other exec helper here sets TTY: true, and the API server allocates a pty on that flag alone regardless of Stdin — so all ordinary component-test execs run *with* a terminal. Note that `kubectl exec -t` is not a way to check this: kubectl silently drops the TTY flag when -i is absent, so it never sends TTY=true/Stdin=false at all and reports "not a tty" misleadingly. Verified against a live API server: TTY=true/Stdin=false -> /dev/pts/0.
Use this when a test needs a process with genuinely no controlling terminal.
func IncreaseNodeAgentSniffingTime ¶
func IncreaseNodeAgentSniffingTime(newDuration string)
func PrintAppLogs ¶ added in v0.3.3
func RestartDaemonSet ¶ added in v0.2.317
func RestartDeployment ¶ added in v0.2.335
func RunCommand ¶
Types ¶
type TestNamespace ¶
type TestNamespace struct {
Name string
// contains filtered or unexported fields
}
func NewNamespace ¶
func NewNamespace(name string) TestNamespace
func NewRandomNamespace ¶
func NewRandomNamespace() TestNamespace
type TestWorkload ¶
type TestWorkload struct {
Namespace string
UnstructuredObj *unstructured.Unstructured
WorkloadObj *workloadinterface.Workload
// contains filtered or unexported fields
}
func CreateWorkloadsInPath ¶
func CreateWorkloadsInPath(namespace, dir string) ([]TestWorkload, error)
func NewTestWorkload ¶
func NewTestWorkload(namespace, resourcePath string) (*TestWorkload, error)
func NewTestWorkloadFromK8sIdentifiers ¶ added in v0.2.335
func NewTestWorkloadFromK8sIdentifiers(namespace, kind, name string) (*TestWorkload, error)
func (*TestWorkload) AddEphemeralContainer ¶ added in v0.3.194
func (w *TestWorkload) AddEphemeralContainer(name, image string, command []string, maxRetries uint64) error
AddEphemeralContainer attaches an ephemeral container to the workload's first pod via the ephemeralcontainers subresource (the API `kubectl debug` uses) and waits until it is observed running. This is the only way to start an ephemeralContainers-subtype container, which cannot be declared in a pod spec.
func (*TestWorkload) Delete ¶ added in v0.2.340
func (w *TestWorkload) Delete() error
func (*TestWorkload) ExecIntoPod ¶
func (*TestWorkload) ExecIntoPodNoTTY ¶ added in v0.3.165
ExecIntoPodNoTTY execs without a controlling terminal. See ExecIntoPodNoTTY.
func (*TestWorkload) GetContainerProfile ¶ added in v0.3.194
func (w *TestWorkload) GetContainerProfile(containerName string) (*v1beta1.ContainerProfile, error)
GetContainerProfile returns the newest ContainerProfile for the named container of this workload.
func (*TestWorkload) GetContainerProfiles ¶ added in v0.3.194
func (w *TestWorkload) GetContainerProfiles() ([]v1beta1.ContainerProfile, error)
GetContainerProfiles returns the newest ContainerProfile per container name for this workload.
func (*TestWorkload) GetWorkloadEvents ¶ added in v0.2.340
func (w *TestWorkload) GetWorkloadEvents() ([]eventsv1.Event, error)
func (*TestWorkload) WaitForContainerProfile ¶ added in v0.3.194
func (w *TestWorkload) WaitForContainerProfile(maxRetries uint64, expectedStatus string) error
func (*TestWorkload) WaitForContainerProfileCompletion ¶ added in v0.3.194
func (w *TestWorkload) WaitForContainerProfileCompletion(maxRetries uint64) error
func (*TestWorkload) WaitForContainerProfileCompletionWithDenylist ¶ added in v0.3.194
func (w *TestWorkload) WaitForContainerProfileCompletionWithDenylist(maxRetries uint64, denylist []string) error
func (*TestWorkload) WaitForReady ¶
func (w *TestWorkload) WaitForReady(maxRetries uint64) error
type WorkloadMetrics ¶
func PlotNodeAgentPrometheusMemoryUsage ¶
func PlotNodeAgentPrometheusMemoryUsage(testcase string, startTime, endTime time.Time) ([]WorkloadMetrics, error)