Skip to content

Commit

Permalink
added pipeline execution tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rsun19 committed Jun 28, 2024
1 parent ddf74d4 commit 7266d58
Show file tree
Hide file tree
Showing 6 changed files with 664 additions and 1 deletion.
346 changes: 346 additions & 0 deletions frontend/src/__mocks__/mlmd/mockGetExecutions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
/* eslint-disable camelcase */
import { GetExecutionsResponse } from '~/__mocks__/third_party/mlmd';
import createGrpcResponse, { GrpcResponse } from './utils';

const mockedGetNoExecutions: GetExecutionsResponse = {
executions: [],
};

const mockedGetExecutions: GetExecutionsResponse = {
executions: [
{
id: 287,
name: 'run/c7ea4e4f-f2f3-4ecf-9379-a9441a243887',
typeId: 12,
type: 'system.DAGExecution',
lastKnownState: 2,
createTimeSinceEpoch: 1712899519170,
lastUpdateTimeSinceEpoch: 1712899519170,
properties: {},
customProperties: {
display_name: {
stringValue: '',
},
task_name: {
stringValue: '',
},
},
},
{
id: 288,
typeId: 13,
type: 'system.ContainerExecution',
lastKnownState: 5,
createTimeSinceEpoch: 1712899528735,
lastUpdateTimeSinceEpoch: 1712899529361,
properties: {},
customProperties: {
cache_fingerprint: {
stringValue: '7c3190be2e584610488d53da68e945b703d90753bf0cfade5b3cfe395d7f5c20',
},
cached_execution_id: {
stringValue: '211',
},
display_name: {
stringValue: 'digit-classification',
},
image: {
stringValue: '',
},
inputs: {
structValue: {
fields: {},
},
},
namespace: {
stringValue: '',
},
outputs: {
structValue: {
fields: {},
},
},
parent_dag_id: {
intValue: 287,
},
pod_name: {
stringValue: '',
},
pod_uid: {
stringValue: '',
},
task_name: {
stringValue: 'digit-classification',
},
},
},
{
id: 289,
typeId: 13,
type: 'system.ContainerExecution',
lastKnownState: 5,
createTimeSinceEpoch: 1712899529328,
lastUpdateTimeSinceEpoch: 1712899529738,
properties: {},
customProperties: {
cache_fingerprint: {
stringValue: '1122f9fda5483cc0c3dd6950514104b878f2f4f7a0cef4945ea195c0b90e0fb9',
},
cached_execution_id: {
stringValue: '201',
},
display_name: {
stringValue: 'html-visualization',
},
image: {
stringValue: '',
},
inputs: {
structValue: {
fields: {},
},
},
namespace: {
stringValue: '',
},
outputs: {
structValue: {
fields: {},
},
},
parent_dag_id: {
intValue: 287,
},
pod_name: {
stringValue: '',
},
pod_uid: {
stringValue: '',
},
task_name: {
stringValue: 'html-visualization',
},
},
},
{
id: 290,
typeId: 13,
type: 'system.ContainerExecution',
lastKnownState: 5,
createTimeSinceEpoch: 1712899529332,
lastUpdateTimeSinceEpoch: 1712899529840,
properties: {},
customProperties: {
cache_fingerprint: {
stringValue: '1816513632893d5cc27a2e7cc97f77d11c479a577f5be832aa46c467d87f7b33',
},
cached_execution_id: {
stringValue: '222',
},
display_name: {
stringValue: 'wine-classification',
},
image: {
stringValue: '',
},
inputs: {
structValue: {
fields: {},
},
},
namespace: {
stringValue: '',
},
outputs: {
structValue: {
fields: {},
},
},
parent_dag_id: {
intValue: 287,
},
pod_name: {
stringValue: '',
},
pod_uid: {
stringValue: '',
},
task_name: {
stringValue: 'wine-classification',
},
},
},
{
id: 291,
typeId: 13,
type: 'system.ContainerExecution',
lastKnownState: 5,
createTimeSinceEpoch: 1712899529940,
lastUpdateTimeSinceEpoch: 1712899530046,
properties: {},
customProperties: {
cache_fingerprint: {
stringValue: 'b66ac635abe84bb9b6018e9e27a1b43ea1d214439931ec3197049ede0e07177e',
},
cached_execution_id: {
stringValue: '215',
},
display_name: {
stringValue: 'iris-sgdclassifier',
},
image: {
stringValue: '',
},
inputs: {
structValue: {
fields: {
test_samples_fraction: {
nullValue: 0,
numberValue: 0.3,
stringValue: '',
boolValue: false,
},
},
},
},
namespace: {
stringValue: '',
},
outputs: {
structValue: {
fields: {},
},
},
parent_dag_id: {
intValue: 287,
},
pod_name: {
stringValue: '',
},
pod_uid: {
stringValue: '',
},
task_name: {
stringValue: 'iris-sgdclassifier',
},
},
},
{
id: 292,
typeId: 13,
type: 'system.ContainerExecution',
lastKnownState: 5,
createTimeSinceEpoch: 1712899531539,
lastUpdateTimeSinceEpoch: 1712899531647,
properties: {},
customProperties: {
cache_fingerprint: {
stringValue: '6842ef332bd56a8e7cf55bcb002b70464102018e6d2c2360c5cc1f1587d8893f',
},
cached_execution_id: {
stringValue: '198',
},
display_name: {
stringValue: 'markdown-visualization',
},
image: {
stringValue: '',
},
inputs: {
structValue: {
fields: {},
},
},
namespace: {
stringValue: '',
},
outputs: {
structValue: {
fields: {},
},
},
parent_dag_id: {
intValue: 287,
},
pod_name: {
stringValue: '',
},
pod_uid: {
stringValue: '',
},
task_name: {
stringValue: 'markdown-visualization',
},
},
},
],
nextPageToken: 'page token',
};

const mockedGetNextPageExecutions: GetExecutionsResponse = {
executions: [
{
id: 288,
typeId: 13,
type: 'system.ContainerExecution',
lastKnownState: 5,
createTimeSinceEpoch: 1712899528735,
lastUpdateTimeSinceEpoch: 1712899529361,
properties: {},
customProperties: {
cache_fingerprint: {
stringValue: '7c3190be2e584610488d53da68e945b703d90753bf0cfade5b3cfe395d7f5c20',
},
cached_execution_id: {
stringValue: '211',
},
display_name: {
stringValue: 'digit-classification',
},
image: {
stringValue: '',
},
inputs: {
structValue: {
fields: {},
},
},
namespace: {
stringValue: '',
},
outputs: {
structValue: {
fields: {},
},
},
parent_dag_id: {
intValue: 287,
},
pod_name: {
stringValue: '',
},
pod_uid: {
stringValue: '',
},
task_name: {
stringValue: 'digit-classification',
},
},
},
],
};

export const mockGetNoExecutions = (): GrpcResponse => {
const binary = GetExecutionsResponse.encode(mockedGetNoExecutions).finish();
return createGrpcResponse(binary);
};

export const mockGetExecutions = (): GrpcResponse => {
const binary = GetExecutionsResponse.encode(mockedGetExecutions).finish();
return createGrpcResponse(binary);
};

export const mockGetNextPageExecutions = (): GrpcResponse => {
const binary = GetExecutionsResponse.encode(mockedGetNextPageExecutions).finish();
return createGrpcResponse(binary);
};
Loading

0 comments on commit 7266d58

Please sign in to comment.