Skip to content

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Jun 13, 2025

What does this PR do?

  • Split Kubernetes integration tests into a dedicated testing/integration/k8s package.
  • Removed the need for the kubernetes build tag; Kubernetes tests are now always compiled as part of the normal integration tag.
  • Introduced a TestMain entrypoint in the new package, enabling centralized setup logic.
  • Renamed mage targets to be consistent with other test oriented mage targets:
    • integration:TestKubernetes (formerly integration:Kubernetes)
    • integration:TestKubernetesMatrix (formerly integration:KubernetesMatrix)
    • integration:TestKubernetesSingle (formerly integration:KubernetesSingle)
  • Updated all references in Buildkite pipeline and documentation accordingly.
  • Performed mechanical moves of existing Kubernetes test files into the new package (journald_test.go, kubernetes_agent_service_test.go, kubernetes_agent_standalone_test.go, otel_helm_test.go, and their respective testdata).

Why is it important?

This PR continues the ongoing effort of modularizing the ever-growing integration package as part of #8087. Specifically, it addresses the Kubernetes test split described in #8412.

Having Kubernetes tests in a dedicated package offers multiple benefits:

  • Better test ownership and isolation of Kubernetes-specific test logic.
  • With this PR and the introduction of the dedicated TestMain, we unlock further future improvements for developer velocity:
    • We can load container images into the kind cluster only once per test run.
    • We can render Kustomize YAML manifests once upfront, avoiding per-test Kustomize render calls which are prone to network-transient failures.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

No user-facing disruption; internal test structure change only.

How to test this PR locally

EXTERNAL=true SNAPSHOT=true PACKAGES=docker DOCKER_VARIANTS=basic PLATFORMS=linux/arm64 mage package

INSTANCE_PROVISIONER="kind" TEST_PLATFORMS="kubernetes/arm64/1.33.0/basic" mage integration:TestKubernetes

Related issues

@pkoutsovasilis pkoutsovasilis self-assigned this Jun 13, 2025
@pkoutsovasilis pkoutsovasilis added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog backport-active-all Automated backport with mergify to all the active branches labels Jun 13, 2025
@pkoutsovasilis pkoutsovasilis force-pushed the feat/split_up_k8s_integration_tests branch 5 times, most recently from eae684f to b9d6713 Compare June 14, 2025 09:32
@elasticmachine
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @pkoutsovasilis

@pkoutsovasilis pkoutsovasilis force-pushed the feat/split_up_k8s_integration_tests branch from b9d6713 to 6879538 Compare June 14, 2025 11:10
@pkoutsovasilis pkoutsovasilis force-pushed the feat/split_up_k8s_integration_tests branch from 6879538 to d6b76a0 Compare June 14, 2025 13:08
@elastic-sonarqube
Copy link

@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review June 16, 2025 07:08
@pkoutsovasilis pkoutsovasilis requested review from a team as code owners June 16, 2025 07:08
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Member

@pchila pchila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice.

Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a super nit comment with a super nit improvement 👼

@pkoutsovasilis pkoutsovasilis merged commit dd52e90 into elastic:main Jun 17, 2025
11 checks passed
@github-actions
Copy link
Contributor

@Mergifyio backport 8.17 8.18 8.19 9.0

@mergify
Copy link
Contributor

mergify bot commented Jun 17, 2025

backport 8.17 8.18 8.19 9.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jun 17, 2025
* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	docs/test-framework-dev-guide.md
#	go.mod
#	magefile.go
#	testing/integration/beat_receivers_test.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
#	testing/integration/otel_test.go
mergify bot pushed a commit that referenced this pull request Jun 17, 2025
* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	docs/test-framework-dev-guide.md
#	go.mod
#	magefile.go
#	testing/integration/beat_receivers_test.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
#	testing/integration/otel_test.go
mergify bot pushed a commit that referenced this pull request Jun 17, 2025
* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	magefile.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
mergify bot pushed a commit that referenced this pull request Jun 17, 2025
* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	go.mod
#	magefile.go
#	testing/integration/beat_receivers_test.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
pkoutsovasilis added a commit that referenced this pull request Jun 17, 2025
* [test] split up k8s integration tests (#8484)

* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	docs/test-framework-dev-guide.md
#	go.mod
#	magefile.go
#	testing/integration/beat_receivers_test.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
#	testing/integration/otel_test.go

* fix: resolve conflicts

* fix: remove irrelevant files

* fix: update NOTICE.txt

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Jun 17, 2025
* [test] split up k8s integration tests (#8484)

* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	go.mod
#	magefile.go
#	testing/integration/beat_receivers_test.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml

* fix: resolve conflicts

* fix: go mod tidy

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Jun 17, 2025
* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	magefile.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
pkoutsovasilis added a commit that referenced this pull request Jun 17, 2025
* [test] split up k8s integration tests (#8484)

* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	magefile.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml

* feat: move journald-input.yml

* feat: remove journald-otel.yml

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Jun 18, 2025
* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	docs/test-framework-dev-guide.md
#	go.mod
#	magefile.go
#	testing/integration/beat_receivers_test.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
#	testing/integration/otel_test.go
pkoutsovasilis added a commit that referenced this pull request Jun 18, 2025
* [test] split up k8s integration tests (#8484)

* feat: split up k8s integration test in testing/integration/k8s package

* feat: remove the need of a kubernetes build tag

* feat: expand k8s integration step on failure

(cherry picked from commit dd52e90)

# Conflicts:
#	docs/test-framework-dev-guide.md
#	go.mod
#	magefile.go
#	testing/integration/beat_receivers_test.go
#	testing/integration/k8s/journald_test.go
#	testing/integration/k8s/kubernetes_agent_standalone_test.go
#	testing/integration/k8s/testdata/journald-input.yml
#	testing/integration/k8s/testdata/journald-otel.yml
#	testing/integration/otel_test.go

* fix: resolve conflicts

* fix: remove irrelevant files

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split up Kubernetes integration tests into dedicated package

6 participants