Guidance for AI agents working on this repository.
make build
# Compiles the extension binary to bin/openshift-logging-e2e-tests-tests-ext (fixtures are embedded via //go:embed)Run unit tests with make test (e.g. internal/test/helpers, internal/receivers, test/e2e/testdata). It needs no
cluster. Run it after touching test/e2e/testdata/ or any FixturePath / filepath.Join(loggingBaseDir, ...) reference
— it fails on references to fixtures that do not exist.
Always rebuild after editing any .go file or testdata fixtures before running tests.
Most tests subscribe operators via OLM and require the target channel to be set:
| Variable | Example | Purpose |
|---|---|---|
LOGGING_TEST_VERSION |
6.7 |
OLM channel suffix; becomes stable-6.7. Required for the majority of tests — omitting it causes an explicit failure rather than a silent skip. |
LOGGING_UPGRADE_FROM_VERSION |
6.6 |
Source channel for major-version upgrade tests (53404). Omitting it skips those tests. |
Pass only the version number (e.g. 6.7), not the full channel name — stable-6.7 will be rejected at startup.
export KUBECONFIG=/path/to/kubeconfig
export LOGGING_TEST_VERSION=6.7 # required for most tests
export LOGGING_UPGRADE_FROM_VERSION=6.6 # required for upgrade tests 53404/53407
# Run by case ID (preferred)
make run-case CASE=65131
# Find a test by ID
make list-tests GREP=65131All oc variables must use exutil.NewCLIWithoutNamespace(...). Do not use exutil.NewCLI(...). The NewCLI variant registers an automatic BeforeEach(SetupProject) which creates an extra namespace on every test run.
Tests that call oc.Namespace() at the top of a g.It() block will get an empty string unless oc.SetupProject() has been called first — either in the enclosing g.BeforeEach or at the start of the g.It block itself. The symptom is error: resource name may not be empty with -n (empty namespace) in the oc command.
Fix: add oc.SetupProject() immediately before the first oc.Namespace() call in the It block.
Fixtures are embedded with //go:embed all:logging from inside test/e2e/testdata, so paths are relative to that directory and start at logging. Any FixturePath(...) call that includes "testdata" as the first element will panic with fixture not found.
Correct:
filePath := []string{"logging", "external-log-stores", "rsyslog"}Wrong:
filePath := []string{"testdata", "logging", "external-log-stores", "rsyslog"}- Each
g.Describe/g.Contexthas ag.BeforeEachthat deploys the required operator(s) (CLO, LokiOperator, etc.) - Tests that need multiple namespaces call
oc.SetupProject()multiple times within theg.Itblock — each call creates a new project and advancesoc.Namespace() - Shared utilities live in
utils.go,loki_utils.go,elasticsearch_utils.go,splunk_util.go,aws_utils.go,azure_utils.go - Testdata fixtures are embedded at build time; add new YAML files under
test/e2e/testdata/logging/and runmake build