test(3scale): add module wiring, contract tests, and contributor guide#9461
test(3scale): add module wiring, contract tests, and contributor guide#9461PatAKnight wants to merge 2 commits into
Conversation
Changed Packages
|
There was a problem hiding this comment.
Pull request overview
This PR increases integration-focused test coverage for the @backstage-community/plugin-3scale-backend workspace, covering module wiring, config/scheduler contracts, OpenAPI conversion behavior, and the 3scale Admin API client (mocked). It also adds contributor documentation for local development via the plugin dev/ harness.
Changes:
- Expanded/added backend contract tests for provider wiring, config parsing, and OpenAPI merge/convert behavior.
- Added tests for the 3scale Admin API connector (fetch + URL construction + error handling).
- Added a plugin-level contributor guide and linked it from the README.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| workspaces/3scale/plugins/3scale-backend/src/providers/ThreeScaleApiEntityProvider.test.ts | Refactors provider tests to mock fetch per-endpoint and adds fromConfig/endpoint assertions. |
| workspaces/3scale/plugins/3scale-backend/src/providers/open-api-merger-converter.test.ts | Adds unit tests for spec format detection and Swagger 1.2 conversion. |
| workspaces/3scale/plugins/3scale-backend/src/providers/config.test.ts | Adds tests for config parsing and schedule parsing. |
| workspaces/3scale/plugins/3scale-backend/src/module.test.ts | Adds module wiring tests for provider registration and scheduling behavior. |
| workspaces/3scale/plugins/3scale-backend/src/clients/ThreeScaleAPIConnector.test.ts | Adds tests for connector URL construction and error handling. |
| workspaces/3scale/plugins/3scale-backend/README.md | Links to the new contributor guide. |
| workspaces/3scale/plugins/3scale-backend/CONTRIBUTING.md | Adds contributor workflow documentation (dev harness, validation, smoke checklist). |
| workspaces/3scale/.changeset/pink-parrots-rush.md | Adds a patch changeset entry for the added wiring/tests/docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(usedSchedules).toHaveLength(2); | ||
| expect(usedSchedules[0].frequency).toEqual({ minutes: 30 }); | ||
| expect(usedSchedules[0].timeout).toEqual({ minutes: 3 }); | ||
| expect(usedSchedules[1].frequency).toEqual({ months: 1 }); | ||
| expect(usedSchedules[1].timeout).toEqual({ minutes: 5 }); | ||
| expect(runner).not.toHaveBeenCalled(); |
There was a problem hiding this comment.
Deferred for right now. Today module.ts always creates the default scheduled task runner, even when every provider already has a per-provider schedule in config. In that case the default runner is never used, so we pay for an extra createScheduledTaskRunner call at init. Fix would be to create the default runner only when at least one provider doesn't define its own schedule.
Assisted-by: Cursor AI Signed-off-by: Patrick Knight <pknight@redhat.com>
Assisted-by: Cursor AI Signed-off-by: Patrick Knight <pknight@redhat.com>
bfcf879 to
f9fd431
Compare
Hey, I just made a Pull Request!
This PR aims to increase the test coverage for
@backstage-community/plugin-3scale-backend, with a focus on Backstage integration. Mainly module wiring, config/scheduler contracts, and the Admin API client (mocked in tests).It also adds a contributor guide with steps for running the plugin
dev/harness, running the usual package/workspace validation commands, and a short manual smoke checklist.Removing the full workspace Backstage app (
packages/app/packages/backend) can be a follow-up once this workflow is settled.✔️ Checklist
Signed-off-byline in the message. (more info)