Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHOAIENG-9048] Cypress tests for MLMD artifacts #2987

Merged
merged 1 commit into from
Jul 10, 2024
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
345 changes: 345 additions & 0 deletions frontend/src/__mocks__/mlmd/mockGetArtifacts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,345 @@
/* eslint-disable camelcase */
import { GetArtifactsResponse, GetArtifactsByIDResponse } from '~/__mocks__/third_party/mlmd';
import createGrpcResponse, { GrpcResponse } from './utils';

export const mockedArtifactsResponse: GetArtifactsResponse = {
artifacts: [
{
id: 1,
typeId: 14,
type: 'system.Metrics',
uri: 's3://scalar-metrics-uri',
properties: {},
customProperties: {
accuracy: { doubleValue: 92 },
display_name: { stringValue: 'scalar metrics' },
},
state: 2,
createTimeSinceEpoch: 1611399342384,
lastUpdateTimeSinceEpoch: 1611399342384,
},
{
id: 2,
typeId: 16,
type: 'system.Dataset',
uri: 's3://dataset-uri',
properties: {},
customProperties: { display_name: { stringValue: 'dataset' } },
state: 2,
createTimeSinceEpoch: 1611399342384,
lastUpdateTimeSinceEpoch: 1611399342384,
},
{
id: 3,
typeId: 15,
type: 'system.ClassificationMetrics',
uri: 's3://confidence-metrics-uri',
properties: {},
customProperties: {
confidenceMetrics: {
structValue: {
fields: {
list: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
listValue: {
valuesList: [
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
confidenceThreshold: {
nullValue: 0,
numberValue: 2,
stringValue: '',
boolValue: false,
},

falsePositiveRate: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
},

recall: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
},
},
},
},
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
confidenceThreshold: {
nullValue: 0,
numberValue: 1,
stringValue: '',
boolValue: false,
},

falsePositiveRate: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
},

recall: {
nullValue: 0,
numberValue: 0.33962264150943394,
stringValue: '',
boolValue: false,
},
},
},
},
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
confidenceThreshold: {
nullValue: 0,
numberValue: 0.9,
stringValue: '',
boolValue: false,
},
falsePositiveRate: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
},
recall: {
nullValue: 0,
numberValue: 0.6037735849056604,
stringValue: '',
boolValue: false,
},
},
},
},
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
confidenceThreshold: {
nullValue: 0,
numberValue: 0.8,
stringValue: '',
boolValue: false,
},
falsePositiveRate: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
},
recall: {
nullValue: 0,
numberValue: 0.8490566037735849,
stringValue: '',
boolValue: false,
},
},
},
},
],
},
},
},
},
},
display_name: { stringValue: 'confidence metrics' },
},
state: 2,
createTimeSinceEpoch: 1611399342384,
lastUpdateTimeSinceEpoch: 1611399342384,
},
{
id: 4,
typeId: 15,
type: 'system.ClassificationMetrics',
uri: 's3://confusion-matrix-uri',
properties: {},
customProperties: {
confusionMatrix: {
structValue: {
fields: {
struct: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
annotationSpecs: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
listValue: {
valuesList: [
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
displayName: {
nullValue: 0,
numberValue: 0,
stringValue: 'Setosa',
boolValue: false,
},
},
},
},
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
displayName: {
nullValue: 0,
numberValue: 0,
stringValue: 'Versicolour',
boolValue: false,
},
},
},
},
],
},
},
rows: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
listValue: {
valuesList: [
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
row: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
listValue: {
valuesList: [
{
nullValue: 0,
numberValue: 37,
stringValue: '',
boolValue: false,
},
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
},
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
},
],
},
},
},
},
},
{
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
structValue: {
fields: {
row: {
nullValue: 0,
numberValue: 0,
stringValue: '',
boolValue: false,
listValue: {
valuesList: [
{
nullValue: 0,
numberValue: 15,
stringValue: '',
boolValue: false,
},
{
nullValue: 0,
numberValue: 7,
stringValue: '',
boolValue: false,
},
{
nullValue: 0,
numberValue: 11,
stringValue: '',
boolValue: false,
},
],
},
},
},
},
},
],
},
},
},
},
},
},
},
},
display_name: { stringValue: 'confusion matrix' },
},
state: 2,
createTimeSinceEpoch: 1611399342384,
lastUpdateTimeSinceEpoch: 1611399342384,
},
],
};

export const mockGetArtifactsById = (response: GetArtifactsByIDResponse): GrpcResponse => {
const binary = GetArtifactsByIDResponse.encode(response).finish();
return createGrpcResponse(binary);
};

export const mockGetArtifactsResponse = (response: GetArtifactsResponse): GrpcResponse => {
const binary = GetArtifactsResponse.encode(response).finish();
return createGrpcResponse(binary);
};
Loading
Loading