-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2787 from jpuzz0/RHOAIENG-4825-input-output-mlmd-…
…params [RHOAIENG-4825] Use execution input/output values as fallback for run node details
- Loading branch information
Showing
9 changed files
with
250 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
...elines/content/pipelinesDetails/pipelineRun/__tests__/SelectedNodeInputOutputTab.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import React from 'react'; | ||
|
||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
|
||
import SelectedNodeInputOutputTab from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/SelectedNodeInputOutputTab'; | ||
import { InputDefinitionParameterType } from '~/concepts/pipelines/kfTypes'; | ||
import { Execution } from '~/third_party/mlmd'; | ||
|
||
jest.mock('~/components/MaxHeightCodeEditor', () => ({ | ||
MaxHeightCodeEditor: ({ code }: { code: string }) => JSON.stringify(JSON.parse(code)), | ||
})); | ||
|
||
describe('SelectedNodeInputOutputTab', () => { | ||
it('renders execution values for input parameters', async () => { | ||
render( | ||
<SelectedNodeInputOutputTab | ||
task={{ | ||
type: 'groupTask', | ||
name: 'task-1', | ||
inputs: { | ||
params: taskParams, | ||
}, | ||
}} | ||
execution={ | ||
{ | ||
customPropertiesMap: [ | ||
[ | ||
'inputs', | ||
{ | ||
structValue: { | ||
fieldsMap: executionFieldsMap, | ||
}, | ||
}, | ||
], | ||
], | ||
} as unknown as Execution.AsObject | ||
} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText('Some string')).toBeVisible(); | ||
expect(screen.getByText('No value')).toBeVisible(); | ||
expect(screen.getByText('{"some":"stringObject"}')).toBeVisible(); | ||
expect(screen.getByText('1')).toBeVisible(); | ||
expect(screen.getByText('12.15')).toBeVisible(); | ||
expect(screen.getByText('True')).toBeVisible(); | ||
expect(screen.getByText('{"some":"object"}')).toBeVisible(); | ||
expect(screen.getByText('[{"list":"item-1"},{"list":"item-2"}]')).toBeVisible(); | ||
}); | ||
|
||
it('renders execution values for output parameters', async () => { | ||
render( | ||
<SelectedNodeInputOutputTab | ||
task={{ | ||
type: 'groupTask', | ||
name: 'task-1', | ||
outputs: { | ||
params: taskParams, | ||
}, | ||
}} | ||
execution={ | ||
{ | ||
customPropertiesMap: [ | ||
[ | ||
'outputs', | ||
{ | ||
structValue: { | ||
fieldsMap: executionFieldsMap, | ||
}, | ||
}, | ||
], | ||
], | ||
} as unknown as Execution.AsObject | ||
} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText('Some string')).toBeVisible(); | ||
expect(screen.getByText('No value')).toBeVisible(); | ||
expect(screen.getByText('{"some":"stringObject"}')).toBeVisible(); | ||
expect(screen.getByText('1')).toBeVisible(); | ||
expect(screen.getByText('12.15')).toBeVisible(); | ||
expect(screen.getByText('True')).toBeVisible(); | ||
expect(screen.getByText('{"some":"object"}')).toBeVisible(); | ||
expect(screen.getByText('[{"list":"item-1"},{"list":"item-2"}]')).toBeVisible(); | ||
}); | ||
}); | ||
|
||
const taskParams = [ | ||
{ label: 'param-string-1', type: InputDefinitionParameterType.STRING }, | ||
{ label: 'param-string-2', type: InputDefinitionParameterType.STRING }, | ||
{ label: 'param-string-3', type: InputDefinitionParameterType.STRING }, | ||
{ label: 'param-string-4', type: InputDefinitionParameterType.STRING }, | ||
{ label: 'param-int', type: InputDefinitionParameterType.INTEGER }, | ||
{ label: 'param-double', type: InputDefinitionParameterType.DOUBLE }, | ||
{ label: 'param-bool', type: InputDefinitionParameterType.BOOLEAN }, | ||
{ label: 'param-struct', type: InputDefinitionParameterType.STRUCT }, | ||
{ label: 'param-list', type: InputDefinitionParameterType.LIST }, | ||
]; | ||
|
||
const executionFieldsMap = [ | ||
['param-string-1', { stringValue: 'Some string' }], | ||
['param-string-2', { stringValue: '' }], | ||
['param-string-3', { stringValue: '10.10' }], | ||
['param-string-4', { stringValue: '{"some":"stringObject"}' }], | ||
['param-int', { numberValue: 1 }], | ||
['param-double', { numberValue: 12.15 }], | ||
['param-bool', { boolValue: true }], | ||
[ | ||
'param-struct', | ||
{ | ||
structValue: { some: 'object' }, | ||
}, | ||
], | ||
[ | ||
'param-list', | ||
{ | ||
listValue: [{ list: 'item-1' }, { list: 'item-2' }], | ||
}, | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters