test: add automation for microcks-based acceptance tests#1552
Conversation
|
WalkthroughThe 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
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
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (5)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (4)
110-117: Refactor the volume mount fornpm-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/appor using an environment variable (
${PWD}:/usr/src/app).
122-122: Pin a more specific Node.js image tag.
Usingnode:20will 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 chainedcdandpip installcalls 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 mapsteps.should_run.outputs.shouldrunintoshould_test. Consider renaming the step’s output key toshould_testfor symmetry and to reduce confusion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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: Verifypackages:testfilter 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 usepackages/**or omit the./prefix for full coverage.packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)
132-133: Verify Compose spec support fordepends_on.condition.
You’re relying oncondition: 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.
Theifstep now directly referencessteps.filter.outputs.modified_files. This change looks good and preserves the intended gating logic.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (1)
122-127: Upgradetester-jsto Node 20 and chain dependencies
Bumping the image tonode:20matchesnpm-test. The newdepends_onensures JS acceptance tests wait for package tests to complete. As a nitpick, consider usingnpm ciinstead ofnpm installfor reproducible, lockfile-driven installs.Also applies to: 132-135
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 newpackages:testscript enables running tests across all packages under./packages/*. Please verify thatturbo run test --filter=./packages/* --onlycorrectly 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: Addnpm-testservice to orchestrate JS package tests
Introducing a dedicatednpm-testservice 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, andrestart: "no"is appropriate to prevent unwanted retries..github/workflows/pr-testing-with-test-project.yml (3)
12-12: Propagate decision fromshould_runstep
Mappingchanges.outputs.should_testtosteps.should_run.outputs.shouldruncentralizes the logic determining if downstream jobs execute, ensuring bothtestandacceptancejobs only run on relevant changes.
34-38: Refineshould_runconditional to filter PRs
The updatedifclause 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: Introducetestjob for Node integration tests
Splitting out thetestjob with a Node 18/20 matrix gives faster feedback on generator integration. PassingNODE_VERSIONinto Docker Compose lets the compose files dynamically pick the correct Node image.
There was a problem hiding this comment.
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 forasyncapi-bot,asyncapi-bot-eve, andallcontributors[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 dedicatedtestjob and gating only thedocker compose upstep onneeds.changes.outputs.should_testis 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 valuestep to clean up your checks output.
70-84: Approve acceptance test job structure
The newacceptancejob 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
📒 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 theshould_runstep makes the workflow cleaner and avoids duplicating conditions. The explicitsteps.filter.outputs.modified_files == 'true'check combined with draft and specific-bot filters is comprehensive.
There was a problem hiding this comment.
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 intester-py
Thecd packages/templates/clients/websocket/python/test/...sequence still referencespython/testrather than the intendedtest/pythondirectory. 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 custommicrocks_defaultbridge 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=…"
- command:
- microcks-cli
- import
- "fixtures/asyncapi-hoppscotch-server.yml"
- "--keycloakClientId=microcks-serviceaccount"
- "--keycloakClientSecret=${KEYCLOAK_CLIENT_SECRET}"
+```
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 themongocontainer tomicrocks_defaultenables it to resolve and communicate with other services by name.
52-53: Attach Kafka service to the default network
Ensureskafkacan participate in the same network for service discovery and messaging.
82-85: Define network alias forappservice
Using the aliasmicrockson 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 theappservice via themicrocks_defaultnetwork.
127-136: Introducenpm-testservice for package-level tests
Thenpm-testcontainer 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: Upgradetester-jsimage to Node 20
Aligns the JS tester with thenpm-testenvironment and ensures compatibility with modern syntax.
151-152: Ensuretester-jswaits fornpm-testto finish
Addingdepends_on: npm-test: condition: service_completed_successfullyguarantees package tests pass before running acceptance tests.
154-156: Disable restart and attachtester-jsto the default network
restart: "no"is appropriate for one-off test containers; joiningmicrocks_defaultenables service name resolution.
174-176: Disable restart and attachtester-pyto the default network
Consistent with other testers, usingrestart: "no"and joiningmicrocks_defaultis 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" |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 intester-py
Thecdcommands reference deep paths underpackages/templates/clients/websocket/python/testthen switch to../../../../test/python. Ensure these directories match the actual layout (likely underpackages/templates/clients/websocket/test/python).
135-138:⚠️ Potential issueRemove hard-coded Keycloak client secret
Embedding--keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54exposes 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 fortester-js
Thetester-jsservice correctly depends on successfulnpm-testand healthyapp. Consider adding a dependency onimportercompleting 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
📒 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: Attachmongoservice to the default network
Good addition—ensures the MongoDB container is reachable by other services onmicrocks_default.
52-53: Attachkafkaservice to the default network
By adding Kafka tomicrocks_default, consumers and producers within the compose setup can resolve and communicate with the broker.
56-56: Configureappservice hostname and network alias
Settinghostname: microcksand assigning the alias onmicrocks_defaultmakes service discovery clearer and more predictable when other containers refer to the Microcks API.Also applies to: 83-87
120-121: Attachasync-minionto the default network
Ensures the async-minion can resolvemicrocksand any other services onmicrocks_default.
139-140: Attachimporterto the default network
This allows the CLI importer container to reach the Microcks API overmicrocks_default.
142-151: Introducenpm-testservice for orchestrated JS testing
Using a dedicatednpm-teststep isolates dependency installation and package-level tests before spinning up language-specific testers. This improves reliability and speeds up feedback loops.
There was a problem hiding this comment.
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-ec6b3fe15c54poses a security risk. Move this value to an environment variable or Podman secret and inject viaenvironment:or asecret: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 suggestionImprove
async-minionstartup 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./packagesor the specific test directories needed.
164-165: Reduce volume mapping scope in JS tester
Mounting the entire repo into/usr/src/appis 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
📒 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 themongoservice to themicrocks_defaultnetwork ensures it’s accessible by hostname. If you need custom aliases, consider specifying them here.
52-53: Attach Kafka to default network
Connectingkafkato the shared network is good. Ensure that your advertised addresses in thecommandalign with this network alias for inter-service communication.
56-56: Set consistent service hostname
Specifyinghostname: microcksmakes the service addressable asmicrocksinside the network. This complements the alias defined below.
82-85: Define network alias for app
The aliasmicrockson the default network is clear for internal references (e.g., forasync-minion). Ensure downstream consumers use this alias.
119-120: Linkasync-minionto default network
Ensuringasync-minionis on the samemicrocks_defaultnetwork is necessary for it to reachmicrocksby alias.
138-139: Attach importer to default network
Adding the importer service to the shared network ensures it can reach Microcks athttp://microcks:8080.
141-144: Introducenpm-testservice 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
Themem_limitkey 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 thedeploy.resources.limits.memorysyntax.
150-151: Validate npm command and no-restart policy
Runningnpm ci && npm run packages:testin one command streamlines the build, and disabling restarts avoids unintended loops on failure. Looks good.
152-153: Attachnpm-testto 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 tonode:20and a descriptivecontainer_namefortester-jsis clear and keeps environments up to date.
168-169: Ensure JS tester waits fornpm-testcompletion
Theservice_completed_successfullycondition onnpm-testis correct for orchestrating the test sequence.
170-171: Verify JS test command path
The command navigates topackages/templates/clients/websocket/test/javascriptbefore runningnpm test. Please confirm this path exists relative to/usr/src/appand 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 fornpm-testcompletion
Usingservice_completed_successfullyfornpm-testis correct to enforce test orchestration.
191-191: Disable restarts for Python tester
Settingrestart: "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"] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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-ec6b3fe15c54exposes 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 chainedcdintopython/test/temp/snapshotTestResult/...and backtracking intotest/pythonis 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 fornpm-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
📒 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 theimporterservice tomicrocks-cli-importeraligns the service name with its purpose and container_name, improving readability. The dedicatedtestsprofile and clearer image reference are also positive refinements.
98-99: Verify volume mapping for fixtures directory
The volume- ../:/usr/src/appmounts thetestdirectory into the container, but__fixtures__/asyncapi-hoppscotch-server.ymllives undermicrocks-setup/__fixtures__. Please confirm that/usr/src/app/__fixtures__exists, or adjust the mount to:volumes: - ./:/usr/src/appto directly mount the
microcks-setupfolder.
121-137: Approve addition and upgrade ofwebsocket-acceptance-tester-js
Renamingtester-jstowebsocket-acceptance-tester-js, upgrading tonode:20, and sequencing it after bothapp(healthy) andnpm-test(success) strengthens the acceptance-testing workflow. The explicitnpm installbefore running JS tests is a best practice.
There was a problem hiding this comment.
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 intopython/test/temp/...then back totest/python, which may not match the actual layout. Please confirm and simplify to avoid brittle paths.
144-147:⚠️ Potential issueRemove hard-coded Keycloak secret.
Embedding--keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54exposes 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.
Theasync-minionentrypoint 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
📒 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.
Definingmicrocks-dataensures MongoDB persistence is isolated from the host filesystem.
4-7: Network declaration is correct.
Setting upmicrocks-netwith the bridge driver cleanly isolates the Microcks test environment.
14-18: Consistent service network attachments.
All services are now attached tomicrocks-netwith 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.
Runningnpm installfollowed bycd packages/templates/clients/websocket/test/javascript && npm testaligns with the new structure.
There was a problem hiding this comment.
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 topackages/templates/clients/websocket/python/test/temp/snapshotTestResult/client_hoppscotchthen back totest/python; these paths look brittle and may not align with the repository layout. Please confirm the actual locations of your test suites and adjust thecdcommands.
🧹 Nitpick comments (8)
packages/templates/clients/websocket/test/microcks-setup/microcks-podman.yml (8)
117-121: Add timeout to health-check loop inasync-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: Pinmicrocks-cli-importerimage to a specific version
Usingmicrocks-cli:latestcan 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 fornpm-test
The host path uses six levels of..to reach the repo root, which is brittle and error-prone. Consider using${PWD}or thecontextfield in a build section to simplify this.
188-191: Add timeout to wait for CLI importer completion innpm-test
The loop polling/signals/cli.donehas 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 tonpm-test, the JS tester uses deep relative paths (../../../../../../). This can break if directory structure changes. Use an environment variable or an explicitcontextto reference the project root.
224-231: Introduce timeout in JS acceptance tester wait loops
Both the file-signal and health-check loops inwebsocket-acceptance-tester-jslack 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 definedcontextto map the codebase more reliably.
259-266: Add retry limit for Python tester wait loops
The loops that wait for/signals/npm.doneand 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
📒 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 version3.9, which supportsdepends_on.conditiononly in Docker Swarm mode. Podman Compose may not honor health-based startup ordering. Please confirm that your execution environment recognizesversion: '3.9'anddepends_on.conditiondirectives; otherwise, tests could start prematurely.
65-68: Check support fordepends_on.condition: service_healthy
You rely heavily ondepends_on.condition: service_healthyto order container startup, but Compose v3.x (and Podman Compose) often ignoreconditionfields. 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
|
@derberg in test logs I can clearly see python passed test confirmation below - But I couldn't found something similar for js? Can you please explain, maybe I am missing something. |
|
@Adi-204 good 👁️ thanks! the issue is because of 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 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. |
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
packages/templates/clients/websocket/test/README.md (1)
49-53:⚠️ Potential issueRemove 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 issueRemove 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 issueRemove 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
📒 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 intomicrocks-setupbefore runningpodman composealigns with the compose file’s location and simplifies the invocation..github/workflows/pr-testing-with-test-project.yml (4)
12-12: Approve output wiring forshould_test
Leveragingsteps.should_run.outputs.shouldrundirectly ensures theshould_testflag 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 theRun teststep (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-levelifchecks, 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 formongo
Adding theinfraandciprofiles to themongoservice scopes it correctly to both local and CI setups.
21-23: Approve infrastructure profiles forkafka
Scoping thekafkaservice toinfraandciprofiles aligns with the other core services.
53-57: Approve profiles onappservice
Assigninginfraandciprofiles to the Microcksappservice ensures it starts only when needed.
85-87: Approve profiles onasync-minion
Theasync-minionservice now correctly uses health-based startup underinfraandciprofiles.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 85-85: trailing spaces
(trailing-spaces)
108-112: Approve newasyncapi-bundlerservice
Introducing anasyncapi-bundlerservice undertestsandinfraprofiles cleanly handles spec bundling for both CI and local runs.
124-126: Approve updatedimporterprofiles
Includingtestsalongsideinfraandciensures the importer runs in all relevant contexts.
141-145: Approve newnpm-testservice
Running package tests in a dedicated Node.js 20 service undertestsandinfraprofiles is well scoped.
158-159: Approve profiling fortester-js
Assigningtester-jstotestsandtest-jsprofiles with Node.js 22 is appropriate for JavaScript acceptance testing.
|
@Adi-204 PR updated, now we are 100% sure each test runs no matter what. Also updated readme |
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (2)
packages/templates/clients/websocket/test/README.md (2)
57-61:⚠️ Potential issueRemove 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 issueAlign
websocatdebug URL with updated service and operation
The example still points to the old Hoppscotch server andsendTimeStampMessage. Update it to the Postman Echo client andsendEchoMessage:-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 issueAvoid embedding credentials in the compose file
The Keycloak client secret is hard-coded under theimporterservice. Move this value to an environment variable or a Podman secret:- --keycloakClientSecret=ab54d329-e435-41ae-a900-ec6b3fe15c54 + --keycloakClientSecret=$MICROCKS_CLIENT_SECRETEnsure you document how to provide
MICROCKS_CLIENT_SECRETsecurely 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
TheLog should_test value across jobsstep 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 fornpm-testservice
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
📒 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 bundlesasyncapi-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
looks perfect 👍! |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
@Adi-204 thanks btw, some coderabbit comments, expecially about docs, damn, pretty good |
There was a problem hiding this comment.
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 testcommand. Use the environment variable placeholder:- --keycloakClientSecret="ab54d329-e435-41ae-a900-ec6b3fe15c54" \ + --keycloakClientSecret="${MICROCKS_CLIENT_SECRET}" \Ensure users export
MICROCKS_CLIENT_SECRETas 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-setupand 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
📒 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
|
|
/rtm |




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
Bug Fixes
Documentation
Chores