Skip to content

Commit

Permalink
test: fix mockInfereceService should take labels
Browse files Browse the repository at this point in the history
Signed-off-by: Tomer Figenblat <tfigenbl@redhat.com>
  • Loading branch information
TomerFi committed Oct 30, 2024
1 parent 9dea313 commit 5684898
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions frontend/src/__mocks__/mockInferenceServiceK8sResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type MockResourceConfigType = {
kserveInternalUrl?: string;
statusPredictor?: Record<string, string>;
kserveInternalLabel?: boolean;
additionalLabels?: Record<string, string>;
};

type InferenceServicek8sError = K8sStatus & {
Expand Down Expand Up @@ -80,6 +81,7 @@ export const mockInferenceServiceK8sResource = ({
statusPredictor = undefined,
kserveInternalUrl = '',
kserveInternalLabel = false,
additionalLabels = {},
}: MockResourceConfigType): InferenceServiceKind => ({
apiVersion: 'serving.kserve.io/v1beta1',
kind: 'InferenceService',
Expand All @@ -99,8 +101,7 @@ export const mockInferenceServiceK8sResource = ({
generation: 1,
labels: {
name,
[KnownLabels.REGISTERED_MODEL_ID]: '1',
[KnownLabels.MODEL_VERSION_ID]: '3',
...additionalLabels,
[KnownLabels.DASHBOARD_RESOURCE]: 'true',
...(kserveInternalLabel && { 'networking.knative.dev/visibility': 'cluster-local' }),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from '~/__tests__/cypress/cypress/pages/modelRegistry/modelVersionArchive';
import { labelModal, modelRegistry } from '~/__tests__/cypress/cypress/pages/modelRegistry';
import { mockModelRegistryService } from '~/__mocks__/mockModelRegistryService';
import { KnownLabels } from '~/k8sTypes';

const MODEL_REGISTRY_API_VERSION = 'v1alpha3';

Expand Down Expand Up @@ -323,7 +324,14 @@ describe('Archiving version', () => {
cy.interceptK8sList(ProjectModel, mockK8sResourceList([mockProjectK8sResource({})]));
cy.interceptK8sList(
InferenceServiceModel,
mockK8sResourceList([mockInferenceServiceK8sResource({})]),
mockK8sResourceList([
mockInferenceServiceK8sResource({
additionalLabels: {
[KnownLabels.REGISTERED_MODEL_ID]: '1',
[KnownLabels.MODEL_VERSION_ID]: '3',
},
}),
]),
);
initIntercepts({});

Expand Down

0 comments on commit 5684898

Please sign in to comment.