Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ describe('getClusterCompatibility', () => {
expect(getClusterCompatibility(lifecycle, '2.0.1', '4.17.0')).toBe('compatible');
expect(getClusterCompatibility(lifecycle, '2.0.1', '4.14.0')).toBe('incompatible');
});

it('returns no data for an invalid operator version', () => {
expect(getClusterCompatibility(lifecycle, 'latest', '4.15.0')).toBe('no-data');
});
});

describe('getSupportPhase', () => {
Expand Down Expand Up @@ -183,6 +187,12 @@ describe('getSupportPhase', () => {
expect(getSupportPhase(noPhases, '1.0')).toEqual({ status: SupportPhaseStatus.NoData });
});

it('returns no data for an invalid operator version', () => {
expect(getSupportPhase(lifecycle, 'latest', new Date('2024-03-15'))).toEqual({
status: SupportPhaseStatus.NoData,
});
});

it('matches operator version by minor version when exact match fails', () => {
const result = getSupportPhase(lifecycle, '1.0.5', new Date('2024-03-15'));
expect(result).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ const findVersionEntry = (
if (!operatorVersion) {
return versions[0];
}
return (
versions.find((v) => v.name === operatorVersion) ??
versions.find((v) => parseMinorVersion(v.name) === parseMinorVersion(operatorVersion))
);
const minor = parseMinorVersion(operatorVersion);
if (minor === undefined) {
return undefined;
}
return versions.find((v) => parseMinorVersion(v.name) === minor);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
};

export type CompatibilityResult = 'compatible' | 'incompatible' | 'no-data';
Expand Down