-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds more identifying information for node executions (#70)
* feat: show workflow node name beneath node execution ids * feat: updating DetailsPanel info for NodeExecutions * fix lint errors * adding tests for new formatter function * test: adding new test for NodeExecutionDetails * test: adding test for new code in NodeExecutionsTable
- Loading branch information
Showing
10 changed files
with
222 additions
and
34 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
45 changes: 45 additions & 0 deletions
45
src/components/Executions/ExecutionDetails/test/NodeExecutionDetails.test.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,45 @@ | ||
import { render, waitFor } from '@testing-library/react'; | ||
import { mockAPIContextValue } from 'components/data/__mocks__/apiContext'; | ||
import { APIContext } from 'components/data/apiContext'; | ||
import { | ||
DetailedNodeExecution, | ||
NodeExecutionDisplayType | ||
} from 'components/Executions/types'; | ||
import { createMockNodeExecutions } from 'models/Execution/__mocks__/mockNodeExecutionsData'; | ||
import { listTaskExecutions } from 'models/Execution/api'; | ||
import * as React from 'react'; | ||
import { NodeExecutionDetails } from '../NodeExecutionDetails'; | ||
|
||
describe('NodeExecutionDetails', () => { | ||
let execution: DetailedNodeExecution; | ||
let mockListTaskExecutions: jest.Mock<ReturnType< | ||
typeof listTaskExecutions | ||
>>; | ||
beforeEach(() => { | ||
const { executions } = createMockNodeExecutions(1); | ||
execution = { | ||
...executions[0], | ||
displayType: NodeExecutionDisplayType.PythonTask, | ||
displayId: 'com.flyte.testTask', | ||
cacheKey: 'abcdefg' | ||
}; | ||
mockListTaskExecutions = jest.fn().mockResolvedValue({ entities: [] }); | ||
}); | ||
|
||
const renderComponent = () => | ||
render( | ||
<APIContext.Provider | ||
value={mockAPIContextValue({ | ||
listTaskExecutions: mockListTaskExecutions | ||
})} | ||
> | ||
<NodeExecutionDetails execution={execution} /> | ||
</APIContext.Provider> | ||
); | ||
|
||
it('renders displayId', async () => { | ||
const { queryByText } = renderComponent(); | ||
await waitFor(() => {}); | ||
expect(queryByText(execution.displayId)).toBeInTheDocument(); | ||
}); | ||
}); |
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
76 changes: 76 additions & 0 deletions
76
src/components/Executions/Tables/test/NodeExecutionsTable.test.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,76 @@ | ||
import { render, waitFor } from '@testing-library/react'; | ||
import { mapNodeExecutionDetails } from 'components'; | ||
import { mockAPIContextValue } from 'components/data/__mocks__/apiContext'; | ||
import { APIContext } from 'components/data/apiContext'; | ||
import { DetailedNodeExecution } from 'components/Executions/types'; | ||
import { | ||
createMockWorkflow, | ||
createMockWorkflowClosure | ||
} from 'models/__mocks__/workflowData'; | ||
import { createMockNodeExecutions } from 'models/Execution/__mocks__/mockNodeExecutionsData'; | ||
import { listTaskExecutions } from 'models/Execution/api'; | ||
import { mockTasks } from 'models/Task/__mocks__/mockTaskData'; | ||
import * as React from 'react'; | ||
import { | ||
NodeExecutionsTable, | ||
NodeExecutionsTableProps | ||
} from '../NodeExecutionsTable'; | ||
|
||
describe('NodeExecutionsTable', () => { | ||
let props: NodeExecutionsTableProps; | ||
let mockNodeExecutions: DetailedNodeExecution[]; | ||
let mockListTaskExecutions: jest.Mock<ReturnType< | ||
typeof listTaskExecutions | ||
>>; | ||
|
||
beforeEach(() => { | ||
mockListTaskExecutions = jest.fn().mockResolvedValue({ entities: [] }); | ||
const { | ||
executions: mockExecutions, | ||
nodes: mockNodes | ||
} = createMockNodeExecutions(1); | ||
|
||
const mockWorkflow = createMockWorkflow('SampleWorkflow'); | ||
const mockWorkflowClosure = createMockWorkflowClosure(); | ||
const compiledWorkflow = mockWorkflowClosure.compiledWorkflow!; | ||
const { | ||
primary: { template }, | ||
tasks | ||
} = compiledWorkflow; | ||
template.nodes = template.nodes.concat(mockNodes); | ||
compiledWorkflow.tasks = tasks.concat(mockTasks); | ||
mockWorkflow.closure = mockWorkflowClosure; | ||
|
||
mockNodeExecutions = mapNodeExecutionDetails( | ||
mockExecutions, | ||
mockWorkflow | ||
); | ||
|
||
props = { | ||
value: mockNodeExecutions, | ||
lastError: null, | ||
loading: false, | ||
moreItemsAvailable: false, | ||
fetch: jest.fn() | ||
}; | ||
}); | ||
|
||
const renderTable = () => | ||
render( | ||
<APIContext.Provider | ||
value={mockAPIContextValue({ | ||
listTaskExecutions: mockListTaskExecutions | ||
})} | ||
> | ||
<NodeExecutionsTable {...props} /> | ||
</APIContext.Provider> | ||
); | ||
|
||
it('renders displayId for nodes', async () => { | ||
const { queryByText } = renderTable(); | ||
await waitFor(() => {}); | ||
|
||
const node = mockNodeExecutions[0]; | ||
expect(queryByText(node.displayId)).toBeInTheDocument(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"allowJs": true, | ||
"baseUrl": "src", | ||
"checkJs": false, | ||
"downlevelIteration": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"importHelpers": true, | ||
"jsx": "react", | ||
"lib": ["es2015", "es2017", "dom", "dom.iterable"], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"outDir": "./dist", | ||
"removeComments": false, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"target": "es6", | ||
"types": ["node", "webpack-env", "jest"] | ||
} | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"allowJs": true, | ||
"baseUrl": "src", | ||
"checkJs": false, | ||
"downlevelIteration": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"importHelpers": true, | ||
"jsx": "react", | ||
"lib": ["es2015", "es2017", "dom", "dom.iterable"], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"outDir": "./dist", | ||
"removeComments": false, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"target": "es6", | ||
"types": ["node", "webpack-env", "jest"] | ||
} | ||
} |