Skip to content

Commit

Permalink
Issue 6892: workerManager.registerWorker: treat test-provisioner-id s…
Browse files Browse the repository at this point in the history
…pecially
  • Loading branch information
petemoore committed Mar 8, 2024
1 parent 65542dc commit 0212214
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions changelog/issue-6892.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
audience: developers
level: minor
reference: issue 6892
---
Worker Manager now special-cases `registerWorker` API calls with provisionerId
`test-provisioner-id`. It responds as if the call was successful with fake
`credentials`, `expiry`, and `secret`, but the real `workerConfig`, if it
exists.
4 changes: 3 additions & 1 deletion services/worker-manager/schemas/v1/worker-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ properties:
workerGroup:
title: Worker group
type: string
description: Worker group to which this worker belongs
description: |
Worker group to which this worker belongs. The special value
`test-worker-group` is reserved for use by tests.
minLength: {$const: identifier-min-length}
maxLength: {$const: identifier-max-length}
pattern: {$const: identifier-pattern}
Expand Down
13 changes: 13 additions & 0 deletions services/worker-manager/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,19 @@ builder.declare({
`Worker pool ${workerPoolId} not associated with provider ${providerId}`, {});
}

if (workerPoolId.startsWith("test-provisioner-id/")) {
return res.reply({
expires: "2000-00-00T00:00:00Z",
credentials: {
accessToken: "test-access-token",
certificate: "test-certificate",
clientId: "test-client-id",
},
workerConfig,
secret: "test-secret",
});
}

const worker = await Worker.get(this.db, { workerPoolId, workerGroup, workerId });
if (!worker) {
this.monitor.debug({
Expand Down

0 comments on commit 0212214

Please sign in to comment.