mirror of
https://github.com/renovatebot/renovate.git
synced 2025-05-12 23:51:55 +00:00

Co-authored-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Rhys Arkins <rhys@arkins.net>
83 lines
2.9 KiB
TypeScript
83 lines
2.9 KiB
TypeScript
import { join } from 'upath';
|
|
import { GlobalConfig } from '../../../config/global';
|
|
import type { RepoGlobalConfig } from '../../../config/types';
|
|
import { generateHelmEnvs } from './common';
|
|
|
|
const adminConfig: RepoGlobalConfig = {
|
|
// `join` fixes Windows CI
|
|
localDir: join('/tmp/github/some/repo'),
|
|
cacheDir: join('/tmp/cache'),
|
|
containerbaseDir: join('/tmp/cache/containerbase'),
|
|
};
|
|
|
|
describe('modules/manager/kustomize/common', () => {
|
|
beforeEach(() => {
|
|
GlobalConfig.set(adminConfig);
|
|
});
|
|
|
|
describe('generateHelmEnvs', () => {
|
|
it('generates envs for specific helm version not requiring HELM_EXPERIMENTAL_OCI', () => {
|
|
const config = {
|
|
constraints: { helm: '3.8.0' },
|
|
};
|
|
const envs = generateHelmEnvs(config);
|
|
expect(envs).toEqual({
|
|
HELM_REGISTRY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/registry.json',
|
|
HELM_REPOSITORY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/repositories.yaml',
|
|
HELM_REPOSITORY_CACHE:
|
|
'/tmp/cache/__renovate-private-cache/repositories',
|
|
});
|
|
});
|
|
|
|
it('generates envs for helm version range not requiring HELM_EXPERIMENTAL_OCI', () => {
|
|
const config = {
|
|
constraints: { helm: '>=3.7.0' },
|
|
};
|
|
const envs = generateHelmEnvs(config);
|
|
expect(envs).toEqual({
|
|
HELM_REGISTRY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/registry.json',
|
|
HELM_REPOSITORY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/repositories.yaml',
|
|
HELM_REPOSITORY_CACHE:
|
|
'/tmp/cache/__renovate-private-cache/repositories',
|
|
});
|
|
});
|
|
|
|
it('generates envs for specific helm version requiring HELM_EXPERIMENTAL_OCI', () => {
|
|
const config = {
|
|
constraints: { helm: '3.7.0' },
|
|
postUpdateOptions: ['kustomizeInflateHelmCharts'],
|
|
};
|
|
const envs = generateHelmEnvs(config);
|
|
expect(envs).toEqual({
|
|
HELM_REGISTRY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/registry.json',
|
|
HELM_REPOSITORY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/repositories.yaml',
|
|
HELM_REPOSITORY_CACHE:
|
|
'/tmp/cache/__renovate-private-cache/repositories',
|
|
HELM_EXPERIMENTAL_OCI: '1',
|
|
});
|
|
});
|
|
|
|
it('generates envs for helm range version requiring HELM_EXPERIMENTAL_OCI', () => {
|
|
const config = {
|
|
constraints: { helm: '<3.8.0' },
|
|
postUpdateOptions: ['kustomizeInflateHelmCharts'],
|
|
};
|
|
const envs = generateHelmEnvs(config);
|
|
expect(envs).toEqual({
|
|
HELM_REGISTRY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/registry.json',
|
|
HELM_REPOSITORY_CONFIG:
|
|
'/tmp/cache/__renovate-private-cache/repositories.yaml',
|
|
HELM_REPOSITORY_CACHE:
|
|
'/tmp/cache/__renovate-private-cache/repositories',
|
|
HELM_EXPERIMENTAL_OCI: '1',
|
|
});
|
|
});
|
|
});
|
|
});
|