Skip to content

Commit

Permalink
fix(cluster-creation-flow): remove EC2 cluster type (#1749)
Browse files Browse the repository at this point in the history
* fix(cluster-creation-flow): remove ec2 cluster type

* fix: test

* remove useless import
  • Loading branch information
RemiBonnet authored Nov 4, 2024
1 parent 8e22b67 commit 3d5cf5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { act, getByLabelText, getByText, render } from '__tests__/utils/setup-jest'
import { getByLabelText, getByText, render } from '__tests__/utils/setup-jest'
import { wrapWithReactHookForm } from '__tests__/utils/wrap-with-react-hook-form'
import { CloudProviderEnum, KubernetesEnum } from 'qovery-typescript-axios'
import * as cloudProvidersDomain from '@qovery/domains/cloud-providers/feature'
import { CloudProviderEnum } from 'qovery-typescript-axios'
import { type ClusterResourcesData } from '@qovery/shared/interfaces'
import ClusterResourcesSettingsFeature from './cluster-resources-settings-feature'

Expand Down Expand Up @@ -46,7 +45,6 @@ describe('ClusterResourcesSettingsFeature', () => {
)
)
getByText(baseElement, 'Managed K8S (EKS)')
getByText(baseElement, 'BETA - Single EC2 (K3S)')
})

it('should render one cluster type option if scw', () => {
Expand Down Expand Up @@ -97,40 +95,4 @@ describe('ClusterResourcesSettingsFeature', () => {
const checkbox = getByLabelText(baseElement, 'Managed K8S (EKS)')
expect(checkbox).toBeChecked()
})

it('should fetch the availabale Instance types at init and on change', async () => {
const useCloudProviderInstanceTypesMockSpy = jest.spyOn(
cloudProvidersDomain,
'useCloudProviderInstanceTypes'
) as jest.Mock
const { baseElement } = render(
wrapWithReactHookForm<ClusterResourcesData>(
<ClusterResourcesSettingsFeature
clusterRegion="us-east-2"
fromDetail={false}
cloudProvider={CloudProviderEnum.AWS}
/>,
{
defaultValues,
}
)
)

expect(useCloudProviderInstanceTypesMockSpy).toHaveBeenCalledWith({
clusterType: 'MANAGED',
cloudProvider: 'AWS',
region: 'us-east-2',
})

const checkbox = getByText(baseElement, 'BETA - Single EC2 (K3S)')
await act(() => {
checkbox.click()
})

expect(useCloudProviderInstanceTypesMockSpy).toHaveBeenCalledWith({
clusterType: KubernetesEnum.K3_S,
cloudProvider: 'AWS',
region: 'us-east-2',
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ export function ClusterResourcesSettingsFeature(props: ClusterResourcesSettingsF
if (props?.cloudProvider === CloudProviderEnum.AWS) {
clusterTypeOptions = [
{ label: 'Managed K8S (EKS)', value: KubernetesEnum.MANAGED, description: 'Multiple node cluster' },
{
label: 'BETA - Single EC2 (K3S)',
value: KubernetesEnum.K3_S,
description: 'Single instance K3S cluster - only for dev purposes',
},
]
} else if (props?.cloudProvider === CloudProviderEnum.GCP) {
clusterTypeOptions = [
Expand Down

0 comments on commit 3d5cf5c

Please sign in to comment.