Skip to content

test: add automation for microcks-based acceptance tests#1552

Merged
asyncapi-bot merged 46 commits into
asyncapi:masterfrom
derberg:abcdef
May 17, 2025
Merged

test: add automation for microcks-based acceptance tests#1552
asyncapi-bot merged 46 commits into
asyncapi:masterfrom
derberg:abcdef

Conversation

@derberg

@derberg derberg commented May 8, 2025

Copy link
Copy Markdown
Member

fixes #1497

it was about time to add this automation as you can see in files changed, there are many changes related to file names update, services name changes, etc, that happened over time but were never updated in tests that were not triggered by automation.

lesson: if you have some manual process, it will always fail :)

I left some inline comments, also there are some readme updates for clarity.

Summary by CodeRabbit

  • New Features

    • Added a script to run tests for all packages in the repository.
    • Enhanced test automation with separate integration and acceptance test jobs for improved CI workflows.
  • Bug Fixes

    • Updated test and acceptance scripts and configurations to target the correct WebSocket server and service identifiers.
  • Documentation

    • Improved instructions for running tests and clarified usage of AsyncAPI document bundling in test documentation.
  • Chores

    • Updated Docker Compose profiles and service configurations for more flexible local and CI test environments.
    • Added new ignore rule for bundled AsyncAPI fixture files.

@changeset-bot

changeset-bot Bot commented May 8, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: aaca01a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@derberg
derberg marked this pull request as ready for review May 8, 2025 13:47
@coderabbitai

coderabbitai Bot commented May 8, 2025

Copy link
Copy Markdown

Walkthrough

The changes introduce and automate acceptance testing for generated WebSocket clients using Microcks within the GitHub Actions workflow. This involves updating the workflow logic, Docker Compose setup, test scripts, and documentation to support running and validating acceptance tests in CI, ensuring errors propagate and test results are tracked.

Changes

File(s) Change Summary
.github/workflows/pr-testing-with-test-project.yml Refactored workflow: updated should_test logic, split test jobs into test and acceptance, added steps for integration and acceptance tests with Microcks, ensured jobs run conditionally, and improved error propagation.
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml Enhanced Docker Compose: added profiles for infra/ci/tests, added asyncapi-bundler and npm-test services, updated service dependencies and images, improved commands for importing bundled AsyncAPI specs, adjusted test service images/commands, and clarified comments for local vs CI execution.
packages/templates/clients/websocket/test/README.md Updated documentation: revised Podman Compose instructions, added AsyncAPI bundling note, changed test targets and commands to reference the Echo WebSocket server, and improved formatting.
packages/templates/clients/websocket/test/javascript/acceptance.test.js Updated acceptance tests: changed WebSocket URLs and service IDs to target the Hoppscotch Echo WebSocket Server for receiver and sender tests.
packages/templates/clients/websocket/test/python/test_acceptance.py Updated Python acceptance tests: changed import paths, WebSocket URLs, and service IDs to target the Echo WebSocket Server and adapt to new snapshot result structure.
package.json Added script: packages:test for running tests on all packages using turbo.
packages/components/package.json Modified "test" script to run build before jest coverage.
.gitignore Added ignore rule for bundled AsyncAPI fixture file.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Workflow
    participant Docker Compose
    participant Microcks
    participant Test Scripts

    GitHub Actions->>Workflow: Trigger on PR
    Workflow->>Workflow: Determine should_test output
    alt should_test == true
        Workflow->>Docker Compose: Start infra and test services
        Docker Compose->>Microcks: Spin up Microcks and dependencies
        Docker Compose->>Test Scripts: Run integration and acceptance tests
        Test Scripts->>Microcks: Interact with mock server (acceptance)
        Test Scripts->>Workflow: Report test results
        Workflow->>GitHub Actions: Mark job as pass/fail
    else should_test == false
        Workflow->>GitHub Actions: Skip test jobs
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Workflow spins up microcks-podman.yml for acceptance tests (#1497)
Workflow ensures access to generated clients for tests (#1497)
Workflow propagates errors from acceptance tests to fail CI if tests fail (#1497)

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • magicmatatjahu
  • jonaslagoni
  • asyncapi-bot-eve

Poem

In the warren where code and tests unite,
The rabbits hop and automate with delight.
Microcks now listens, acceptance is spun,
With Docker Compose, the tests are all run.
If a bug should appear, the CI will shout—
But today, dear friends, all tests hop out! 🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (5)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (4)

110-117: Refactor the volume mount for npm-test.
The relative path ../../../../../../ is brittle and easy to break if the file structure changes. Consider simplifying to a more robust mount, for example:

 volumes:
-  - ../../../../../../:/usr/src/app
+  - ./:/usr/src/app

or using an environment variable (${PWD}:/usr/src/app).


122-122: Pin a more specific Node.js image tag.
Using node:20 will float to the latest patch. For reproducibility and smaller images, you could pin a digest or switch to an Alpine/slim variant, e.g.:

image: node:20-alpine

135-136: Normalize the restart policy.
The YAML uses a string "no". For clarity and to match most Compose examples, you can use an unquoted boolean-like value or remove it (default is no-restart):

-restart: "no"
+restart: no

150-153: Simplify the Python tester command sequence.
The long chained cd and pip install calls can be consolidated for readability and reuse. For example, merge requirements into one file or reduce directory jumps:

-command: ["sh", "-c", "cd packages/.../client_hoppscotch && pip install -r requirements.txt && cd ../../../../test/python && pip install -r requirements.txt && pytest"]
+command: ["sh", "-c", "pip install -r packages/.../client_hoppscotch/requirements.txt -r packages/.../test/python/requirements.txt && pytest packages/.../test/python"]
.github/workflows/pr-testing-with-test-project.yml (1)

12-12: Use consistent naming for workflow outputs.
Currently you map steps.should_run.outputs.shouldrun into should_test. Consider renaming the step’s output key to should_test for symmetry and to reduce confusion.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d5703b and 7bc4aa4.

📒 Files selected for processing (3)
  • .github/workflows/pr-testing-with-test-project.yml (3 hunks)
  • package.json (1 hunks)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 20
  • GitHub Check: Test generator as dependency with Node 18
🔇 Additional comments (3)
package.json (1)

33-33: Verify packages:test filter pattern.
The new script uses --filter=./packages/* --only. Please confirm that the leading ./ and the single-star glob correctly match all workspace packages (including nested ones). You may need to use packages/** or omit the ./ prefix for full coverage.

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

132-133: Verify Compose spec support for depends_on.condition.
You’re relying on condition: service_completed_successfully, which requires Compose v2.x semantics. Ensure that Podman Compose honors this field; otherwise the dependency ordering may not work in CI/local.

.github/workflows/pr-testing-with-test-project.yml (1)

34-34: Conditional check correctly updated.
The if step now directly references steps.filter.outputs.modified_files. This change looks good and preserves the intended gating logic.

Comment thread .github/workflows/pr-testing-with-test-project.yml
Comment thread .github/workflows/pr-testing-with-test-project.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

122-127: Upgrade tester-js to Node 20 and chain dependencies
Bumping the image to node:20 matches npm-test. The new depends_on ensures JS acceptance tests wait for package tests to complete. As a nitpick, consider using npm ci instead of npm install for reproducible, lockfile-driven installs.

Also applies to: 132-135

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d5703b and 7bc4aa4.

📒 Files selected for processing (3)
  • .github/workflows/pr-testing-with-test-project.yml (3 hunks)
  • package.json (1 hunks)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (3 hunks)
🔇 Additional comments (5)
package.json (1)

33-33: Add selective test script for all packages
The new packages:test script enables running tests across all packages under ./packages/*. Please verify that turbo run test --filter=./packages/* --only correctly filters the intended workspaces according to Turbo’s filter semantics (workspace name vs. file path), especially on both Linux and Windows.

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

110-118: Add npm-test service to orchestrate JS package tests
Introducing a dedicated npm-test service ensures all JavaScript packages are validated before acceptance tests run. The relative mount (../../../../../../:/usr/src/app) aligns with the repo root from this YAML’s location, and restart: "no" is appropriate to prevent unwanted retries.

.github/workflows/pr-testing-with-test-project.yml (3)

12-12: Propagate decision from should_run step
Mapping changes.outputs.should_test to steps.should_run.outputs.shouldrun centralizes the logic determining if downstream jobs execute, ensuring both test and acceptance jobs only run on relevant changes.


34-38: Refine should_run conditional to filter PRs
The updated if clause now runs tests only for non-draft PRs that modify source files (excluding markdown/docs) and skips routine bot/version-bump PRs. This effectively reduces unnecessary CI runs.


51-69: Introduce test job for Node integration tests
Splitting out the test job with a Node 18/20 matrix gives faster feedback on generator integration. Passing NODE_VERSION into Docker Compose lets the compose files dynamically pick the correct Node image.

Comment thread packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml Outdated
Comment thread .github/workflows/pr-testing-with-test-project.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/pr-testing-with-test-project.yml (3)

35-46: Consider extracting bot‐title exceptions
The negated block for asyncapi-bot, asyncapi-bot-eve, and allcontributors[bot] works, but as more automation is added it may become hard to maintain. You could factor these into a small composite action or at least move the list of excluded actors/titles into a single YAML anchor for clarity.


51-69: Correct use of step‐level conditionals
Splitting the old commented-out job into a dedicated test job and gating only the docker compose up step on needs.changes.outputs.should_test is exactly the right pattern. It guarantees the job always appears (satisfying branch-protection) while avoiding unnecessary work when no relevant files change.

Once the flag behaviour stabilizes, consider removing or lowering the verbosity of the interim Log should_test value step to clean up your checks output.


70-84: Approve acceptance test job structure
The new acceptance job mirrors the integration tests pattern, uses step-level gating on the same flag, and correctly points at the Microcks Podman compose file. This ensures acceptance tests run only when needed and still satisfy branch protection.

Similarly, you can drop or silence the debug logging step once you’re confident the flag propagation is correct.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc4aa4 and 0688eb9.

📒 Files selected for processing (1)
  • .github/workflows/pr-testing-with-test-project.yml (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
.github/workflows/pr-testing-with-test-project.yml (2)
Learnt from: derberg
PR: asyncapi/generator#1552
File: .github/workflows/pr-testing-with-test-project.yml:51-69
Timestamp: 2025-05-09T08:24:17.265Z
Learning: In GitHub Actions workflows, don't use job-level `if` conditions for jobs that might be required in branch protection rules. When a job is skipped via job-level conditions, it doesn't appear in the GitHub checks list at all, and if that job is set as required, PRs would be blocked indefinitely. Instead, use step-level conditionals within the job to skip the substantive work while still allowing the job to complete successfully.
Learnt from: derberg
PR: asyncapi/generator#1552
File: .github/workflows/pr-testing-with-test-project.yml:70-84
Timestamp: 2025-05-09T08:25:03.402Z
Learning: When suggesting workflow optimizations in GitHub Actions, be cautious with job-level conditional statements (`if` at the job level). If a job with a job-level conditional is set as a required check in branch protection settings, PRs that don't trigger the job (condition evaluates to false) can never be merged since GitHub would be waiting for a required check that never runs. Using step-level conditionals is often better as the job still completes successfully, satisfying branch protection requirements.
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 18
  • GitHub Check: Test generator as dependency with Node 20
🔇 Additional comments (1)
.github/workflows/pr-testing-with-test-project.yml (1)

33-47: Good: Consolidated “should run” logic into one step
Moving the path check and all bot/draft exclusions into the should_run step makes the workflow cleaner and avoids duplicating conditions. The explicit steps.filter.outputs.modified_files == 'true' check combined with draft and specific-bot filters is comprehensive.

Comment thread .github/workflows/pr-testing-with-test-project.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

171-173: Verify and correct Python test paths in tester-py
The cd packages/templates/clients/websocket/python/test/... sequence still references python/test rather than the intended test/python directory. This path issue was flagged previously; please confirm the actual layout and update accordingly.

🧹 Nitpick comments (2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (2)

4-7: Explicit network definition for Microcks environment
Defining a custom microcks_default bridge network ensures all services communicate over an isolated network and avoids collisions with other Compose projects.


120-122: Use YAML array syntax for the importer command
Switching from a multiline string to an explicit array improves readability and avoids shell-escaping pitfalls.
+```diff

  • command: >
  • sh -c "microcks-cli import fixtures/asyncapi-hoppscotch-server.yml \
  • --microcksURL=http://microcks:8080/api/ \
    
  • --keycloakClientId=microcks-serviceaccount \
    
  • --keycloakClientSecret=…"
    
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd52b6 and faece0c.

📒 Files selected for processing (1)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (8 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

123-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 18
  • GitHub Check: Test generator as dependency with Node 20
🔇 Additional comments (10)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (10)

20-21: Attach Mongo service to the default network
Adding the mongo container to microcks_default enables it to resolve and communicate with other services by name.


52-53: Attach Kafka service to the default network
Ensures kafka can participate in the same network for service discovery and messaging.


82-85: Define network alias for app service
Using the alias microcks on the default network simplifies URLs for other services (http://microcks:8080).


105-106: Attach Async-minion service to the default network
Consistent networking configuration keeps all Microcks components reachable.


124-125: Attach Importer service to the default network
Ensures the importer can reach the app service via the microcks_default network.


127-136: Introduce npm-test service for package-level tests
The npm-test container cleanly separates JS package validation (npm ci && npm run packages:test) before spinning up language-specific testers. Volume mount correctly points to repo root.


141-141: Upgrade tester-js image to Node 20
Aligns the JS tester with the npm-test environment and ensures compatibility with modern syntax.


151-152: Ensure tester-js waits for npm-test to finish
Adding depends_on: npm-test: condition: service_completed_successfully guarantees package tests pass before running acceptance tests.


154-156: Disable restart and attach tester-js to the default network
restart: "no" is appropriate for one-off test containers; joining microcks_default enables service name resolution.


174-176: Disable restart and attach tester-py to the default network
Consistent with other testers, using restart: "no" and joining microcks_default is correct for a one-time acceptance test.

sh -c "microcks-cli import __fixtures__/asyncapi-hoppscotch-server.yml \
--microcksURL=http://microcks:8080/api/ \
--keycloakClientId=microcks-serviceaccount \
--keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove hard-coded Keycloak secret
Embedding --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54 exposes a credential in source control. Move this to an environment variable or Podman secret (e.g., environment: KEYCLOAK_CLIENT_SECRET).

🧰 Tools
🪛 Gitleaks (8.21.2)

123-123: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (2)

186-192: Verify and correct Python test paths in tester-py
The cd commands reference deep paths under packages/templates/clients/websocket/python/test then switch to ../../../../test/python. Ensure these directories match the actual layout (likely under packages/templates/clients/websocket/test/python).


135-138: ⚠️ Potential issue

Remove hard-coded Keycloak client secret
Embedding --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54 exposes a credential. Move this secret into an environment variable or Podman secret.

Example diff:

     command: >
       sh -c "microcks-cli import __fixtures__/asyncapi-hoppscotch-server.yml \
       --microcksURL=http://microcks:8080/api/ \
       --keycloakClientId=microcks-serviceaccount \
-      --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54"
+      --keycloakClientSecret=${KEYCLOAK_CLIENT_SECRET}"
     environment:
       - KEYCLOAK_CLIENT_SECRET
🧰 Tools
🪛 Gitleaks (8.21.2)

138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🧹 Nitpick comments (1)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

156-172: Review test dependencies for tester-js
The tester-js service correctly depends on successful npm-test and healthy app. Consider adding a dependency on importer completing successfully, so test data is loaded before JS acceptance tests run.

Example addition:

     depends_on:
       app:
         condition: service_healthy
       npm-test:
         condition: service_completed_successfully
+      importer:
+        condition: service_completed_successfully
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between faece0c and 5582af9.

📒 Files selected for processing (1)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (8 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 20
  • GitHub Check: Test generator as dependency with Node 18
🔇 Additional comments (7)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (7)

4-8: Consistent default network configuration added
Defining a named default network (microcks_default) ensures all services communicate over the same bridge network by default. This promotes consistency and isolation.


20-21: Attach mongo service to the default network
Good addition—ensures the MongoDB container is reachable by other services on microcks_default.


52-53: Attach kafka service to the default network
By adding Kafka to microcks_default, consumers and producers within the compose setup can resolve and communicate with the broker.


56-56: Configure app service hostname and network alias
Setting hostname: microcks and assigning the alias on microcks_default makes service discovery clearer and more predictable when other containers refer to the Microcks API.

Also applies to: 83-87


120-121: Attach async-minion to the default network
Ensures the async-minion can resolve microcks and any other services on microcks_default.


139-140: Attach importer to the default network
This allows the CLI importer container to reach the Microcks API over microcks_default.


142-151: Introduce npm-test service for orchestrated JS testing
Using a dedicated npm-test step isolates dependency installation and package-level tests before spinning up language-specific testers. This improves reliability and speeds up feedback loops.

Comment thread packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (2)

134-137: Remove hard-coded Keycloak client secret
Embedding --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54 poses a security risk. Move this value to an environment variable or Podman secret and inject via environment: or a secret: reference.

🧰 Tools
🪛 Gitleaks (8.21.2)

137-137: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


90-103: 🛠️ Refactor suggestion

Improve async-minion startup resilience
Introducing a shell-based health check before launching the Java process is solid. To avoid potential infinite loops if Microcks never becomes ready, add a retry counter and timeout.

Apply this diff within the entrypoint block:

@@ entrypoint:
-          echo "Waiting for microcks to be available..."
+          echo "Waiting for microcks to be available..."
+          attempts=0
           until curl -sf http://microcks:8080/api/health; do
             echo "  microcks not up yet, retrying..."
+            ((attempts++))
+            if [ "$attempts" -gt 60 ]; then
+              echo "Timeout waiting for Microcks, exiting."
+              exit 1
+            fi
             sleep 5
           done
🧹 Nitpick comments (3)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (3)

145-146: Reduce volume mapping scope
Mounting the entire repository (../../../../../../) into the container can expose unnecessary files and slows startup. Consider mapping only ./packages or the specific test directories needed.


164-165: Reduce volume mapping scope in JS tester
Mounting the entire repo into /usr/src/app is broad. Consider mapping only the specific test directory to minimize context and avoid exposing unrelated files.


184-184: Reduce volume mapping scope in Python tester
As with other services, mounting the entire repo into the container may introduce noise. Limit the volume mount to only the Python test folder or share via named volumes.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5582af9 and 49d7fef.

📒 Files selected for processing (1)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (8 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

137-137: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 18
  • GitHub Check: Test generator as dependency with Node 20
🔇 Additional comments (18)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (18)

4-7: Explicit network naming
Defining a named default network (microcks_default) helps ensure consistent connectivity across services and avoids collisions with other Compose networks. Confirm this name aligns with other environments to prevent network conflicts.


20-21: Attach Mongo to default network
Linking the mongo service to the microcks_default network ensures it’s accessible by hostname. If you need custom aliases, consider specifying them here.


52-53: Attach Kafka to default network
Connecting kafka to the shared network is good. Ensure that your advertised addresses in the command align with this network alias for inter-service communication.


56-56: Set consistent service hostname
Specifying hostname: microcks makes the service addressable as microcks inside the network. This complements the alias defined below.


82-85: Define network alias for app
The alias microcks on the default network is clear for internal references (e.g., for async-minion). Ensure downstream consumers use this alias.


119-120: Link async-minion to default network
Ensuring async-minion is on the same microcks_default network is necessary for it to reach microcks by alias.


138-139: Attach importer to default network
Adding the importer service to the shared network ensures it can reach Microcks at http://microcks:8080.


141-144: Introduce npm-test service for package-level tests
This new service cleanly separates test installation and execution, aligning well with the CI workflow.


149-149: Verify memory limit configuration
The mem_limit key is part of Docker Compose v2 and may not be supported in v3 or by Podman Compose. Confirm your Podman version accepts this, or migrate to the deploy.resources.limits.memory syntax.


150-151: Validate npm command and no-restart policy
Running npm ci && npm run packages:test in one command streamlines the build, and disabling restarts avoids unintended loops on failure. Looks good.


152-153: Attach npm-test to default network
Using the same network allows follow-up services (tester-js, tester-py) to run after test execution.


158-159: Upgrade JS tester image to Node 20
Pinning to node:20 and a descriptive container_name for tester-js is clear and keeps environments up to date.


168-169: Ensure JS tester waits for npm-test completion
The service_completed_successfully condition on npm-test is correct for orchestrating the test sequence.


170-171: Verify JS test command path
The command navigates to packages/templates/clients/websocket/test/javascript before running npm test. Please confirm this path exists relative to /usr/src/app and adjust if needed.


172-173: Attach JS tester to default network
Ensures the tester service can interact with Microcks endpoints.


188-189: Ensure Python tester waits for npm-test completion
Using service_completed_successfully for npm-test is correct to enforce test orchestration.


191-191: Disable restarts for Python tester
Setting restart: "no" prevents looping on failures, which is desired for CI. Looks good.


192-193: Attach Python tester to default network
Good to include the tester on the same network for service discovery.

command: ["sh", "-c", "cd packages/templates/clients/websocket/python/test/temp/snapshotTestResult && pip install -r requirements.txt && cd ../../../../test/python && pip install -r requirements.txt && pytest"]
npm-test:
condition: service_completed_successfully
command: ["sh", "-c", "cd packages/templates/clients/websocket/python/test/temp/snapshotTestResult/client_hoppscotch && pip install -r requirements.txt && cd ../../../../test/python && pip install -r requirements.txt && pytest"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: Validate Python test paths
The command uses a nested path (python/test/temp/snapshotTestResult/client_hoppscotch) and then backtracks to test/python. This looks brittle and may not align with your repo layout. Please confirm and simplify the directory structure or adjust the paths.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (2)

106-107: Remove hard-coded Keycloak client secret
Embedding --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54 exposes a sensitive credential in source control. Move this value into an environment variable or Podman secret and reference it in the command.

Example diff:

 microcks-cli-importer:
   # ...
-  command: >
-    sh -c "microcks-cli import __fixtures__/asyncapi-hoppscotch-server.yml \
-    --microcksURL=http://microcks:8080/api/ \
-    --keycloakClientId=microcks-serviceaccount \
-    --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54"
+  environment:
+    KEYCLOAK_CLIENT_SECRET: ${KEYCLOAK_CLIENT_SECRET}
+  command: >
+    sh -c "microcks-cli import __fixtures__/asyncapi-hoppscotch-server.yml \
+    --microcksURL=http://microcks:8080/api/ \
+    --keycloakClientId=microcks-serviceaccount \
+    --keycloakClientSecret=$KEYCLOAK_CLIENT_SECRET"
🧰 Tools
🪛 Gitleaks (8.21.2)

107-107: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


142-155: Correct and simplify Python acceptance test paths
The chained cd into python/test/temp/snapshotTestResult/... and backtracking into test/python is brittle and likely mismatches the actual layout (as noted in earlier reviews). Please confirm the directory structure and simplify the command. For example:

-websocket-acceptance-tester-py:
-  command: ["sh", "-c", "cd packages/templates/clients/websocket/python/test/temp/snapshotTestResult/client_hoppscotch && pip install -r requirements.txt && cd ../../../../test/python && pip install -r requirements.txt && pytest"]
+websocket-acceptance-tester-py:
+  command: ["sh", "-c", "pip install -r packages/templates/clients/websocket/test/python/requirements.txt && pytest packages/templates/clients/websocket/test/python"]

This reduces path complexity and ensures the correct test suite is executed.

🧹 Nitpick comments (1)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

109-119: Simplify and stabilize project root mounting for npm-test
The deeply nested relative path (../../../../../../:/usr/src/app) is brittle and can break when directory structures change. Consider using a single-level mount or variable substitution. For example:

 npm-test:
   # ...
-  volumes:
-    - ../../../../../../:/usr/src/app
+  volumes:
+    - ./:/usr/src/app  # Mount project root (adjust if necessary)

This makes the configuration easier to maintain.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49d7fef and d1f871c.

📒 Files selected for processing (1)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (5 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

107-107: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 20
  • GitHub Check: Test generator as dependency with Node 18
🔇 Additional comments (3)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (3)

92-96: Approve rename of importer service for clarity
Renaming the importer service to microcks-cli-importer aligns the service name with its purpose and container_name, improving readability. The dedicated tests profile and clearer image reference are also positive refinements.


98-99: Verify volume mapping for fixtures directory
The volume - ../:/usr/src/app mounts the test directory into the container, but __fixtures__/asyncapi-hoppscotch-server.yml lives under microcks-setup/__fixtures__. Please confirm that /usr/src/app/__fixtures__ exists, or adjust the mount to:

    volumes:
      - ./:/usr/src/app

to directly mount the microcks-setup folder.


121-137: Approve addition and upgrade of websocket-acceptance-tester-js
Renaming tester-js to websocket-acceptance-tester-js, upgrading to node:20, and sequencing it after both app (healthy) and npm-test (success) strengthens the acceptance-testing workflow. The explicit npm install before running JS tests is a best practice.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (2)

206-207: Validate Python test paths.
The command navigates into python/test/temp/... then back to test/python, which may not match the actual layout. Please confirm and simplify to avoid brittle paths.


144-147: ⚠️ Potential issue

Remove hard-coded Keycloak secret.
Embedding --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54 exposes credentials in source control. Move this to an environment variable or a Podman secret (environment: KEYCLOAK_CLIENT_SECRET).
Suggested diff:

-      --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54
+      --keycloakClientSecret=$KEYCLOAK_CLIENT_SECRET
🧰 Tools
🪛 Gitleaks (8.21.2)

147-147: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🧹 Nitpick comments (3)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (3)

107-116: Add timeout to readiness loop.
The async-minion entrypoint currently waits indefinitely for the Microcks API. To avoid endless hangs, introduce a retry counter or timeout.
Suggested diff:

           until curl -sf http://microcks:8080/api/health; do
             echo "  microcks not up yet, retrying..."
-            sleep 5
+            sleep 5
+            ((attempts++))
+            if [ "$attempts" -gt 60 ]; then
+              echo "Timeout waiting for Microcks, exiting."
+              exit 1
+            fi
           done

157-158: Scope down the volume mount.
Mounting the entire repository can slow CI and expose unrelated files. Consider mounting only the WebSocket test directory:

-      - ../../../../../../:/usr/src/app
+      - ../../../:/usr/src/app

224-224: Add newline at end of file.
YAML linter expects a trailing newline.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 224-224: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1f871c and c22eb2c.

📒 Files selected for processing (1)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (6 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

147-147: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 YAMLlint (1.35.1)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

[error] 224-224: no new line character at the end of file

(new-line-at-end-of-file)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 18
  • GitHub Check: Test generator as dependency with Node 20
🔇 Additional comments (4)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (4)

1-3: Volumes configuration looks solid.
Defining microcks-data ensures MongoDB persistence is isolated from the host filesystem.


4-7: Network declaration is correct.
Setting up microcks-net with the bridge driver cleanly isolates the Microcks test environment.


14-18: Consistent service network attachments.
All services are now attached to microcks-net with appropriate aliases, ensuring reliable intra-service DNS resolution.

Also applies to: 28-32, 66-71, 99-103, 134-138, 153-157, 170-173, 192-195


184-185: JavaScript tester command is up-to-date.
Running npm install followed by cd packages/templates/clients/websocket/test/javascript && npm test aligns with the new structure.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (2)

162-162: Remove hard-coded Keycloak client secret
A static secret (ab54d329-e435-41ae-a900-ec6b3fe15c54) is committed in the entrypoint. Please move this value to an environment variable or Podman secret to avoid exposing sensitive credentials.

🧰 Tools
🪛 Gitleaks (8.21.2)

162-162: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


267-268: Verify and correct Python test paths in tester-py
The script navigates to packages/templates/clients/websocket/python/test/temp/snapshotTestResult/client_hoppscotch then back to test/python; these paths look brittle and may not align with the repository layout. Please confirm the actual locations of your test suites and adjust the cd commands.

🧹 Nitpick comments (8)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (8)

117-121: Add timeout to health-check loop in async-minion
The loop will retry indefinitely if Microcks never becomes healthy, potentially hanging CI pipelines. Introduce a max retry count or timeout to fail fast.

Example snippet:

           until curl -sf http://microcks:8080/api/health; do
             echo "  microcks not up yet, retrying..."
-            sleep 5
+            sleep 5
+            attempts=$((attempts+1))
+            if [ "$attempts" -gt 60 ]; then
+              echo "Timeout waiting for Microcks, exiting."
+              exit 1
+            fi
           done

140-140: Pin microcks-cli-importer image to a specific version
Using microcks-cli:latest can introduce unpredictability if the upstream image changes. It’s safer to reference a fixed tag matching the Microcks server version (e.g., quay.io/microcks/microcks-cli:1.11.2).


182-183: Avoid deep relative volume mapping for npm-test
The host path uses six levels of .. to reach the repo root, which is brittle and error-prone. Consider using ${PWD} or the context field in a build section to simplify this.


188-191: Add timeout to wait for CLI importer completion in npm-test
The loop polling /signals/cli.done has no fail-safe. Introduce a retry limit or timeout to prevent infinite waiting if the importer never signals completion.


218-219: Simplify host volume mount for JS tester
Similar to npm-test, the JS tester uses deep relative paths (../../../../../../). This can break if directory structure changes. Use an environment variable or an explicit context to reference the project root.


224-231: Introduce timeout in JS acceptance tester wait loops
Both the file-signal and health-check loops in websocket-acceptance-tester-js lack a retry cap. Add a max attempt count to each loop to ensure the container exits if dependencies never become ready.


253-254: Simplify host volume mount for Python tester
The Python tester also uses a multi-level relative path (../../../../../../). As above, consider using ${PWD} or a defined context to map the codebase more reliably.


259-266: Add retry limit for Python tester wait loops
The loops that wait for /signals/npm.done and the Microcks health endpoint have no timeout, risking infinite hang. Add a retry counter or timeout for both loops.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a985a88 and 54cb375.

📒 Files selected for processing (1)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (4 hunks)
🧰 Additional context used
🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

162-162: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 20
  • GitHub Check: Test generator as dependency with Node 18
🔇 Additional comments (2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (2)

1-1: Verify Compose file version compatibility with Podman Compose
Compose file uses version 3.9, which supports depends_on.condition only in Docker Swarm mode. Podman Compose may not honor health-based startup ordering. Please confirm that your execution environment recognizes version: '3.9' and depends_on.condition directives; otherwise, tests could start prematurely.


65-68: Check support for depends_on.condition: service_healthy
You rely heavily on depends_on.condition: service_healthy to order container startup, but Compose v3.x (and Podman Compose) often ignore condition fields. If unsupported, containers may start before their dependencies are ready, causing race conditions. Consider consolidating service waits into entrypoint scripts or using external orchestration.

Also applies to: 100-102, 137-139, 172-174, 203-207, 238-243

@Adi-204

Adi-204 commented May 13, 2025

Copy link
Copy Markdown
Member

@derberg in test logs I can clearly see python passed test confirmation below -

image

But I couldn't found something similar for js? Can you please explain, maybe I am missing something.

@derberg

derberg commented May 14, 2025

Copy link
Copy Markdown
Member Author

@Adi-204 good 👁️ thanks!

the issue is because of --abort-on-container-exit, so one test completes, container exits, so the whole compose exits.

I'm exploring how to solve it, so far thinking on completely separating compose files into 2, one responsible only for the infra setup, and the other only for testing, with different testing profiles that can be triggered separately

@Adi-204

Adi-204 commented May 14, 2025

Copy link
Copy Markdown
Member

I'm exploring how to solve it, so far thinking on completely separating compose files into 2, one responsible only for the infra setup, and the other only for testing, with different testing profiles that can be triggered separately

Yeah the approach sounds great! In this PR you also solved the issue - #1507 😄 so maybe update description so you remember to close that issue also when the PR is merged. Oh wait but actually in PR - #1476 we have js part solved and in this python part is solved so maybe we have to wait 😅

@derberg

derberg commented May 14, 2025

Copy link
Copy Markdown
Member Author

yeah, actually #1476 can wait, so it doesn't have to solve #1507. It actually do not have to wait - I guess 🤔 if I take over #1507 (which is no other option, as I need functional tests for this PR) then we can merge 1476?

@Adi-204

Adi-204 commented May 14, 2025

Copy link
Copy Markdown
Member

@derberg yes you can take over issue - #1507 but I don't think we can merge PR - #1476 because generated file structure is wrong (it is not inside a folder) and small change in README.
Or maybe you can merge and just do a bit of copy & paste 😉 from other integration test for js. Or I can also correct the structure after merge #1476 we just need to confirm we @Light13008 is he working or not on the PR.
Go ahead with what you feel is right 👍.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
packages/templates/clients/websocket/test/README.md (1)

49-53: ⚠️ Potential issue

Remove hardcoded Keycloak client secret
Embedding the Keycloak client secret in documentation exposes sensitive credentials. Replace with a placeholder or environment variable and document how users should supply their own.

-    --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54"
+    --keycloakClientSecret="$MICROCKS_CLIENT_SECRET"
🧰 Tools
🪛 Gitleaks (8.21.2)

52-52: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

♻️ Duplicate comments (2)
packages/templates/clients/websocket/test/README.md (1)

65-71: ⚠️ Potential issue

Remove hardcoded Keycloak secret in test command
The acceptance test invocation includes a hardcoded Keycloak client secret, which should be externalized to prevent credential exposure.

-    --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54" \
+    --keycloakClientSecret="$MICROCKS_CLIENT_SECRET" \
🧰 Tools
🪛 Gitleaks (8.21.2)

70-70: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

138-138: ⚠️ Potential issue

Remove hardcoded Keycloak client secret in importer
Embedding the Keycloak secret in the importer command exposes credentials. Use an environment variable or Podman secret to inject it securely.

-      --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54 && sleep infinity
+      --keycloakClientSecret="$MICROCKS_CLIENT_SECRET" && sleep infinity
🧰 Tools
🪛 Gitleaks (8.21.2)

138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🧹 Nitpick comments (3)
packages/templates/clients/websocket/test/README.md (1)

43-44: Fix typo in installation instruction
The note reads “Instal AsyncAPI CLI” but should be “Install AsyncAPI CLI.”

.github/workflows/pr-testing-with-test-project.yml (1)

108-108: Add newline at end of file
A missing newline at EOF triggers YAML lint errors; adding it will resolve the lint warning.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 108-108: no new line character at the end of file

(new-line-at-end-of-file)

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

167-167: Trim trailing spaces
Remove the trailing spaces on this line to satisfy YAML linting.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 167-167: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da98f35 and 3424258.

📒 Files selected for processing (4)
  • .github/workflows/pr-testing-with-test-project.yml (3 hunks)
  • .gitignore (1 hunks)
  • packages/templates/clients/websocket/test/README.md (4 hunks)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (6 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .gitignore
🧰 Additional context used
🧠 Learnings (1)
.github/workflows/pr-testing-with-test-project.yml (2)
Learnt from: derberg
PR: asyncapi/generator#1552
File: .github/workflows/pr-testing-with-test-project.yml:51-69
Timestamp: 2025-05-09T08:24:17.362Z
Learning: In GitHub Actions workflows, don't use job-level `if` conditions for jobs that might be required in branch protection rules. When a job is skipped via job-level conditions, it doesn't appear in the GitHub checks list at all, and if that job is set as required, PRs would be blocked indefinitely. Instead, use step-level conditionals within the job to skip the substantive work while still allowing the job to complete successfully.
Learnt from: derberg
PR: asyncapi/generator#1552
File: .github/workflows/pr-testing-with-test-project.yml:70-84
Timestamp: 2025-05-09T08:25:03.441Z
Learning: When suggesting workflow optimizations in GitHub Actions, be cautious with job-level conditional statements (`if` at the job level). If a job with a job-level conditional is set as a required check in branch protection settings, PRs that don't trigger the job (condition evaluates to false) can never be merged since GitHub would be waiting for a required check that never runs. Using step-level conditionals is often better as the job still completes successfully, satisfying branch protection requirements.
🪛 YAMLlint (1.35.1)
.github/workflows/pr-testing-with-test-project.yml

[error] 108-108: no new line character at the end of file

(new-line-at-end-of-file)

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

[error] 85-85: trailing spaces

(trailing-spaces)


[error] 167-167: trailing spaces

(trailing-spaces)

🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

packages/templates/clients/websocket/test/README.md

70-70: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test generator as dependency with Node 20
  • GitHub Check: Test generator as dependency with Node 18
  • GitHub Check: Acceptance tests for generated templates
🔇 Additional comments (13)
packages/templates/clients/websocket/test/README.md (1)

13-13: Approve updated test command working-directory approach
Changing into microcks-setup before running podman compose aligns with the compose file’s location and simplifies the invocation.

.github/workflows/pr-testing-with-test-project.yml (4)

12-12: Approve output wiring for should_test
Leveraging steps.should_run.outputs.shouldrun directly ensures the should_test flag accurately reflects the latest path-filter result.


34-35: Approve refined conditional for triggering tests
The composite check for modified files, draft status, and bot-generated PR titles comprehensively gates the test trigger.


51-69: Approve new integration test job with step-level gating
Isolating integration tests into its own job and gating only the Run test step (rather than the entire job) correctly satisfies branch protection and avoids unnecessary CI execution.


70-84: Approve acceptance test job setup
The acceptance job appropriately uses step-level if checks, sets up Node.js 20, installs dependencies, bundles specs, and runs generation steps—compliant with branch protection and CI best practices.

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (8)

5-10: Approve infrastructure profiles for mongo
Adding the infra and ci profiles to the mongo service scopes it correctly to both local and CI setups.


21-23: Approve infrastructure profiles for kafka
Scoping the kafka service to infra and ci profiles aligns with the other core services.


53-57: Approve profiles on app service
Assigning infra and ci profiles to the Microcks app service ensures it starts only when needed.


85-87: Approve profiles on async-minion
The async-minion service now correctly uses health-based startup under infra and ci profiles.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 85-85: trailing spaces

(trailing-spaces)


108-112: Approve new asyncapi-bundler service
Introducing an asyncapi-bundler service under tests and infra profiles cleanly handles spec bundling for both CI and local runs.


124-126: Approve updated importer profiles
Including tests alongside infra and ci ensures the importer runs in all relevant contexts.


141-145: Approve new npm-test service
Running package tests in a dedicated Node.js 20 service under tests and infra profiles is well scoped.


158-159: Approve profiling for tester-js
Assigning tester-js to tests and test-js profiles with Node.js 22 is appropriate for JavaScript acceptance testing.

Comment thread packages/templates/clients/websocket/test/README.md Outdated
@derberg

derberg commented May 14, 2025

Copy link
Copy Markdown
Member Author

@Adi-204 PR updated, now we are 100% sure each test runs no matter what. Also updated readme

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (2)
packages/templates/clients/websocket/test/README.md (2)

57-61: ⚠️ Potential issue

Remove hard-coded Keycloak secret
Embedding --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54" exposes credentials in source control. Replace with an environment variable placeholder and document how to supply it at runtime:

-    --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54"
+    --keycloakClientSecret="$MICROCKS_CLIENT_SECRET"

Also add a note in the Prerequisites section describing how to set MICROCKS_CLIENT_SECRET.

🧰 Tools
🪛 Gitleaks (8.21.2)

60-60: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


100-101: ⚠️ Potential issue

Align websocat debug URL with updated service and operation
The example still points to the old Hoppscotch server and sendTimeStampMessage. Update it to the Postman Echo client and sendEchoMessage:

-websocat ws://localhost:8081/api/ws/Hoppscotch+WebSocket+Server/1.0.0/sendTimeStampMessage
+websocat ws://localhost:8081/api/ws/Postman+Echo+WebSocket+Client/1.0.0/sendEchoMessage
♻️ Duplicate comments (1)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)

136-136: ⚠️ Potential issue

Avoid embedding credentials in the compose file
The Keycloak client secret is hard-coded under the importer service. Move this value to an environment variable or a Podman secret:

-      --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54
+      --keycloakClientSecret=$MICROCKS_CLIENT_SECRET

Ensure you document how to provide MICROCKS_CLIENT_SECRET securely in CI and local environments.

🧰 Tools
🪛 Gitleaks (8.21.2)

136-136: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🧹 Nitpick comments (5)
.github/workflows/pr-testing-with-test-project.yml (2)

66-69: Remove temporary debug logging once stabilized
The Log should_test value across jobs step is helpful for debugging, but consider removing it in a follow-up cleanup to reduce noise in workflow logs once the flag behavior is confirmed.


108-108: Add newline at end of file
YAML files should end with a single newline character to satisfy POSIX standards and avoid linter warnings.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 108-108: no new line character at the end of file

(new-line-at-end-of-file)

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (3)

85-85: Remove trailing spaces
Line 85 contains trailing whitespace. Please remove to conform with YAML linting rules.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 85-85: trailing spaces

(trailing-spaces)


163-163: Remove trailing spaces
Line 163 contains trailing whitespace. Please remove to conform with YAML linting rules.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 163-163: trailing spaces

(trailing-spaces)


147-148: Simplify volume mapping for npm-test service
The current relative path (../../../../../../:/usr/src/app) is brittle and hard to maintain. Consider using a bind mount from the repo root or setting the working directory at startup:

-    volumes:
-      - ../../../../../../:/usr/src/app
+    volumes:
+      - ../..:/usr/src/app  # adjust path to repo root relative to microcks-setup
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3424258 and 9c9b045.

📒 Files selected for processing (3)
  • .github/workflows/pr-testing-with-test-project.yml (3 hunks)
  • packages/templates/clients/websocket/test/README.md (4 hunks)
  • packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
.github/workflows/pr-testing-with-test-project.yml (2)
Learnt from: derberg
PR: asyncapi/generator#1552
File: .github/workflows/pr-testing-with-test-project.yml:51-69
Timestamp: 2025-05-09T08:24:17.362Z
Learning: In GitHub Actions workflows, don't use job-level `if` conditions for jobs that might be required in branch protection rules. When a job is skipped via job-level conditions, it doesn't appear in the GitHub checks list at all, and if that job is set as required, PRs would be blocked indefinitely. Instead, use step-level conditionals within the job to skip the substantive work while still allowing the job to complete successfully.
Learnt from: derberg
PR: asyncapi/generator#1552
File: .github/workflows/pr-testing-with-test-project.yml:70-84
Timestamp: 2025-05-09T08:25:03.441Z
Learning: When suggesting workflow optimizations in GitHub Actions, be cautious with job-level conditional statements (`if` at the job level). If a job with a job-level conditional is set as a required check in branch protection settings, PRs that don't trigger the job (condition evaluates to false) can never be merged since GitHub would be waiting for a required check that never runs. Using step-level conditionals is often better as the job still completes successfully, satisfying branch protection requirements.
🪛 YAMLlint (1.35.1)
.github/workflows/pr-testing-with-test-project.yml

[error] 108-108: no new line character at the end of file

(new-line-at-end-of-file)

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

[error] 85-85: trailing spaces

(trailing-spaces)


[error] 163-163: trailing spaces

(trailing-spaces)

🪛 LanguageTool
packages/templates/clients/websocket/test/README.md

[uncategorized] ~19-~19: A comma might be missing here.
Context: ...ra` to run whole setup with tests. This way you ensure that proper importer contain...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~21-~21: You might be missing the article “a” here.
Context: ...tests run against it. 1. Run tests for given client, for example `podman compose -f ...

(AI_EN_LECTOR_MISSING_DETERMINER_A)

🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/README.md

78-78: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml

136-136: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test generator as dependency with Node 18
  • GitHub Check: Test generator as dependency with Node 20
🔇 Additional comments (1)
.github/workflows/pr-testing-with-test-project.yml (1)

93-97: Inconsistent spec path in AsyncAPI bundling step
The workflow bundles asyncapi-hoppscotch-server.yml, but the README and compose setup now reference the Postman Echo spec or the bundled output. Please confirm the intended source and update accordingly:

-      custom_command: bundle packages/templates/clients/websocket/test/__fixtures__/asyncapi-hoppscotch-server.yml --output packages/templates/clients/websocket/test/__fixtures__/bundled.yml
+      custom_command: bundle packages/templates/clients/websocket/test/__fixtures__/asyncapi-postman-echo.yml --output packages/templates/clients/websocket/test/__fixtures__/bundled.yml

Comment thread packages/templates/clients/websocket/test/README.md Outdated
@Adi-204

Adi-204 commented May 14, 2025

Copy link
Copy Markdown
Member

@Adi-204 PR updated, now we are 100% sure each test runs no matter what. Also updated readme

looks perfect 👍!

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@derberg

derberg commented May 14, 2025

Copy link
Copy Markdown
Member Author

@Adi-204 thanks

btw, some coderabbit comments, expecially about docs, damn, pretty good

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/templates/clients/websocket/test/README.md (2)

57-61: Avoid hardcoding secrets in documentation.

Hardcoding --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54" exposes sensitive information. Replace with an environment variable placeholder and instruct users to set it:

- --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54"
+ --keycloakClientSecret="${MICROCKS_CLIENT_SECRET}"

Add a note to export the secret before running:

export MICROCKS_CLIENT_SECRET=your_client_secret_here
🧰 Tools
🪛 Gitleaks (8.21.2)

60-60: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


73-79: Parameterize Keycloak secret in the test invocation.

Similarly, avoid embedding the Keycloak secret in the microcks-cli test command. Use the environment variable placeholder:

- --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54" \
+ --keycloakClientSecret="${MICROCKS_CLIENT_SECRET}" \

Ensure users export MICROCKS_CLIENT_SECRET as shown earlier.

🧰 Tools
🪛 Gitleaks (8.21.2)

78-78: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🧹 Nitpick comments (3)
packages/templates/clients/websocket/test/README.md (3)

13-21: Refine step numbering and grammar in test instructions.

Replace repeated "1." list markers with sequential numbering for clarity. Also add the article "a" in "Run tests for a given client" and insert a comma after "This way". For example:

- 1. Go to microcks directory: `cd microcks-setup`
- 1. Setup infra based on Microcks and proper AsyncAPI documents: `podman compose -f microcks-podman.yml --profile infra up -d`
- 1. Run tests for given client, for example `podman compose -f microcks-podman.yml --profile test-js up --abort-on-container-exit` to run JS client tests. Use `test-py` profile for Python client tests.
+ 1. Go to the `microcks-setup` directory:
+    ```bash
+    cd microcks-setup
+    ```
+ 2. Set up infrastructure:
+    ```bash
+    podman compose -f microcks-podman.yml --profile infra up -d
+    ```
+ 3. Run tests for a given client:
+    ```bash
+    podman compose -f microcks-podman.yml --profile test-js up --abort-on-container-exit
+    ```

> You need to remember about `--profile infra` to run the whole setup with tests. This way, you ensure that the `asyncapi-bundler` service produces `__fixtures__/bundled.yml`, which the importer container will import into Microcks.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~19-~19: Possible missing comma found.
Context: ...rato run whole setup with tests. This way you ensure that theasyncapi-bundler` ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~21-~21: You might be missing the article “a” here.
Context: ...import into Microcks. 1. Run tests for given client, for example `podman compose -f ...

(AI_EN_LECTOR_MISSING_DETERMINER_A)


39-41: Avoid duplicating instructions under separate sections.

The steps to cd microcks-setup and set up infra are repeated here (lines 39–41) after the earlier "To run tests" section (lines 15–17). Consolidate these into a single "Start Microcks" section or reference the initial instructions to reduce duplication and maintenance overhead.


51-51: Fix typographical error and improve clarity.

The word "Instal" is missing an "l". Consider rephrasing for consistency:

- Instal AsyncAPI CLI and use `bundle` command.
+ Install the AsyncAPI CLI and run the `bundle` command to produce a bundled AsyncAPI spec.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c9b045 and 48381f4.

📒 Files selected for processing (1)
  • packages/templates/clients/websocket/test/README.md (4 hunks)
🧰 Additional context used
🪛 LanguageTool
packages/templates/clients/websocket/test/README.md

[uncategorized] ~19-~19: Possible missing comma found.
Context: ...rato run whole setup with tests. This way you ensure that theasyncapi-bundler` ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~21-~21: You might be missing the article “a” here.
Context: ...import into Microcks. 1. Run tests for given client, for example `podman compose -f ...

(AI_EN_LECTOR_MISSING_DETERMINER_A)

🪛 Gitleaks (8.21.2)
packages/templates/clients/websocket/test/README.md

78-78: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test generator as dependency with Node 20
  • GitHub Check: Test generator as dependency with Node 18
  • GitHub Check: Acceptance tests for generated templates
  • GitHub Check: Test NodeJS PR - windows-latest

@sonarqubecloud

Copy link
Copy Markdown

@derberg

derberg commented May 17, 2025

Copy link
Copy Markdown
Member Author

/rtm

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automate running acceptance tests

5 participants