mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-01 02:00:10 +00:00
914c55b03c
* refactor(terraform-module): extract getRegistryRepository to utils * refactor(terraform-module): add zod schemas and validate service discovery * refactor(terraform-module): use zod schemas in query methods and inline fixtures * fix(terraform): update hash test to use valid service discovery response * refactor(terraform-module): address review feedback * style: biome lint fix * refactor(terraform-module): address review feedback
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import * as httpMock from '~test/http-mock.ts';
|
|
import { ExternalHostError } from '../../../types/errors/external-host-error.ts';
|
|
import { getPkgReleases } from '../index.ts';
|
|
import { TerraformModuleDatasource } from './index.ts';
|
|
|
|
describe('modules/datasource/terraform-module/base', () => {
|
|
it('throws ExternalHostError for EAI_AGAIN errors', async () => {
|
|
httpMock
|
|
.scope('https://terraform-eai-again.example.com')
|
|
.get('/.well-known/terraform.json')
|
|
.replyWithError(httpMock.error({ code: 'EAI_AGAIN' }));
|
|
|
|
await expect(
|
|
getPkgReleases({
|
|
datasource: TerraformModuleDatasource.id,
|
|
packageName: 'hashicorp/consul/aws',
|
|
registryUrls: ['https://terraform-eai-again.example.com'],
|
|
}),
|
|
).rejects.toThrow(ExternalHostError);
|
|
});
|
|
|
|
it('throws ExternalHostError for HTTP 503 errors', async () => {
|
|
httpMock
|
|
.scope('https://terraform-503.example.com')
|
|
.get('/.well-known/terraform.json')
|
|
.reply(503);
|
|
|
|
await expect(
|
|
getPkgReleases({
|
|
datasource: TerraformModuleDatasource.id,
|
|
packageName: 'hashicorp/consul/aws',
|
|
registryUrls: ['https://terraform-503.example.com'],
|
|
}),
|
|
).rejects.toThrow(ExternalHostError);
|
|
});
|
|
});
|