|
3 | 3 | // The connector metadata doors, booted on the showcase with its own connector |
4 | 4 | // plugins — keys a connector does not declare are never served: |
5 | 5 | // |
6 | | -// - READ: a stored row carrying top-level keys the connector does not declare |
7 | | -// (seeded through the system context, the only way such a row is written |
8 | | -// now), an instance whose `retryConfig` and a descriptor whose `actions` |
9 | | -// element carry an undeclared key (both accepted by the save door), are |
| 6 | +// - READ: a stored row carrying top-level keys the connector does not declare, |
| 7 | +// an instance whose `retryConfig` and a descriptor whose `actions` element |
| 8 | +// carry an undeclared key (each seeded through the system context, the only |
| 9 | +// way such a row is written now: the save door refuses all three), are |
10 | 10 | // served with those keys withheld and every declared key as stored — to a |
11 | 11 | // member and to an administrator, in the item, layered, published and list |
12 | 12 | // reads, and on the published read of a package published twice (whose |
@@ -154,12 +154,21 @@ describe('connector metadata doors: keys a connector does not declare are withhe |
154 | 154 | }), |
155 | 155 | }, { context: SYSTEM }); |
156 | 156 |
|
157 | | - const retry = await stack.apiAs(admin, 'PUT', `/meta/connector/${RETRY}`, instance(RETRY, { |
158 | | - retryConfig: { strategy: 'exponential_backoff', maxAttempts: 2, secret: PLACEHOLDERS.retry }, |
159 | | - })); |
160 | | - expect(retry.status, await retry.clone().text()).toBe(200); |
161 | | - const desc = await stack.apiAs(admin, 'PUT', `/meta/connector/${DESCRIPTOR}`, descriptor); |
162 | | - expect(desc.status, await desc.clone().text()).toBe(200); |
| 157 | + // The nested rows: a clean save, then the system context writes the |
| 158 | + // undeclared nested key over it (the save door refuses it now). |
| 159 | + const seedOver = async (name: string, clean: Record<string, unknown>, seeded: Record<string, unknown>) => { |
| 160 | + const res = await stack.apiAs(admin, 'PUT', `/meta/connector/${name}`, clean); |
| 161 | + expect(res.status, await res.clone().text()).toBe(200); |
| 162 | + const [seedRow] = await stored(name); |
| 163 | + await ql.update('sys_metadata', { id: seedRow.id, metadata: JSON.stringify(seeded) }, { context: SYSTEM }); |
| 164 | + }; |
| 165 | + await seedOver( |
| 166 | + RETRY, |
| 167 | + instance(RETRY, { retryConfig: { strategy: 'exponential_backoff', maxAttempts: 2 } }), |
| 168 | + instance(RETRY, { retryConfig: { strategy: 'exponential_backoff', maxAttempts: 2, secret: PLACEHOLDERS.retry } }), |
| 169 | + ); |
| 170 | + const { token: _token, ...cleanAction } = descriptor.actions[0]!; |
| 171 | + await seedOver(DESCRIPTOR, { ...descriptor, actions: [cleanAction, descriptor.actions[1]] }, descriptor); |
163 | 172 | }, 180_000); |
164 | 173 |
|
165 | 174 | afterAll(async () => { |
|
0 commit comments