Skip to content

Commit

Permalink
Merge pull request #2961 from dpanshug/job-rename
Browse files Browse the repository at this point in the history
[RHOAIENG-4334] 'Job' Name (in code) alignment
  • Loading branch information
openshift-merge-bot[bot] authored Jul 5, 2024
2 parents 1d3463c + 4532049 commit b77c9bd
Show file tree
Hide file tree
Showing 60 changed files with 767 additions and 661 deletions.
2 changes: 1 addition & 1 deletion frontend/src/__mocks__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export * from './mockProjectK8sResource';
export * from './mockRouteK8sResource';
export * from './mockStatus';
export * from './mockRunKF';
export * from './mockJobKF';
export * from './mockRecurringRunKF';
export * from './mockExperimentKF';
export * from './mockPipelineVersionsProxy';
export * from './mockPipelinesProxy';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/* eslint-disable camelcase */
import {
PipelineRunJobKFv2,
PipelineRecurringRunKFv2,
RecurringRunMode,
RecurringRunStatus,
} from '~/concepts/pipelines/kfTypes';

export const buildMockJobKF = (job?: Partial<PipelineRunJobKFv2>): PipelineRunJobKFv2 => ({
recurring_run_id: 'test-job',
display_name: 'Test job',
export const buildMockRecurringRunKF = (
recurringRun?: Partial<PipelineRecurringRunKFv2>,
): PipelineRecurringRunKFv2 => ({
recurring_run_id: 'test-recurring-run',
display_name: 'Test recurring run',
pipeline_version_reference: {
pipeline_id: '3195ec84-69d1-4c10-b8ac-6e2334319444',
pipeline_version_id: '29d12191-3a34-4e2a-b05f-6224b6fa7de8',
Expand All @@ -34,5 +36,5 @@ export const buildMockJobKF = (job?: Partial<PipelineRunJobKFv2>): PipelineRunJo
status: RecurringRunStatus.ENABLED,
namespace: 'jps-fun-world',
experiment_id: 'f1353050-6b31-424d-859e-1fd95feb2cb8',
...job,
...recurringRun,
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
ExperimentKFv2,
PipelineKFv2,
PipelineRunJobKFv2,
PipelineRecurringRunKFv2,
PipelineRunKFv2,
PipelineVersionKFv2,
} from '~/concepts/pipelines/kfTypes';
Expand All @@ -24,7 +24,7 @@ class CloneRunPage extends CreateRunPage {
);
}

mockGetRecurringRun(namespace: string, recurringRun: PipelineRunJobKFv2) {
mockGetRecurringRun(namespace: string, recurringRun: PipelineRecurringRunKFv2) {
return cy.interceptOdh(
'GET /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns/:recurringRunId',
{ path: { namespace, serviceName: 'dspa', recurringRunId: recurringRun.recurring_run_id } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import type {
ExperimentKFv2,
PipelineKFv2,
PipelineRunJobKFv2,
PipelineRecurringRunKFv2,
PipelineRunKFv2,
PipelineVersionKFv2,
} from '~/concepts/pipelines/kfTypes';
import { buildMockExperiments, buildMockJobKF, buildMockRunKF } from '~/__mocks__';
import { buildMockExperiments, buildMockRunKF } from '~/__mocks__';
import { buildMockPipelines } from '~/__mocks__/mockPipelinesProxy';
import { buildMockPipelineVersionsV2 } from '~/__mocks__/mockPipelineVersionsProxy';
import { Contextual } from '~/__tests__/cypress/cypress/pages/components/Contextual';
import { buildMockRecurringRunKF } from '~/__mocks__/mockRecurringRunKF';

class ParamsSection extends Contextual<HTMLElement> {
findParamById(id: string): Cypress.Chainable<JQuery<HTMLElement>> {
Expand Down Expand Up @@ -222,7 +223,7 @@ export class CreateRunPage {
mockCreateRecurringRun(
namespace: string,
pipelineVersion: PipelineVersionKFv2,
{ recurring_run_id, ...recurringRun }: Partial<PipelineRunJobKFv2>,
{ recurring_run_id, ...recurringRun }: Partial<PipelineRecurringRunKFv2>,
): Cypress.Chainable<null> {
return cy.interceptOdh(
'POST /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns',
Expand All @@ -242,7 +243,7 @@ export class CreateRunPage {
expect(JSON.stringify(req.body.runtime_config)).to.equal(
JSON.stringify(recurringRun.runtime_config),
);
req.reply(buildMockJobKF({ ...data, recurring_run_id }));
req.reply(buildMockRecurringRunKF({ ...data, recurring_run_id }));
},
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ManageRunsRow extends TableRow {
}

findStatusSwitchByRowName() {
return this.find().findByTestId('job-status-switch');
return this.find().findByTestId('recurring-run-status-switch');
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable camelcase */
import type { PipelineRunJobKFv2, PipelineRunKFv2 } from '~/concepts/pipelines/kfTypes';
import type { PipelineRecurringRunKFv2, PipelineRunKFv2 } from '~/concepts/pipelines/kfTypes';
import { TableRow } from '~/__tests__/cypress/cypress/pages/components/table';

class PipelineRunsRow extends TableRow {
Expand All @@ -19,9 +19,9 @@ class PipelineRunTableRow extends PipelineRunsRow {
}
}

class PipelineRunJobTableRow extends PipelineRunsRow {
class PipelineRecurringRunTableRow extends PipelineRunsRow {
findStatusSwitchByRowName() {
return this.find().findByTestId('job-status-switch');
return this.find().findByTestId('recurring-run-status-switch');
}
}

Expand Down Expand Up @@ -143,13 +143,13 @@ class ArchivedRunsTable extends PipelineRunsTable {
}
}

class PipelineRunJobTable extends PipelineRunsTable {
class PipelineRecurringRunTable extends PipelineRunsTable {
constructor() {
super('schedules');
}

getRowByName(name: string) {
return new PipelineRunJobTableRow(() =>
return new PipelineRecurringRunTableRow(() =>
this.find().find(`[data-label=Name]`).contains(name).parents('tr'),
);
}
Expand All @@ -173,41 +173,45 @@ class PipelineRunJobTable extends PipelineRunsTable {
return cy.findByTestId('experiment-search-select');
}

mockGetJobs(jobs: PipelineRunJobKFv2[], namespace: string) {
mockGetRecurringRuns(recurringRuns: PipelineRecurringRunKFv2[], namespace: string) {
return cy.interceptOdh(
'GET /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns',
{ path: { namespace, serviceName: 'dspa' } },
{ recurringRuns: jobs, total_size: jobs.length },
{ recurringRuns, total_size: recurringRuns.length },
);
}

mockGetJob(job: PipelineRunJobKFv2, namespace: string) {
mockGetRecurringRun(recurringRun: PipelineRecurringRunKFv2, namespace: string) {
return cy.interceptOdh(
'GET /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns/:recurringRunId',
{ path: { namespace, serviceName: 'dspa', recurringRunId: job.recurring_run_id } },
job,
{ path: { namespace, serviceName: 'dspa', recurringRunId: recurringRun.recurring_run_id } },
recurringRun,
);
}

mockEnableJob(job: PipelineRunJobKFv2, namespace: string) {
mockEnableRecurringRun(recurringRun: PipelineRecurringRunKFv2, namespace: string) {
return cy.interceptOdh(
'POST /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns/:recurringRunId',
{
path: {
namespace,
serviceName: 'dspa',
recurringRunId: `${job.recurring_run_id}:'enable'`,
recurringRunId: `${recurringRun.recurring_run_id}:'enable'`,
},
},
{},
);
}

mockDisableJob(job: PipelineRunJobKFv2, namespace: string) {
mockDisableRecurringRun(recurringRun: PipelineRecurringRunKFv2, namespace: string) {
return cy.interceptOdh(
'POST /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns/:recurringRunId',
{
path: { namespace, serviceName: 'dspa', recurringRunId: `${job.recurring_run_id}:disable` },
path: {
namespace,
serviceName: 'dspa',
recurringRunId: `${recurringRun.recurring_run_id}:disable`,
},
},
{},
);
Expand All @@ -216,4 +220,4 @@ class PipelineRunJobTable extends PipelineRunsTable {

export const activeRunsTable = new ActiveRunsTable();
export const archivedRunsTable = new ArchivedRunsTable();
export const pipelineRunJobTable = new PipelineRunJobTable();
export const pipelineRecurringRunTable = new PipelineRecurringRunTable();
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ class PipelineDetails extends PipelinesTopology {
}
}

class PipelineRunJobDetails extends RunDetails {
class PipelineRecurringRunDetails extends RunDetails {
visit(namespace: string, pipelineId: string) {
cy.visitWithLogin(`/pipelines/${namespace}/pipelineRunJob/view/${pipelineId}`);
cy.visitWithLogin(`/pipelines/${namespace}/pipelineRecurringRun/view/${pipelineId}`);
this.wait();
}

findActionsDropdown() {
return cy.findByTestId('pipeline-run-job-details-actions');
return cy.findByTestId('pipeline-recurring-run-details-actions');
}

selectActionDropdownItem(label: string) {
Expand Down Expand Up @@ -259,5 +259,5 @@ class PipelineRunDetails extends RunDetails {

export const pipelineDetails = new PipelineDetails();
export const pipelineRunDetails = new PipelineRunDetails();
export const pipelineRunJobDetails = new PipelineRunJobDetails();
export const pipelineRecurringRunDetails = new PipelineRecurringRunDetails();
export const pipelinesTopology = new PipelinesTopology();
10 changes: 5 additions & 5 deletions frontend/src/__tests__/cypress/cypress/support/commands/odh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ import type {
ExperimentKFv2,
GoogleRpcStatusKF,
ListExperimentsResponseKF,
ListPipelineRunJobsResourceKF,
ListPipelineRecurringRunsResourceKF,
ListPipelineRunsResourceKF,
ListPipelineVersionsKF,
ListPipelinesResponseKF,
PipelineKFv2,
PipelineRunJobKFv2,
PipelineRecurringRunKFv2,
PipelineRunKFv2,
PipelineVersionKFv2,
} from '~/concepts/pipelines/kfTypes';
Expand Down Expand Up @@ -403,7 +403,7 @@ declare global {
((
type: `GET /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns/:recurringRunId`,
options: { path: { namespace: string; serviceName: string; recurringRunId: string } },
response: OdhResponse<PipelineRunJobKFv2>,
response: OdhResponse<PipelineRecurringRunKFv2>,
) => Cypress.Chainable<null>) &
((
type: `DELETE /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns/:recurringRunId`,
Expand Down Expand Up @@ -463,12 +463,12 @@ declare global {
((
type: `POST /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns`,
options: { path: { namespace: string; serviceName: string }; times?: number },
response: OdhResponse<PipelineRunJobKFv2>,
response: OdhResponse<PipelineRecurringRunKFv2>,
) => Cypress.Chainable<null>) &
((
type: `GET /api/service/pipelines/:namespace/:serviceName/apis/v2beta1/recurringruns`,
options: { path: { namespace: string; serviceName: string } },
response: OdhResponse<ListPipelineRunJobsResourceKF>,
response: OdhResponse<ListPipelineRecurringRunsResourceKF>,
) => Cypress.Chainable<null>) &
((
type: `POST /api/service/mlmd/:namespace/:serviceName/ml_metadata.MetadataStoreService/GetArtifactTypes`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {
mockProjectK8sResource,
mockRouteK8sResource,
buildMockRunKF,
buildMockJobKF,
buildMockRecurringRunKF,
} from '~/__mocks__';
import {
archivedRunsTable,
archiveExperimentModal,
bulkArchiveExperimentModal,
bulkRestoreExperimentModal,
pipelineRunJobTable,
pipelineRecurringRunTable,
pipelineRunsGlobal,
restoreExperimentModal,
} from '~/__tests__/cypress/cypress/pages/pipelines';
Expand Down Expand Up @@ -301,7 +301,7 @@ describe('Runs page for archived experiment', () => {
{
path: { namespace: projectName, serviceName: 'dspa' },
},
{ recurringRuns: [buildMockJobKF({ status: RecurringRunStatus.DISABLED })] },
{ recurringRuns: [buildMockRecurringRunKF({ status: RecurringRunStatus.DISABLED })] },
);
experimentsTabs.mockGetExperiments(projectName, [], mockExperiments);
experimentsTabs.visit(projectName);
Expand All @@ -327,7 +327,7 @@ describe('Runs page for archived experiment', () => {

it('has no create schedule button on schedules tab', () => {
pipelineRunsGlobal.findSchedulesTab().click();
pipelineRunJobTable.getRowByName('Test job').findCheckbox().click();
pipelineRecurringRunTable.getRowByName('Test recurring run').findCheckbox().click();
pipelineRunsGlobal.findScheduleRunButton().should('not.exist');
});
});
Expand Down
Loading

0 comments on commit b77c9bd

Please sign in to comment.