Skip to content

WIP: Consumer tests #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

MaximilianSoerenPollak
Copy link
Contributor

Developing the consumer tests here for docs-as-code.

Just want to gather some feedback here on the general appraoch etc.


UNFINISHED therefore done as draft.

Copy link

github-actions bot commented Jul 9, 2025

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //src:license-check

Status: ✅ Passed

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: dc149c6f-da00-483c-9621-b872194be4ab
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: src
Loading: 0 packages loaded
    currently loading: src
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)

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

Analyzing: target //src:license-check (139 packages loaded, 599 targets configured)

Analyzing: target //src:license-check (152 packages loaded, 1997 targets configured)

Analyzing: target //src:license-check (155 packages loaded, 2663 targets configured)

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

Analyzing: target //src:license-check (162 packages loaded, 4820 targets configured)

INFO: Analyzed target //src:license-check (163 packages loaded, 4946 targets configured).
[9 / 13] [Prepa] Generating Dash formatted dependency file ... ... (2 actions, 0 running)
INFO: Found 1 target...
Target //src:license.check.license_check up-to-date:
  bazel-bin/src/license.check.license_check
  bazel-bin/src/license.check.license_check.jar
INFO: Elapsed time: 17.158s, Critical Path: 0.87s
INFO: 13 processes: 3 disk cache hit, 9 internal, 1 processwrapper-sandbox.
INFO: Build completed successfully, 13 total actions
INFO: Running command line: bazel-bin/src/license.check.license_check src/formatted.txt -review -project automotive.score -repo https://github.com/eclipse-score/docs-as-code -token otyhZ4eaRYK1tKLNNF-Y
[main] INFO Querying Eclipse Foundation for license data for 84 items.
[main] INFO Found 58 items.
[main] INFO Querying ClearlyDefined for license data for 26 items.
[main] INFO Found 26 items.
[main] INFO Vetted license information was found for all content. No further investigation is required.

Copy link

github-actions bot commented Jul 9, 2025

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

@dcalavrezo-qorix dcalavrezo-qorix requested a review from Copilot July 9, 2025 07:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This draft adds end-to-end consumer tests that clone sample repositories, override their Bazel dependencies (locally or via Git), and verify build success.

  • Introduces a ConsumerRepo dataclass and a list of repos to test
  • Implements helper functions to patch MODULE.bazel for local and Git overrides
  • Adds a single parametrized test (test_and_clone_repos) to clone repos, apply overrides, and run Bazel commands
Comments suppressed due to low confidence (1)

src/tests/test_consumer.py:24

  • [nitpick] Attribute names should follow snake_case; rename to local_override_result for consistency.
    LocalOverrideResult: bool

Adding some test commands
Figured out why it wasn't producing wanted errors
Now need to introduce error parsing
# Running through all 'cmds' specified with the local override
print_running_cmd(repo.name, cmd, "LOCAL OVERRIDE")

out = subprocess.run(cmd.split(), capture_output=True, text=True)
Copy link
Member

Choose a reason for hiding this comment

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

why not check the subprocess for errors also here? with check=True. I feel like if some future maintainer “optimises” the processing of BR and forgets to look at returncode failures silently become successes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is, that if I do 'check=True' here, if bazel exits with a non 0 exit code (which it does when sphinx errors for example) it just stops execution immediatly there.
At least to my testing. That's why I thought it better to not do this here.

Copy link
Member

Choose a reason for hiding this comment

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

understood

@MaximilianSoerenPollak
Copy link
Contributor Author

Also note.

This is on purpose not a Bazel test target, as this is executed via direct call.
.venv/bin/python -m pytest <args> src/tests

Additionally, the placement of this is obviously not finaly, I just put it there for now, if you can think of where it would fit better, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Draft
Development

Successfully merging this pull request may close these issues.

2 participants