Skip to content

migrate libbeat monitoring tests from python to go#50177

Draft
leehinman wants to merge 1 commit intoelastic:mainfrom
leehinman:48850_migrate_python_monitoring_tests_to_go
Draft

migrate libbeat monitoring tests from python to go#50177
leehinman wants to merge 1 commit intoelastic:mainfrom
leehinman:48850_migrate_python_monitoring_tests_to_go

Conversation

@leehinman
Copy link
Copy Markdown
Contributor

Proposed commit message

Converts test_monitoring.py system tests to Go integration tests using the existing libbeat/tests/integration framework, continuing the effort to replace Python-based system tests with Go integration tests.

  • Adds libbeat/tests/integration/monitoring_test.go with three tests
  • Removes libbeat/tests/system/test_monitoring.py

The three tests cover:

Go test Python original Infrastructure required
TestMonitoringClusterUUID test_cluster_uuid_setting None
TestMonitoringClusterUUIDMonitoringDisabled test_cluster_uuid_setting_monitoring_disabled None
TestMonitoringDirectToCluster test_direct_to_monitoring_cluster Main ES + monitoring ES

Notable implementation details

Dynamic HTTP port allocation — The Python tests hardcoded localhost:5066 for the beat's HTTP /state endpoint. The Go tests use freePort() to allocate a random available port and configure it in the beat's YAML config. This prevents port conflicts when a test process is left alive after a timeout.

Selective skipping for the monitoring clusterTestMonitoringDirectToCluster calls EnsureESIsRunning (fatal if the main cluster is absent, consistent with all other ES integration tests) and ensureMonitoringESIsRunning (skip if the dedicated monitoring cluster at ES_MONITORING_HOST:ES_MONITORING_PORT is absent). This matches the original Python behaviour where that test was only run when INTEGRATION_TESTS was set and the monitoring cluster was available.

Original class was @unittest.skip — The entire Python class was marked permanently skipped due to flakiness (#16247). The two cluster UUID tests translate cleanly into reliable Go tests that need no external services. TestMonitoringDirectToCluster is a proper integration test gated on the full monitoring infrastructure.

Checklist

  • 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. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

None. Test code.

How to test this PR locally

cd libbeat && mage goIntegTest

Related issues

Use cases

Screenshots

Logs

@leehinman leehinman added backport-skip Skip notification from the automated backport with mergify Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team skip-changelog labels Apr 16, 2026
@botelastic botelastic Bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Skip notification from the automated backport with mergify skip-changelog Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant