From 23c386b0e91695826b90130feaed6297447a0377 Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Thu, 26 Dec 2024 18:33:13 +0000 Subject: [PATCH] feat(23410): prettier fix Signed-off-by: ivan katliarchuk --- .../datasource/aws-eks-addon/index.spec.ts | 18 +++++++++++++++ .../datasource/aws-eks-addon/schema.spec.ts | 22 ++++++++++--------- lib/modules/versioning/aws-eks-addon/index.ts | 8 +++---- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/lib/modules/datasource/aws-eks-addon/index.spec.ts b/lib/modules/datasource/aws-eks-addon/index.spec.ts index 2f99b57e4ad74b..0b5ec16e7c8cab 100644 --- a/lib/modules/datasource/aws-eks-addon/index.spec.ts +++ b/lib/modules/datasource/aws-eks-addon/index.spec.ts @@ -151,6 +151,24 @@ describe('modules/datasource/aws-eks-addon/index', () => { }); }); + it('with addon and profile', async () => { + mockDescribeAddonVersionsCommand({ addons: [] }); + await getPkgReleases({ + datasource, + packageName: '{"addonName":"vpc-cni-not-exist", "profile":"paradox"}', + }); + expect(eksMock.calls()).toHaveLength(1); + }); + + it('with addon and region', async () => { + mockDescribeAddonVersionsCommand({ addons: [] }); + await getPkgReleases({ + datasource, + packageName: '{"addonName":"vpc-cni-not-exist", "region":"usa"}', + }); + expect(eksMock.calls()).toHaveLength(1); + }); + it('with addonName and default only config', async () => { mockDescribeAddonVersionsCommand({ addons: [addonInfo] }); const res = await getPkgReleases({ diff --git a/lib/modules/datasource/aws-eks-addon/schema.spec.ts b/lib/modules/datasource/aws-eks-addon/schema.spec.ts index f8f0c5a435b634..dc0358d4cf00eb 100644 --- a/lib/modules/datasource/aws-eks-addon/schema.spec.ts +++ b/lib/modules/datasource/aws-eks-addon/schema.spec.ts @@ -3,16 +3,18 @@ import { EksAddonsFilter } from './schema'; describe('modules/datasource/aws-eks-addon/schema', () => { describe('EksAddonsFilter', () => { it.each` - input | expected - ${{ kubernetesVersion: '1.30', addonName: 'kube_proxy' }} | ${false} - ${{ kubernetesVersion: '130', addonName: 'kube_proxy' }} | ${false} - ${{ addonName: 'kube_proxy', default: 'abrakadabra' }} | ${false} - ${{ kubernetesVersion: '1.30' }} | ${false} - ${{ addonName: 'kube-proxy', default: 'false' }} | ${true} - ${{ addonName: 'kube-proxy', default: 'true' }} | ${true} - ${{ addonName: 'kube-proxy', default: false }} | ${true} - ${{ kubernetesVersion: '1.30', addonName: 'vpc-cni' }} | ${true} - ${{ addonName: 'vpc-cni' }} | ${true} + input | expected + ${{ kubernetesVersion: '1.30', addonName: 'kube_proxy' }} | ${false} + ${{ kubernetesVersion: '130', addonName: 'kube_proxy' }} | ${false} + ${{ addonName: 'kube_proxy', default: 'abrakadabra' }} | ${false} + ${{ kubernetesVersion: '1.30' }} | ${false} + ${{ addonName: 'kube-proxy', default: 'false' }} | ${true} + ${{ addonName: 'kube-proxy', default: 'true' }} | ${true} + ${{ addonName: 'kube-proxy', default: false }} | ${true} + ${{ addonName: 'aws-cloudwatch-controller', default: false }} | ${true} + ${{ addonName: 'aws-cloudwatch-controller', profile: 'abc' }} | ${true} + ${{ kubernetesVersion: '1.30', addonName: 'vpc-cni' }} | ${true} + ${{ addonName: 'vpc-cni' }} | ${true} `('safeParse("$input") === $expected', ({ input, expected }) => { const actual = EksAddonsFilter.safeParse(JSON.stringify(input)); expect(actual.success).toBe(expected); diff --git a/lib/modules/versioning/aws-eks-addon/index.ts b/lib/modules/versioning/aws-eks-addon/index.ts index ee0cfd0e2885c6..07af5ade526e28 100644 --- a/lib/modules/versioning/aws-eks-addon/index.ts +++ b/lib/modules/versioning/aws-eks-addon/index.ts @@ -25,14 +25,14 @@ class AwsEKSAddonVersioningApi extends GenericVersioningApi { return null; } const [, prefix, suffix] = matches; - const release: number[] = prefix.split('.').map(Number); - if (release.length !== 3) { + if (!suffix) { return null; } - if (!suffix) { + const release: number[] = prefix.split('.').map(Number); + if (release.length !== 3) { return null; } - return { release, suffix: suffix || '' }; + return { release, suffix }; } protected override _compare(version: string, other: string): number {