Skip to content
Merged
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
32 changes: 32 additions & 0 deletions frontend/src/__tests__/util.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,36 @@ describe('Given a function to get the default cluster user', () => {
expect(result).toBe('ec2-user')
})
})

describe('when the OS is Amazon Linux 2023', () => {
const cluster = {config: {Image: {Os: 'alinux2023'}}}
it('should be ec2-user', () => {
const result = clusterDefaultUser(cluster)
expect(result).toBe('ec2-user')
})
})

describe('when the OS is Ubuntu 24.04', () => {
const cluster = {config: {Image: {Os: 'ubuntu2404'}}}
it('should be ubuntu', () => {
const result = clusterDefaultUser(cluster)
expect(result).toBe('ubuntu')
})
})

describe('when the OS is Rocky Linux 8', () => {
const cluster = {config: {Image: {Os: 'rocky8'}}}
it('should be rocky', () => {
const result = clusterDefaultUser(cluster)
expect(result).toBe('rocky')
})
})

describe('when the OS is Rocky Linux 9', () => {
const cluster = {config: {Image: {Os: 'rocky9'}}}
it('should be rocky', () => {
const result = clusterDefaultUser(cluster)
expect(result).toBe('rocky')
})
})
})
195 changes: 193 additions & 2 deletions frontend/src/feature-flags/__tests__/FeatureFlagsProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ describe('given a feature flags provider and a list of rules', () => {
it('should return the list of available features', async () => {
const features = await subject('3.1.5', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu1804',
'centos7',
'ubuntu2004',
'multiuser_cluster',
])
})
Expand All @@ -36,7 +39,10 @@ describe('given a feature flags provider and a list of rules', () => {
it('should return the list of available features', async () => {
const features = await subject('3.2.5', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu1804',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
Expand All @@ -53,7 +59,10 @@ describe('given a feature flags provider and a list of rules', () => {
it('should return the list of available features', async () => {
const features = await subject('3.3.2', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu1804',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
Expand All @@ -76,7 +85,10 @@ describe('given a feature flags provider and a list of rules', () => {
it('should return the list of available features', async () => {
const features = await subject('3.4.1', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu1804',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
Expand All @@ -101,7 +113,10 @@ describe('given a feature flags provider and a list of rules', () => {
it('should return the list of available features', async () => {
const features = await subject('3.6.1', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu1804',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
Expand All @@ -124,10 +139,82 @@ describe('given a feature flags provider and a list of rules', () => {
})
})

describe('when the version is between 3.7.0 and 3.9.0', () => {
describe('when the version is between 3.7.0 and 3.8.0', () => {
it('should return the list of available features', async () => {
const features = await subject('3.7.1', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
'lustre_persistent2',
'memory_based_scheduling',
'slurm_queue_update_strategy',
'ebs_deletion_policy',
'cost_monitoring',
'slurm_accounting',
'queues_multiple_instance_types',
'dynamic_fs_mount',
'efs_deletion_policy',
'lustre_deletion_policy',
'imds_support',
'multi_az',
'on_node_updated',
'rhel8',
'new_resources_limits',
'ubuntu2204',
'login_nodes',
'amazon_file_cache',
'job_exclusive_allocation',
'memory_based_scheduling_with_multiple_instance_types',
])
})
})

describe('when the version is between 3.8.0 and 3.9.0', () => {
it('should return the list of available features', async () => {
const features = await subject('3.8.0', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
'lustre_persistent2',
'memory_based_scheduling',
'slurm_queue_update_strategy',
'ebs_deletion_policy',
'cost_monitoring',
'slurm_accounting',
'queues_multiple_instance_types',
'dynamic_fs_mount',
'efs_deletion_policy',
'lustre_deletion_policy',
'imds_support',
'multi_az',
'on_node_updated',
'rhel8',
'new_resources_limits',
'ubuntu2204',
'login_nodes',
'amazon_file_cache',
'job_exclusive_allocation',
'memory_based_scheduling_with_multiple_instance_types',
'rocky8',
])
})
})

describe('when the version is between 3.9.0 and 3.10.0', () => {
it('should return the list of available features', async () => {
const features = await subject('3.9.0', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
Expand All @@ -151,15 +238,20 @@ describe('given a feature flags provider and a list of rules', () => {
'amazon_file_cache',
'job_exclusive_allocation',
'memory_based_scheduling_with_multiple_instance_types',
'rocky8',
'rhel9',
'rocky9',
])
})
})

for (const version of ["3.9.0", "3.12.0"]) {
for (const version of ["3.10.0", "3.12.0"]) {
describe(`when the version is ${version}`, () => {
it('should return the list of available features', async () => {
const features = await subject(version, region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
Expand All @@ -183,12 +275,90 @@ describe('given a feature flags provider and a list of rules', () => {
'amazon_file_cache',
'job_exclusive_allocation',
'memory_based_scheduling_with_multiple_instance_types',
'rocky8',
'rhel9',
'rocky9',
'alinux2023',
])
})
})
}

describe('when the version is 3.13.0', () => {
it('should return the list of available features', async () => {
const features = await subject('3.13.0', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu2004',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
'lustre_persistent2',
'memory_based_scheduling',
'slurm_queue_update_strategy',
'ebs_deletion_policy',
'cost_monitoring',
'slurm_accounting',
'queues_multiple_instance_types',
'dynamic_fs_mount',
'efs_deletion_policy',
'lustre_deletion_policy',
'imds_support',
'multi_az',
'on_node_updated',
'rhel8',
'new_resources_limits',
'ubuntu2204',
'login_nodes',
'amazon_file_cache',
'job_exclusive_allocation',
'memory_based_scheduling_with_multiple_instance_types',
'rocky8',
'rhel9',
'rocky9',
'alinux2023',
'ubuntu2404',
])
})
})

describe('when the version is 3.14.0', () => {
it('should return the list of available features', async () => {
const features = await subject('3.14.0', region)
Comment thread
gmarciani marked this conversation as resolved.
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'multiuser_cluster',
'fsx_ontap',
'fsx_openzsf',
'lustre_persistent2',
'memory_based_scheduling',
'slurm_queue_update_strategy',
'ebs_deletion_policy',
'cost_monitoring',
'slurm_accounting',
'queues_multiple_instance_types',
'dynamic_fs_mount',
'efs_deletion_policy',
'lustre_deletion_policy',
'imds_support',
'multi_az',
'on_node_updated',
'rhel8',
'new_resources_limits',
'ubuntu2204',
'login_nodes',
'amazon_file_cache',
'job_exclusive_allocation',
'memory_based_scheduling_with_multiple_instance_types',
'rocky8',
'rhel9',
'rocky9',
'alinux2023',
'ubuntu2404',
])
})
})


describe('when an additional feature has been enabled through the browser session storage', () => {
beforeEach(() => {
Expand All @@ -198,7 +368,10 @@ describe('given a feature flags provider and a list of rules', () => {
it('should be included in the list of features', async () => {
const features = await subject('3.1.5', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu1804',
'centos7',
'ubuntu2004',
'multiuser_cluster',
'cost_monitoring',
])
Expand All @@ -212,7 +385,10 @@ describe('given a feature flags provider and a list of rules', () => {
it('should not be included in the list of features', async () => {
const features = await subject('3.1.5', region)
expect(features).toEqual<AvailableFeature[]>([
'alinux2',
'ubuntu1804',
'centos7',
'ubuntu2004',
'multiuser_cluster',
])
})
Expand All @@ -223,6 +399,21 @@ describe('given a feature flags provider and a list of rules', () => {
const features = await subject('3.7.1', region)
expect(features).not.toContain<AvailableFeature[]>(['ubuntu1804'])
})

it('should deprecate centos7 at version 3.10.0', async () => {
const features = await subject('3.10.0', region)
expect(features).not.toContain('centos7')
})

it('should keep centos7 at version 3.9.0', async () => {
const features = await subject('3.9.0', region)
expect(features).toContain('centos7')
})

it('should deprecate ubuntu2004 at version 3.14.0', async () => {
const features = await subject('3.14.0', region)
expect(features).not.toContain('ubuntu2004')
})
})

describe('when a feature is not supported in a region', () => {
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/feature-flags/featureFlagsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import {AvailableFeature} from './types'

const versionToFeaturesMap: Record<string, AvailableFeature[]> = {
// Placing ubuntu1804 here to be counted as a feature flag, so it can be deprecated
'3.0.0': ['ubuntu1804'],
// Placing alinux2, ubuntu1804, centos7, ubuntu2004 here to be counted as feature flags, so they can be deprecated
'3.0.0': ['alinux2', 'ubuntu1804', 'centos7', 'ubuntu2004'],
'3.1.0': ['multiuser_cluster'],
'3.2.0': [
'fsx_ontap',
Expand Down Expand Up @@ -41,13 +41,18 @@ const versionToFeaturesMap: Record<string, AvailableFeature[]> = {
'job_exclusive_allocation',
'memory_based_scheduling_with_multiple_instance_types',
],
'3.9.0': ['rhel9'],
'3.8.0': ['rocky8'],
'3.9.0': ['rhel9', 'rocky9'],
'3.10.0': ['alinux2023'],
'3.13.0': ['ubuntu2404'],
}

const featureToDeperecatedVersionMap: Partial<
Record<AvailableFeature, string>
> = {
ubuntu1804: '3.7.0',
centos7: '3.10.0',
ubuntu2004: '3.14.0',
}

function isVersionGreaterOrEqualThan(version: string, other: string): boolean {
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/feature-flags/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ export type AvailableFeature =
| 'job_exclusive_allocation'
| 'memory_based_scheduling_with_multiple_instance_types'
| 'rhel9'
| 'alinux2'
| 'centos7'
| 'ubuntu2004'
| 'rocky8'
| 'rocky9'
| 'alinux2023'
| 'ubuntu2404'
Loading
Loading