Skip to content

Commit

Permalink
Merge branch 'kubeflow:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wise-king-sullyman authored Nov 19, 2024
2 parents 1637a3e + eba7ef2 commit 5efb1c6
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 103 deletions.
5 changes: 0 additions & 5 deletions clients/ui/frontend/src/__mocks__/mockBFFResponse.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { GenericStaticResponse, RouteHandlerController } from 'cypress/types/net-stubbing';
import { mockBFFResponse } from '~/__mocks__/utils';
import type {
ModelArtifact,
ModelArtifactList,
ModelRegistry,
ModelRegistryBody,
ModelVersion,
ModelVersionList,
RegisteredModel,
Expand Down Expand Up @@ -35,7 +35,7 @@ declare global {
interceptApi: ((
type: 'GET /api/:apiVersion/model_registry/:modelRegistryName/registered_models',
options: { path: { modelRegistryName: string; apiVersion: string } },
response: ApiResponse<ModelRegistryBody<RegisteredModelList>>,
response: ApiResponse<RegisteredModelList>,
) => Cypress.Chainable<null>) &
((
type: 'POST /api/:apiVersion/model_registry/:modelRegistryName/registered_models',
Expand All @@ -47,7 +47,7 @@ declare global {
options: {
path: { modelRegistryName: string; apiVersion: string; registeredModelId: number };
},
response: ApiResponse<ModelRegistryBody<ModelVersionList>>,
response: ApiResponse<ModelVersionList>,
) => Cypress.Chainable<null>) &
((
type: 'POST /api/:apiVersion/model_registry/:modelRegistryName/registered_models/:registeredModelId/versions',
Expand All @@ -61,28 +61,28 @@ declare global {
options: {
path: { modelRegistryName: string; apiVersion: string; registeredModelId: number };
},
response: ApiResponse<ModelRegistryBody<RegisteredModel>>,
response: ApiResponse<RegisteredModel>,
) => Cypress.Chainable<null>) &
((
type: 'PATCH /api/:apiVersion/model_registry/:modelRegistryName/registered_models/:registeredModelId',
options: {
path: { modelRegistryName: string; apiVersion: string; registeredModelId: number };
},
response: ApiResponse<ModelRegistryBody<RegisteredModel>>,
response: ApiResponse<RegisteredModel>,
) => Cypress.Chainable<null>) &
((
type: 'GET /api/:apiVersion/model_registry/:modelRegistryName/model_versions/:modelVersionId',
options: {
path: { modelRegistryName: string; apiVersion: string; modelVersionId: number };
},
response: ApiResponse<ModelRegistryBody<ModelVersion>>,
response: ApiResponse<ModelVersion>,
) => Cypress.Chainable<null>) &
((
type: 'GET /api/:apiVersion/model_registry/:modelRegistryName/model_versions/:modelVersionId/artifacts',
options: {
path: { modelRegistryName: string; apiVersion: string; modelVersionId: number };
},
response: ApiResponse<ModelRegistryBody<ModelArtifactList>>,
response: ApiResponse<ModelArtifactList>,
) => Cypress.Chainable<null>) &
((
type: 'POST /api/:apiVersion/model_registry/:modelRegistryName/model_versions/:modelVersionId/artifacts',
Expand All @@ -96,12 +96,12 @@ declare global {
options: {
path: { modelRegistryName: string; apiVersion: string; modelVersionId: number };
},
response: ApiResponse<ModelRegistryBody<ModelVersion | undefined>>,
response: ApiResponse<ModelVersion | undefined>,
) => Cypress.Chainable<null>) &
((
type: 'GET /api/:apiVersion/model_registry',
options: { path: { apiVersion: string } },
response: ApiResponse<ModelRegistryBody<ModelRegistry[]>>,
response: ApiResponse<ModelRegistry[]>,
) => Cypress.Chainable<null>);
}
}
Expand Down Expand Up @@ -136,7 +136,7 @@ Cypress.Commands.add(
}
return cy.intercept(
{ method, pathname, query: options?.query, ...(options?.times && { times: options.times }) },
response,
mockBFFResponse(response),
);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { mockModelVersionList } from '~/__mocks__/mockModelVersionList';
import { mockRegisteredModel } from '~/__mocks__/mockRegisteredModel';
import { mockRegisteredModelList } from '~/__mocks__/mockRegisteredModelsList';
import { labelModal, modelRegistry } from '~/__tests__/cypress/cypress/pages/modelRegistry';
import { mockBFFResponse } from '~/__mocks__/mockBFFResponse';
import type { ModelRegistry, ModelVersion, RegisteredModel } from '~/app/types';
import { be } from '~/__tests__/cypress/cypress/utils/should';
import { MODEL_REGISTRY_API_VERSION } from '~/__tests__/cypress/cypress/support/commands/api';
Expand Down Expand Up @@ -69,15 +68,15 @@ const initIntercepts = ({
{
path: { apiVersion: MODEL_REGISTRY_API_VERSION },
},
mockBFFResponse(modelRegistries),
modelRegistries,
);

cy.interceptApi(
`GET /api/:apiVersion/model_registry/:modelRegistryName/registered_models`,
{
path: { modelRegistryName: 'modelregistry-sample', apiVersion: MODEL_REGISTRY_API_VERSION },
},
mockBFFResponse(mockRegisteredModelList({ items: registeredModels })),
mockRegisteredModelList({ items: registeredModels }),
);

cy.interceptApi(
Expand All @@ -89,7 +88,7 @@ const initIntercepts = ({
registeredModelId: 1,
},
},
mockBFFResponse(mockModelVersionList({ items: modelVersions })),
mockModelVersionList({ items: modelVersions }),
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { mockModelRegistry } from '~/__mocks__/mockModelRegistry';
import type { ModelRegistry } from '~/app/types';
import { mockBFFResponse } from '~/__mocks__/mockBFFResponse';
import { modelRegistrySettings } from '~/__tests__/cypress/cypress/pages/modelRegistrySettings';

type HandlersProps = {
Expand Down Expand Up @@ -28,7 +27,7 @@ const initIntercepts = ({
{
path: { apiVersion: MODEL_REGISTRY_API_VERSION },
},
mockBFFResponse(modelRegistries),
modelRegistries,
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ const initIntercepts = ({
{
path: { apiVersion: MODEL_REGISTRY_API_VERSION },
},
mockBFFResponse(modelRegistries),
modelRegistries,
);

cy.interceptApi(
`GET /api/:apiVersion/model_registry/:modelRegistryName/registered_models`,
{
path: { modelRegistryName: 'modelregistry-sample', apiVersion: MODEL_REGISTRY_API_VERSION },
},
mockBFFResponse(mockRegisteredModelList({ size: registeredModelsSize })),
mockRegisteredModelList({ size: registeredModelsSize }),
);

cy.interceptApi(
Expand All @@ -83,11 +83,9 @@ const initIntercepts = ({
registeredModelId: 1,
},
},
mockBFFResponse(
mockModelVersionList({
items: modelVersions,
}),
),
mockModelVersionList({
items: modelVersions,
}),
);

cy.interceptApi(
Expand All @@ -99,7 +97,7 @@ const initIntercepts = ({
registeredModelId: 1,
},
},
mockBFFResponse(mockRegisteredModel({ name: 'test-1' })),
mockRegisteredModel({ name: 'test-1' }),
);

cy.interceptApi(
Expand All @@ -111,9 +109,7 @@ const initIntercepts = ({
modelVersionId: 2,
},
},
mockBFFResponse(
mockModelVersion({ id: '2', name: 'model version 2', state: ModelState.ARCHIVED }),
),
mockModelVersion({ id: '2', name: 'model version 2', state: ModelState.ARCHIVED }),
);

cy.interceptApi(
Expand All @@ -125,7 +121,7 @@ const initIntercepts = ({
modelVersionId: 3,
},
},
mockBFFResponse(mockModelVersion({ id: '3', name: 'model version 3', state: ModelState.LIVE })),
mockModelVersion({ id: '3', name: 'model version 3', state: ModelState.LIVE }),
);
};

Expand Down Expand Up @@ -199,7 +195,7 @@ describe('Restoring archive version', () => {
modelVersionId: 2,
},
},
mockBFFResponse(mockModelVersion({})),
mockModelVersion({}),
).as('versionRestored');

initIntercepts({});
Expand Down Expand Up @@ -228,7 +224,7 @@ describe('Restoring archive version', () => {
modelVersionId: 2,
},
},
mockBFFResponse(mockModelVersion({})),
mockModelVersion({}),
).as('versionRestored');

initIntercepts({});
Expand Down Expand Up @@ -257,7 +253,7 @@ describe('Archiving version', () => {
modelVersionId: 3,
},
},
mockBFFResponse(mockModelVersion({})),
mockModelVersion({}),
).as('versionArchived');

initIntercepts({});
Expand Down Expand Up @@ -287,7 +283,7 @@ describe('Archiving version', () => {
modelVersionId: 3,
},
},
mockBFFResponse(mockModelVersion({})),
mockModelVersion({}),
).as('versionArchived');

initIntercepts({});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable camelcase */
import { verifyRelativeURL } from '~/__tests__/cypress/cypress/utils/url';
import { mockModelRegistry } from '~/__mocks__/mockModelRegistry';
import { mockBFFResponse } from '~/__mocks__/utils';
import { mockRegisteredModel } from '~/__mocks__/mockRegisteredModel';
import { mockModelVersionList } from '~/__mocks__/mockModelVersionList';
import { mockModelVersion } from '~/__mocks__/mockModelVersion';
Expand Down Expand Up @@ -34,7 +33,7 @@ const initIntercepts = ({
{
path: { apiVersion: MODEL_REGISTRY_API_VERSION },
},
mockBFFResponse(modelRegistries),
modelRegistries,
);

cy.interceptApi(
Expand All @@ -46,7 +45,7 @@ const initIntercepts = ({
registeredModelId: 1,
},
},
mockBFFResponse(mockRegisteredModel({})),
mockRegisteredModel({}),
);

cy.interceptApi(
Expand All @@ -58,19 +57,17 @@ const initIntercepts = ({
registeredModelId: 1,
},
},
mockBFFResponse(
mockModelVersionList({
items: [
mockModelVersion({ name: 'Version 1', author: 'Author 1', registeredModelId: '1' }),
mockModelVersion({
author: 'Author 2',
registeredModelId: '1',
id: '2',
name: 'Version 2',
}),
],
}),
),
mockModelVersionList({
items: [
mockModelVersion({ name: 'Version 1', author: 'Author 1', registeredModelId: '1' }),
mockModelVersion({
author: 'Author 2',
registeredModelId: '1',
id: '2',
name: 'Version 2',
}),
],
}),
);

cy.interceptApi(
Expand All @@ -82,23 +79,21 @@ const initIntercepts = ({
modelVersionId: 1,
},
},
mockBFFResponse(
mockModelVersion({
id: '1',
name: 'Version 1',
labels: [
'Testing label',
'Financial data',
'Fraud detection',
'Long label data to be truncated abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc',
'Machine learning',
'Next data to be overflow',
'Label x',
'Label y',
'Label z',
],
}),
),
mockModelVersion({
id: '1',
name: 'Version 1',
labels: [
'Testing label',
'Financial data',
'Fraud detection',
'Long label data to be truncated abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc',
'Machine learning',
'Next data to be overflow',
'Label x',
'Label y',
'Label z',
],
}),
);

cy.interceptApi(
Expand All @@ -110,7 +105,7 @@ const initIntercepts = ({
modelVersionId: 2,
},
},
mockBFFResponse(mockModelVersion({ id: '2', name: 'Version 2' })),
mockModelVersion({ id: '2', name: 'Version 2' }),
);

cy.interceptApi(
Expand All @@ -122,18 +117,16 @@ const initIntercepts = ({
modelVersionId: 1,
},
},
mockBFFResponse(
mockModelArtifactList({
items: [
mockModelArtifact({}),
mockModelArtifact({
author: 'Author 2',
id: '2',
name: 'Artifact 2',
}),
],
}),
),
mockModelArtifactList({
items: [
mockModelArtifact({}),
mockModelArtifact({
author: 'Author 2',
id: '2',
name: 'Artifact 2',
}),
],
}),
);
};

Expand Down
Loading

0 comments on commit 5efb1c6

Please sign in to comment.