Skip to content

test(3scale): add module wiring, contract tests, and contributor guide#9461

Open
PatAKnight wants to merge 2 commits into
backstage:mainfrom
PatAKnight:expand-testing-3scale
Open

test(3scale): add module wiring, contract tests, and contributor guide#9461
PatAKnight wants to merge 2 commits into
backstage:mainfrom
PatAKnight:expand-testing-3scale

Conversation

@PatAKnight

Copy link
Copy Markdown
Contributor

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

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Copilot AI review requested due to automatic review settings June 12, 2026 12:50
@backstage-goalie

Copy link
Copy Markdown
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-3scale-backend workspaces/3scale/plugins/3scale-backend patch v3.13.0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread workspaces/3scale/plugins/3scale-backend/src/module.test.ts
Comment on lines +140 to +145
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();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread workspaces/3scale/plugins/3scale-backend/CONTRIBUTING.md
Assisted-by: Cursor AI
Signed-off-by: Patrick Knight <pknight@redhat.com>
Assisted-by: Cursor AI
Signed-off-by: Patrick Knight <pknight@redhat.com>
@PatAKnight PatAKnight force-pushed the expand-testing-3scale branch from bfcf879 to f9fd431 Compare June 12, 2026 17:21
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.

3 participants