suites

package
v0.0.0-...-8341b1f Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NAMESPACE = "target-namespace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncConnectionTestSuite

type AsyncConnectionTestSuite struct {
	IntegrationTestSuiteBase
	DisableConnectionStatusTracking bool
	BlockConnection                 bool
	ExpectToSeeTheConnection        bool
	// contains filtered or unexported fields
}

func (*AsyncConnectionTestSuite) SetupSuite

func (s *AsyncConnectionTestSuite) SetupSuite()

* This suite has 2 main cases: * - BlockConnection=false: verify that a successful asynchronous connection gets reported * We provide curl-test with the IP of a TCP server to isntruct it to connect to this server. * - BlockConnection=true : verify that a failed aynchronous connection is not * No parameter to curl-test, and in this case, it simulates a firewall rule by connecting to * a dummy address.

func (*AsyncConnectionTestSuite) TearDownSuite

func (s *AsyncConnectionTestSuite) TearDownSuite()

func (*AsyncConnectionTestSuite) TestNetworkFlows

func (s *AsyncConnectionTestSuite) TestNetworkFlows()

type BenchmarkBaselineTestSuite

type BenchmarkBaselineTestSuite struct {
	BenchmarkTestSuiteBase
}

func (*BenchmarkBaselineTestSuite) SetupSuite

func (s *BenchmarkBaselineTestSuite) SetupSuite()

func (*BenchmarkBaselineTestSuite) TearDownSuite

func (s *BenchmarkBaselineTestSuite) TearDownSuite()

func (*BenchmarkBaselineTestSuite) TestBenchmarkBaseline

func (s *BenchmarkBaselineTestSuite) TestBenchmarkBaseline()

type BenchmarkCollectorTestSuite

type BenchmarkCollectorTestSuite struct {
	BenchmarkTestSuiteBase
}

func (*BenchmarkCollectorTestSuite) SetupSuite

func (s *BenchmarkCollectorTestSuite) SetupSuite()

func (*BenchmarkCollectorTestSuite) TearDownSuite

func (s *BenchmarkCollectorTestSuite) TearDownSuite()

func (*BenchmarkCollectorTestSuite) TestBenchmarkCollector

func (s *BenchmarkCollectorTestSuite) TestBenchmarkCollector()

type BenchmarkTestSuiteBase

type BenchmarkTestSuiteBase struct {
	IntegrationTestSuiteBase
	// contains filtered or unexported fields
}

func (*BenchmarkTestSuiteBase) RunInitContainer

func (b *BenchmarkTestSuiteBase) RunInitContainer()

func (*BenchmarkTestSuiteBase) StartPerfContainer

func (b *BenchmarkTestSuiteBase) StartPerfContainer(name string, image string, args string)

func (*BenchmarkTestSuiteBase) StartPerfTools

func (b *BenchmarkTestSuiteBase) StartPerfTools()

func (*BenchmarkTestSuiteBase) StopPerfTools

func (b *BenchmarkTestSuiteBase) StopPerfTools()

type CollectorStartupTestSuite

type CollectorStartupTestSuite struct {
	IntegrationTestSuiteBase
}

func (*CollectorStartupTestSuite) SetupSuite

func (s *CollectorStartupTestSuite) SetupSuite()

func (*CollectorStartupTestSuite) TearDownSuite

func (s *CollectorStartupTestSuite) TearDownSuite()

func (*CollectorStartupTestSuite) TestCollectorRunning

func (s *CollectorStartupTestSuite) TestCollectorRunning()

type ConnectionsAndEndpointsTestSuite

type ConnectionsAndEndpointsTestSuite struct {
	IntegrationTestSuiteBase
	Server Container
	Client Container
}

func (*ConnectionsAndEndpointsTestSuite) SetupSuite

func (s *ConnectionsAndEndpointsTestSuite) SetupSuite()

func (*ConnectionsAndEndpointsTestSuite) TearDownSuite

func (s *ConnectionsAndEndpointsTestSuite) TearDownSuite()

func (*ConnectionsAndEndpointsTestSuite) TestConnectionsAndEndpoints

func (s *ConnectionsAndEndpointsTestSuite) TestConnectionsAndEndpoints()

type Container

type Container struct {
	Name              string
	Cmd               string
	ContainerID       string
	IP                string
	ExpectedNetwork   []types.NetworkInfo
	ExpectedEndpoints []types.EndpointInfo
}

type ContainerStat

type ContainerStat struct {
	Timestamp string
	Id        string
	Name      string
	Mem       string
	Cpu       float64
}

type DuplicateEndpointsTestSuite

type DuplicateEndpointsTestSuite struct {
	IntegrationTestSuiteBase
}

func (*DuplicateEndpointsTestSuite) SetupSuite

func (s *DuplicateEndpointsTestSuite) SetupSuite()

func (*DuplicateEndpointsTestSuite) TearDownSuite

func (s *DuplicateEndpointsTestSuite) TearDownSuite()

func (*DuplicateEndpointsTestSuite) TestDuplicateEndpoints

func (s *DuplicateEndpointsTestSuite) TestDuplicateEndpoints()

https://issues.redhat.com/browse/ROX-13628

Endpoints are only reported by collector as a result of procfs scraping, therefore this test is strictly concerned with the scrape interval.

The desired time line of events in this test is the following:

for time (t), and scrape interval (i)

1. Start a process that opens a port, 80 2. Wait for the endpoint to be reported, this is t=0 3. Start a process that opens a different port, 81 4. At t=i (the scrape interval), port 81 should be reported 5. At t=(i+2), kill the process 6. At t=(i+2), start an identical process that opens port 81 7. At t=2i (the second scrape) nothing should be reported.

The test expects only two reported endpoints.

type GperftoolsTestSuite

type GperftoolsTestSuite struct {
	IntegrationTestSuiteBase
}

func (*GperftoolsTestSuite) SetupSuite

func (s *GperftoolsTestSuite) SetupSuite()

func (*GperftoolsTestSuite) TearDownSuite

func (s *GperftoolsTestSuite) TearDownSuite()

func (*GperftoolsTestSuite) TestFetchHeapProfile

func (s *GperftoolsTestSuite) TestFetchHeapProfile()

Verify Gperftools API: * turn heap profiling on * turn heap profiling off * fetch the profile

NOTE: The test will only be performed on supported architectures (only x86_64 at the moment).

type ImageLabelJSONTestSuite

type ImageLabelJSONTestSuite struct {
	IntegrationTestSuiteBase
}

func (*ImageLabelJSONTestSuite) SetupSuite

func (s *ImageLabelJSONTestSuite) SetupSuite()

func (*ImageLabelJSONTestSuite) TearDownSuite

func (s *ImageLabelJSONTestSuite) TearDownSuite()

func (*ImageLabelJSONTestSuite) TestRunImageWithJSONLabel

func (s *ImageLabelJSONTestSuite) TestRunImageWithJSONLabel()

type IntegrationTestSuiteBase

type IntegrationTestSuiteBase struct {
	suite.Suite
	// contains filtered or unexported fields
}

func (*IntegrationTestSuiteBase) AddMetric

func (s *IntegrationTestSuiteBase) AddMetric(key string, value float64)

AddMetric wraps access to the metrics map, to avoid nil pointers lazy initialization is necessary due to limitations around suite setup.

func (*IntegrationTestSuiteBase) AssertProcessInfoEqual

func (s *IntegrationTestSuiteBase) AssertProcessInfoEqual(expected, actual types.ProcessInfo)

func (*IntegrationTestSuiteBase) Collector

Collector returns the current collector object, or initializes a new one if it is nil. This function can be used to get the object before the container is launched, so that Collector settings can be adjusted by individual test suites

func (*IntegrationTestSuiteBase) Executor

Executor returns the current executor object, or initializes a new one if it is nil.

func (*IntegrationTestSuiteBase) GetContainerStats

func (s *IntegrationTestSuiteBase) GetContainerStats() []ContainerStat

func (*IntegrationTestSuiteBase) GetLogLines

func (s *IntegrationTestSuiteBase) GetLogLines(containerName string) []string

func (*IntegrationTestSuiteBase) PrintContainerStats

func (s *IntegrationTestSuiteBase) PrintContainerStats()

func (*IntegrationTestSuiteBase) RegisterCleanup

func (s *IntegrationTestSuiteBase) RegisterCleanup(containers ...string)

RegisterCleanup registers a cleanup function with the testing structures, to cleanup all containers started by a test / suite (provided as args)

func (*IntegrationTestSuiteBase) RunCollectorBenchmark

func (s *IntegrationTestSuiteBase) RunCollectorBenchmark()

func (*IntegrationTestSuiteBase) Sensor

Sensor returns the current mock sensor object, or initializes a new one if it is nil.

func (*IntegrationTestSuiteBase) StartCollector

func (s *IntegrationTestSuiteBase) StartCollector(disableGRPC bool, options *collector.StartupOptions)

StartCollector will start the collector container and optionally start the MockSensor, if disableGRPC is false.

func (*IntegrationTestSuiteBase) StartContainerStats

func (s *IntegrationTestSuiteBase) StartContainerStats()

func (*IntegrationTestSuiteBase) StopCollector

func (s *IntegrationTestSuiteBase) StopCollector()

StopCollector will tear down the collector container and stop the MockSensor if it was started.

func (*IntegrationTestSuiteBase) WritePerfResults

func (s *IntegrationTestSuiteBase) WritePerfResults()

type K8sNamespaceTestSuite

type K8sNamespaceTestSuite struct {
	IntegrationTestSuiteBase
	// contains filtered or unexported fields
}

func (*K8sNamespaceTestSuite) SetupSuite

func (k *K8sNamespaceTestSuite) SetupSuite()

func (*K8sNamespaceTestSuite) TearDownSuite

func (k *K8sNamespaceTestSuite) TearDownSuite()

func (*K8sNamespaceTestSuite) TestK8sNamespace

func (k *K8sNamespaceTestSuite) TestK8sNamespace()

type MissingProcScrapeTestSuite

type MissingProcScrapeTestSuite struct {
	IntegrationTestSuiteBase
}

func (*MissingProcScrapeTestSuite) SetupSuite

func (s *MissingProcScrapeTestSuite) SetupSuite()

func (*MissingProcScrapeTestSuite) TearDownSuite

func (s *MissingProcScrapeTestSuite) TearDownSuite()

func (*MissingProcScrapeTestSuite) TestCollectorRunning

func (s *MissingProcScrapeTestSuite) TestCollectorRunning()

type NamespaceTest

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

type PerfEventOpenTestSuite

type PerfEventOpenTestSuite struct {
	IntegrationTestSuiteBase
}

func (*PerfEventOpenTestSuite) SetupSuite

func (s *PerfEventOpenTestSuite) SetupSuite()

func (*PerfEventOpenTestSuite) TearDownSuite

func (s *PerfEventOpenTestSuite) TearDownSuite()

func (*PerfEventOpenTestSuite) TestReadingTracepoints

func (s *PerfEventOpenTestSuite) TestReadingTracepoints()

Verify that Collector probe doesn't block tracepoints

type PerformanceResult

type PerformanceResult struct {
	TestName         string
	Timestamp        string
	InstanceType     string
	VmConfig         string
	CollectionMethod string
	Metrics          map[string]float64
	ContainerStats   []ContainerStat
}

type ProcessListeningOnPortTestSuite

type ProcessListeningOnPortTestSuite struct {
	IntegrationTestSuiteBase
	// contains filtered or unexported fields
}

func (*ProcessListeningOnPortTestSuite) SetupSuite

func (s *ProcessListeningOnPortTestSuite) SetupSuite()

func (*ProcessListeningOnPortTestSuite) TearDownSuite

func (s *ProcessListeningOnPortTestSuite) TearDownSuite()

func (*ProcessListeningOnPortTestSuite) TestProcessListeningOnPort

func (s *ProcessListeningOnPortTestSuite) TestProcessListeningOnPort()

type ProcessNetworkTestSuite

type ProcessNetworkTestSuite struct {
	IntegrationTestSuiteBase
	// contains filtered or unexported fields
}

func (*ProcessNetworkTestSuite) SetupSuite

func (s *ProcessNetworkTestSuite) SetupSuite()

Launches collector Launches gRPC server in insecure mode Launches nginx container Execs into nginx and does a sleep

func (*ProcessNetworkTestSuite) TearDownSuite

func (s *ProcessNetworkTestSuite) TearDownSuite()

func (*ProcessNetworkTestSuite) TestNetworkFlows

func (s *ProcessNetworkTestSuite) TestNetworkFlows()

func (*ProcessNetworkTestSuite) TestProcessLineageInfo

func (s *ProcessNetworkTestSuite) TestProcessLineageInfo()

func (*ProcessNetworkTestSuite) TestProcessViz

func (s *ProcessNetworkTestSuite) TestProcessViz()

type ProcessesAndEndpointsTestSuite

type ProcessesAndEndpointsTestSuite struct {
	IntegrationTestSuiteBase

	Executable        string
	Args              []string
	ExpectedEndpoints []types.EndpointInfo
	ExpectedProcesses []types.ProcessInfo
	ContainerName     string
	// contains filtered or unexported fields
}

func (*ProcessesAndEndpointsTestSuite) SetupSuite

func (s *ProcessesAndEndpointsTestSuite) SetupSuite()

func (*ProcessesAndEndpointsTestSuite) TearDownSuite

func (s *ProcessesAndEndpointsTestSuite) TearDownSuite()

func (*ProcessesAndEndpointsTestSuite) TestProcessesAndEndpoints

func (s *ProcessesAndEndpointsTestSuite) TestProcessesAndEndpoints()

type ProcfsScraperTestSuite

type ProcfsScraperTestSuite struct {
	IntegrationTestSuiteBase
	ServerContainer             string
	TurnOffScrape               bool
	RoxProcessesListeningOnPort bool
}

func (*ProcfsScraperTestSuite) SetupSuite

func (s *ProcfsScraperTestSuite) SetupSuite()

Launches nginx container Launches gRPC server in insecure mode Launches collector Note it is important to launch the nginx container before collector, which is the opposite of other tests. The purpose is that we want ProcfsScraper to see the nginx endpoint and we do not want NetworkSignalHandler to see the nginx endpoint.

func (*ProcfsScraperTestSuite) TearDownSuite

func (s *ProcfsScraperTestSuite) TearDownSuite()

func (*ProcfsScraperTestSuite) TestProcfsScraper

func (s *ProcfsScraperTestSuite) TestProcfsScraper()

type RepeatedNetworkFlowTestSuite

type RepeatedNetworkFlowTestSuite struct {
	//The goal with these integration tests is to make sure we report the correct number of
	//networking events. Sometimes if a connection is made multiple times within a short time
	//called an "afterglow" period, we only want to report the connection once.
	IntegrationTestSuiteBase
	ClientContainer        string
	ClientIP               string
	ServerContainer        string
	ServerIP               string
	ServerPort             string
	EnableAfterglow        bool
	AfterglowPeriod        int
	ScrapeInterval         int
	NumMetaIter            int
	NumIter                int
	SleepBetweenCurlTime   int
	SleepBetweenIterations int
	ExpectedActive         int // number of active connections expected
	ExpectedInactive       int // number of inactive connections expected
}

func (*RepeatedNetworkFlowTestSuite) SetupSuite

func (s *RepeatedNetworkFlowTestSuite) SetupSuite()

Launches collector Launches gRPC server in insecure mode Launches nginx container

func (*RepeatedNetworkFlowTestSuite) TearDownSuite

func (s *RepeatedNetworkFlowTestSuite) TearDownSuite()

func (*RepeatedNetworkFlowTestSuite) TestRepeatedNetworkFlow

func (s *RepeatedNetworkFlowTestSuite) TestRepeatedNetworkFlow()

type SocatTestSuite

type SocatTestSuite struct {
	IntegrationTestSuiteBase
	// contains filtered or unexported fields
}

func (*SocatTestSuite) SetupSuite

func (s *SocatTestSuite) SetupSuite()

func (*SocatTestSuite) TearDownSuite

func (s *SocatTestSuite) TearDownSuite()

func (*SocatTestSuite) TestSocat

func (s *SocatTestSuite) TestSocat()

type SymbolicLinkProcessTestSuite

type SymbolicLinkProcessTestSuite struct {
	IntegrationTestSuiteBase
	// contains filtered or unexported fields
}

func (*SymbolicLinkProcessTestSuite) SetupSuite

func (s *SymbolicLinkProcessTestSuite) SetupSuite()

func (*SymbolicLinkProcessTestSuite) TearDownSuite

func (s *SymbolicLinkProcessTestSuite) TearDownSuite()

func (*SymbolicLinkProcessTestSuite) TestSymbolicLinkProcess

func (s *SymbolicLinkProcessTestSuite) TestSymbolicLinkProcess()

Jump to

Keyboard shortcuts

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