btlqql opened a new issue, #4046:
URL: https://github.com/apache/rocketmq-dashboard/issues/4046
## Problem
The current test suite does not cover optional credentials on metrics
data-source queries.
## Expected behavior
- A focused Vitest case locks the existing behavior.
- The targeted test file passes and fails if the covered behavior regresses.
## Scope
Only add regression coverage for $(@{Slug=metrics-datasource-credentials;
Focus=optional credentials on metrics data-source queries;
PrTitle=test(metrics): cover optional data-source query credentials;
TestFile=web/src/api/metrics.test.ts; Mode=existing; Append=describe('metrics
data-source query optional credentials', () => {
it('omits optional credential fields when none are supplied', async () => {
const result = { resultType: 'matrix', series: [], warnings: [] };
const query = { metric: 'up', start: 1, end: 2, step: '1m' };
mock.onPost('/metrics/query/datasource').reply((config) => {
const body = JSON.parse(config.data);
expect(body.query).toEqual(query);
expect(body.username).toBeUndefined();
expect(body.password).toBeUndefined();
expect(body.bearerToken).toBeUndefined();
return [200, { code: 200, data: result }];
});
await expect(
queryByDataSource({ key: 'ds-prom-1', query }),
).resolves.toEqual(result);
});
});}.TestFile). No runtime behavior changes.
## Acceptance criteria
- [ ] The targeted Vitest file passes.
- [ ] git diff --check is clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]