Skip to content

WIP: Consumer tests#129

Merged
AlexanderLanin merged 14 commits into
mainfrom
MSP_add_consumer_tests
Jul 23, 2025
Merged

WIP: Consumer tests#129
AlexanderLanin merged 14 commits into
mainfrom
MSP_add_consumer_tests

Conversation

@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor

@MaximilianSoerenPollak MaximilianSoerenPollak commented Jul 9, 2025

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

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

@github-actions
Copy link
Copy Markdown

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: 1b88a96a-2f40-43ea-b22f-7b2fc8a0e47c
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
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 (103 packages loaded, 10 targets configured)

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

Analyzing: target //src:license-check (153 packages loaded, 2652 targets configured)

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

Analyzing: target //src:license-check (160 packages loaded, 2692 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).
[11 / 13] [Prepa] JavaToolchainCompileBootClasspath external/rules_java~/toolchains/platformclasspath.jar
[12 / 13] [Prepa] Building src/license.check.license_check.jar ()
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: 22.028s, Critical Path: 2.93s
INFO: 13 processes: 9 internal, 3 processwrapper-sandbox, 1 worker.
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.

@github-actions
Copy link
Copy Markdown

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
Copy Markdown

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

Comment thread src/tests/test_consumer.py Outdated
Comment thread src/tests/test_consumer.py Outdated
Comment thread src/tests/test_consumer.py Outdated
Comment thread src/tests/test_consumer.py
Comment thread src/tests/test_consumer.py Outdated
# 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

understood

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it throws an exception. you could catch it. It's safer - but more boilerplate than checking return code.

@MaximilianSoerenPollak
Copy link
Copy Markdown
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.

Comment thread src/tests/test_consumer.py Outdated
Comment thread src/tests/test_consumer.py Outdated
Comment thread src/tests/test_consumer.py
Comment thread src/tests/test_consumer.py Outdated
@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

@AlexanderLanin Where should this test file be located btw? Not really sure if this is a good place for it, where I put it currently.

@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

One thing I do struggle with this, and have not even attempted is. How can this be tested beyond just manually testing it and making sure it does what it should?
Seems extremely difficult to me.

@Aymen-Soussi-01
Copy link
Copy Markdown
Contributor

Don't forget to correct the formatting check

@MaximilianSoerenPollak
Copy link
Copy Markdown
Contributor Author

Don't forget to correct the formatting check

Thanks. Just pushed the formatting.

@MaximilianSoerenPollak MaximilianSoerenPollak marked this pull request as ready for review July 23, 2025 09:19
Found a way to get results out of stderr&out.
Still needs quiet a bit of work.
But slowly getting there.
Removed Metamodel exception.
Simplified code structure.
@AlexanderLanin AlexanderLanin merged commit da00eeb into main Jul 23, 2025
7 checks passed
@AlexanderLanin AlexanderLanin deleted the MSP_add_consumer_tests branch July 23, 2025 10:53
arnoox pushed a commit to arnoox/score-docs-as-code that referenced this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

5 participants