Skip to content

Add tests for examples#219

Open
VukPavicRTRK wants to merge 3 commits into
eclipse-score:mainfrom
VukPavicRTRK:issue-218-example-tests
Open

Add tests for examples#219
VukPavicRTRK wants to merge 3 commits into
eclipse-score:mainfrom
VukPavicRTRK:issue-218-example-tests

Conversation

@VukPavicRTRK
Copy link
Copy Markdown
Contributor

Summary

Makes //examples testable via bazel test so that the demo setup is automatically verified, preventing silent breakage from being merged unnoticed.

What Changed

  • examples/integration_test/ - New integration test package:
    • test_examples.py - Starts the launch manager, transitions to Running (verifying all example apps are alive), transitions back to Startup, and cleanly shuts down via SIGTERM.
    • lifecycle_demo_test.json - Launch manager config scoped to the test environment (/tmp/tests/examples).
    • BUILD - Bazel build file packaging binaries via pkg_tar and wiring up the integration_test rule.
  • examples/README.md - Documents how to run the new integration tests.
  • Visibility updates - Extended //examples:__subpackages__ visibility to testing_utils, environments, and the x86_64 OCI image target to allow reuse of shared test infrastructure.

Acceptance Criteria

  • bazel test //examples/... --config=<...> tests that the demo is working correctly.

Notes on Approach

The test reuses the existing base image and integration_test infra from tests/utils/environments/x86_64-linux rather than defining a new one from scratch, as suggested in the issue. Binaries are packaged into a pkg_tar archive and deployed to the correct location, replacing the need for manual copy scripts.

The smoke test in tests/integration/smoke uses gtest APIs, so sharing test code directly wasn't practical - this test is implemented in Python using the same setup_test fixture pattern used elsewhere in the integration test suite.

How to Run

bazel test //examples/... --config=<...>

Closes #218

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.4.2) and connecting to it...
INFO: Invocation ID: 70e795e9-322a-4ccd-b91f-c41c48461ef1
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (29 packages loaded, 10 targets configured)

Analyzing: target //:license-check (86 packages loaded, 11 targets configured)

Analyzing: target //:license-check (137 packages loaded, 2708 targets configured)

Analyzing: target //:license-check (146 packages loaded, 7148 targets configured)

Analyzing: target //:license-check (147 packages loaded, 8037 targets configured)

Analyzing: target //:license-check (157 packages loaded, 8094 targets configured)

Analyzing: target //:license-check (158 packages loaded, 8218 targets configured)

INFO: Analyzed target //:license-check (162 packages loaded, 10232 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions, 1 running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 20.439s, Critical Path: 2.52s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@VukPavicRTRK VukPavicRTRK force-pushed the issue-218-example-tests branch from f87c320 to 7470d7e Compare June 1, 2026 08:27
@VukPavicRTRK VukPavicRTRK force-pushed the issue-218-example-tests branch from 7470d7e to a155751 Compare June 1, 2026 08:33
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

The created documentation from the pull request is available at: docu-html

Comment thread examples/integration_test/BUILD Outdated
Comment thread examples/README.md Outdated
Copy link
Copy Markdown
Contributor

@MaciejKaszynski MaciejKaszynski left a comment

Choose a reason for hiding this comment

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

Looks good, I re-ran this 300 times to make sure the timing is correct and came across the error from #175 but otherwise works good

@VukPavicRTRK VukPavicRTRK changed the title feat: add tests for examples Add tests for examples Jun 1, 2026
@VukPavicRTRK VukPavicRTRK self-assigned this Jun 2, 2026
"""
Objective: Verifies the example demo runs end-to-end without crashing.

Starts the launch manager, transitions to Running (all example apps start), then back to Startup.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be possible to extend this to also kill a process and make a supervision fail as in

read -p "$(echo -e ${COLOR}Next: Killing an application process${NC})"

read -p "$(echo -e ${COLOR}Next: Trigger supervision failure${NC})"
echo "$> fail $(pgrep cpp_supervised)"
kill -s SIGUSR1 $(pgrep cpp_supervised)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make /examples Testable with Bazel

3 participants