Skip to content

Commit

Permalink
Handle deleted container size in workbenches
Browse files Browse the repository at this point in the history
  • Loading branch information
manaswinidas committed Jul 16, 2024
1 parent dc5de07 commit 66a7bb4
Show file tree
Hide file tree
Showing 9 changed files with 323 additions and 113 deletions.
137 changes: 70 additions & 67 deletions frontend/src/__mocks__/mockDashboardConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DashboardConfigKind, KnownLabels } from '~/k8sTypes';
import { NotebookSize } from '~/types';

type MockDashboardConfigType = {
disableInfo?: boolean;
Expand Down Expand Up @@ -26,6 +27,7 @@ type MockDashboardConfigType = {
disableDistributedWorkloads?: boolean;
disableModelRegistry?: boolean;
disableNotebookController?: boolean;
notebookSizes?: NotebookSize[];
};

export const mockDashboardConfig = ({
Expand Down Expand Up @@ -54,6 +56,73 @@ export const mockDashboardConfig = ({
disableDistributedWorkloads = false,
disableModelRegistry = true,
disableNotebookController = false,
notebookSizes = [
{
name: 'XSmall',
resources: {
limits: {
cpu: '0.5',
memory: '500Mi',
},
requests: {
cpu: '0.1',
memory: '100Mi',
},
},
},
{
name: 'Small',
resources: {
limits: {
cpu: '2',
memory: '8Gi',
},
requests: {
cpu: '1',
memory: '8Gi',
},
},
},
{
name: 'Medium',
resources: {
limits: {
cpu: '6',
memory: '24Gi',
},
requests: {
cpu: '3',
memory: '24Gi',
},
},
},
{
name: 'Large',
resources: {
limits: {
cpu: '14',
memory: '56Gi',
},
requests: {
cpu: '7',
memory: '56Gi',
},
},
},
{
name: 'X Large',
resources: {
limits: {
cpu: '30',
memory: '120Gi',
},
requests: {
cpu: '15',
memory: '120Gi',
},
},
},
],
}: MockDashboardConfigType): DashboardConfigKind => ({
apiVersion: 'opendatahub.io/v1alpha',
kind: 'OdhDashboardConfig',
Expand Down Expand Up @@ -147,73 +216,7 @@ export const mockDashboardConfig = ({
},
},
],
notebookSizes: [
{
name: 'XSmall',
resources: {
limits: {
cpu: '0.5',
memory: '500Mi',
},
requests: {
cpu: '0.1',
memory: '100Mi',
},
},
},
{
name: 'Small',
resources: {
limits: {
cpu: '2',
memory: '8Gi',
},
requests: {
cpu: '1',
memory: '8Gi',
},
},
},
{
name: 'Medium',
resources: {
limits: {
cpu: '6',
memory: '24Gi',
},
requests: {
cpu: '3',
memory: '24Gi',
},
},
},
{
name: 'Large',
resources: {
limits: {
cpu: '14',
memory: '56Gi',
},
requests: {
cpu: '7',
memory: '56Gi',
},
},
},
{
name: 'X Large',
resources: {
limits: {
cpu: '30',
memory: '120Gi',
},
requests: {
cpu: '15',
memory: '120Gi',
},
},
},
],
notebookSizes,
templateOrder: ['test-model'],
templateDisablement: ['test-model'],
},
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ class CreateSpawnerPage {
findBucketInput() {
return cy.findByTestId('field AWS_S3_BUCKET');
}

findContainerSizeInput(name: string) {
return cy.findByTestId('container-size-group').contains(name);
}
}

class EditSpawnerPage extends CreateSpawnerPage {
Expand Down Expand Up @@ -326,6 +330,10 @@ class EditSpawnerPage extends CreateSpawnerPage {
cy.findByTestId('container-size-group').contains(name).should('exist');
return this;
}

findCancelButton() {
return cy.findByTestId('workbench-cancel-button');
}
}

class NotFoundSpawnerPage {
Expand Down
Loading

0 comments on commit 66a7bb4

Please sign in to comment.