-
Notifications
You must be signed in to change notification settings - Fork 178
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 #1837 from Gkrumbach07/pipeline-runs
Add details view for pipeline jobs
- Loading branch information
Showing
18 changed files
with
629 additions
and
141 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
57 changes: 57 additions & 0 deletions
57
frontend/src/__mocks__/mockDataSciencePipelinesApplicationK8sResource.ts
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,57 @@ | ||
import { DSPipelineKind } from '~/k8sTypes'; | ||
|
||
type MockResourceConfigType = { | ||
name?: string; | ||
namespace?: string; | ||
displayName?: string; | ||
}; | ||
|
||
export const mockDataSciencePipelineApplicationK8sResource = ({ | ||
namespace = 'test-project', | ||
}: MockResourceConfigType): DSPipelineKind => ({ | ||
apiVersion: 'datasciencepipelinesapplications.opendatahub.io/v1alpha1', | ||
kind: 'DataSciencePipelinesApplication', | ||
metadata: { | ||
name: 'pipelines-definition', | ||
namespace: namespace, | ||
}, | ||
spec: { | ||
apiServer: { | ||
enableSamplePipeline: false, | ||
}, | ||
database: { | ||
mariaDB: { | ||
pipelineDBName: 'mlpipeline', | ||
username: 'mlpipeline', | ||
}, | ||
}, | ||
objectStorage: { | ||
externalStorage: { | ||
bucket: 'test-pipelines-bucket', | ||
host: 's3.amazonaws.com', | ||
port: '', | ||
s3CredentialsSecret: { | ||
accessKey: 'AWS_ACCESS_KEY_ID', | ||
secretKey: 'AWS_SECRET_ACCESS_KEY', | ||
secretName: 'aws-connection-testdb', | ||
}, | ||
scheme: 'https', | ||
}, | ||
}, | ||
persistenceAgent: { | ||
deploy: true, | ||
numWorkers: 2, | ||
}, | ||
}, | ||
status: { | ||
conditions: [ | ||
{ | ||
lastTransitionTime: '2023-07-20T16:58:12Z', | ||
message: '', | ||
reason: 'MinimumReplicasAvailable', | ||
status: 'True', | ||
type: 'APIServerReady', | ||
}, | ||
], | ||
}, | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
frontend/src/__tests__/integration/pages/pipelines/PipelineRunJobDetails.spec.ts
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,31 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('Does not show run content', async ({ page }) => { | ||
await page.goto( | ||
'./iframe.html?args=&id=tests-integration-pages-pipelines-pipelinerunjobdetails--default&viewMode=story', | ||
); | ||
|
||
// wait for page to load | ||
await page.waitForSelector('text=test-pipeline-run-job-id'); | ||
|
||
// expect run output tab not to be visible | ||
await expect(page.getByText('Run Output')).toHaveCount(0); | ||
|
||
// expect input parameters tab to be visible | ||
await expect(page.getByText('Input parameters')).toHaveCount(1); | ||
|
||
// expect output parameters tab to be visible | ||
await expect(page.getByText('Details')).toHaveCount(1); | ||
await expect(page.getByText('Started at')).toHaveCount(0); | ||
await expect(page.getByText('Finished at')).toHaveCount(0); | ||
await expect(page.getByText('Duration')).toHaveCount(0); | ||
|
||
// cannot stop a scheduled job | ||
await page.getByRole('button', { name: 'Actions' }).click(); | ||
const dropdown = page.getByRole('menu', { name: 'Actions' }); | ||
await expect(dropdown.getByText('Stop run')).toHaveCount(0); | ||
|
||
// expect nodes dont open drawer on click | ||
await page.getByText('flip-coin').click(); | ||
await expect(page.getByTestId('pipeline-run-drawer-right-content')).toHaveCount(1); | ||
}); |
98 changes: 98 additions & 0 deletions
98
frontend/src/__tests__/integration/pages/pipelines/PipelineRunJobDetails.stories.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,98 @@ | ||
import React from 'react'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { Route, Routes } from 'react-router-dom'; | ||
import { rest } from 'msw'; | ||
import { within } from '@storybook/testing-library'; | ||
import PipelineRunJobDetails from '~/concepts/pipelines/content/pipelinesDetails/pipelineRunJob/PipelineRunJobDetails'; | ||
import GlobalPipelineCoreDetails from '~/pages/pipelines/global/GlobalPipelineCoreDetails'; | ||
import { mockK8sResourceList } from '~/__mocks__/mockK8sResourceList'; | ||
import { mockProjectK8sResource } from '~/__mocks__/mockProjectK8sResource'; | ||
import { mockNotebookK8sResource } from '~/__mocks__/mockNotebookK8sResource'; | ||
import GlobalPipelineCoreLoader from '~/pages/pipelines/global/GlobalPipelineCoreLoader'; | ||
import { mockDataSciencePipelineApplicationK8sResource } from '~/__mocks__/mockDataSciencePipelinesApplicationK8sResource'; | ||
import { mockSecretK8sResource } from '~/__mocks__/mockSecretK8sResource'; | ||
import { mockRouteK8sResource } from '~/__mocks__/mockRouteK8sResource'; | ||
import { mockPipelinesJobProxy } from '~/__mocks__/mockPipelinesJobProxy'; | ||
|
||
export default { | ||
component: PipelineRunJobDetails, | ||
parameters: { | ||
reactRouter: { | ||
routePath: '/pipelineRuns/:namespace/pipelineRunJob/view/:pipelineRunJobId/*', | ||
routeParams: { namespace: 'test-project', pipelineRunJobId: 'test-pipeline-run-job' }, | ||
}, | ||
msw: { | ||
handlers: [ | ||
rest.post('/api/proxy/apis/v1beta1/jobs/test-pipeline-run-job', (req, res, ctx) => | ||
res( | ||
ctx.json( | ||
mockPipelinesJobProxy({ | ||
name: 'test-pipeline-run-job', | ||
id: 'test-pipeline-run-job-id', | ||
}), | ||
), | ||
), | ||
), | ||
rest.get( | ||
'/api/k8s/apis/route.openshift.io/v1/namespaces/test-project/routes/ds-pipeline-pipelines-definition', | ||
(req, res, ctx) => | ||
res( | ||
ctx.json(mockRouteK8sResource({ notebookName: 'ds-pipeline-pipelines-definition' })), | ||
), | ||
), | ||
rest.get( | ||
'/api/k8s/api/v1/namespaces/test-project/secrets/ds-pipeline-config', | ||
(req, res, ctx) => res(ctx.json(mockSecretK8sResource({ name: 'ds-pipeline-config' }))), | ||
), | ||
rest.get( | ||
'/api/k8s/api/v1/namespaces/test-project/secrets/aws-connection-testdb', | ||
(req, res, ctx) => | ||
res(ctx.json(mockSecretK8sResource({ name: 'aws-connection-testdb' }))), | ||
), | ||
rest.get( | ||
'api/k8s/apis/datasciencepipelinesapplications.opendatahub.io/v1alpha1/namespaces/test-project/datasciencepipelinesapplications/pipelines-definition', | ||
(req, res, ctx) => res(ctx.json(mockDataSciencePipelineApplicationK8sResource({}))), | ||
), | ||
rest.get( | ||
'/api/k8s/apis/kubeflow.org/v1/namespaces/test-project/notebooks', | ||
(req, res, ctx) => res(ctx.json(mockK8sResourceList([mockNotebookK8sResource({})]))), | ||
), | ||
rest.get('/api/k8s/apis/project.openshift.io/v1/projects', (req, res, ctx) => | ||
res(ctx.json(mockK8sResourceList([mockProjectK8sResource({})]))), | ||
), | ||
], | ||
}, | ||
}, | ||
} as Meta<typeof PipelineRunJobDetails>; | ||
|
||
export const Default: StoryObj = { | ||
render: () => ( | ||
<Routes> | ||
<Route | ||
path="/:namespace?/*" | ||
element={ | ||
<GlobalPipelineCoreLoader | ||
title={'Test Pipeline'} | ||
getInvalidRedirectPath={(namespace) => `/pipelineRuns/${namespace}`} | ||
/> | ||
} | ||
> | ||
<Route | ||
path="*" | ||
element={ | ||
<GlobalPipelineCoreDetails | ||
BreadcrumbDetailsComponent={PipelineRunJobDetails} | ||
pageName="Runs" | ||
redirectPath={(namespace) => `/pipelineRuns/${namespace}`} | ||
/> | ||
} | ||
/> | ||
</Route> | ||
</Routes> | ||
), | ||
play: async ({ canvasElement }) => { | ||
// load page and wait until settled | ||
const canvas = within(canvasElement); | ||
await canvas.findByText('test-pipeline-run-job-id', undefined, { timeout: 5000 }); | ||
}, | ||
}; |
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
Oops, something went wrong.