Files
renovate/lib/modules/manager/kustomize/common.spec.ts
Jamie Tanna 0e6429b13e refactor(types): document localDir isn't a globalOnly option (#44635)
* refactor(types): document `localDir` isn't a `globalOnly` option

To make sure that it's clear when reviewing `GlobalConfig`, as well as
working with our types, we can move the `localDir` definition into a
separate type.

* fixup! refactor(types): document `localDir` isn't a `globalOnly` option

* fixup! refactor(types): document `localDir` isn't a `globalOnly` option

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>

* fixup! refactor(types): document `localDir` isn't a `globalOnly` option

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>

* fixup! refactor(types): document `localDir` isn't a `globalOnly` option

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>

---------

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-07-20 08:07:17 +00:00

87 lines
2.9 KiB
TypeScript

import upath from 'upath';
import { GlobalConfig } from '../../../config/global.ts';
import type {
InternalGlobalConfigOptions,
RepoGlobalConfig,
} from '../../../config/types.ts';
import { generateHelmEnvs } from './common.ts';
const adminConfig: RepoGlobalConfig & InternalGlobalConfigOptions = {
// `join` fixes Windows CI
localDir: upath.join('/tmp/github/some/repo'),
cacheDir: upath.join('/tmp/cache'),
containerbaseDir: upath.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',
});
});
});
});