Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEN-658: Update the ingestion schedular with new design #17990

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d9f5e15
Update the cron-editor form to implement new design
aniketkatkar97 Sep 25, 2024
d41e553
localization changes
aniketkatkar97 Sep 25, 2024
a26382e
Refactor the CronEditor component
aniketkatkar97 Sep 26, 2024
646b358
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 10, 2024
e4409d1
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 10, 2024
3b48cbb
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 11, 2024
6610dc4
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 15, 2024
f4b1978
Improvements and bug fixes for CronEditor
aniketkatkar97 Oct 15, 2024
50ffaed
localization and license header changes
aniketkatkar97 Oct 15, 2024
338c73f
Fix the type errors
aniketkatkar97 Oct 15, 2024
1d4d05a
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 15, 2024
5a69d66
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 15, 2024
cd25c12
Move the CronEditor component logic to ScheduleInterval
aniketkatkar97 Oct 16, 2024
1171e74
Fix schedular for the test suite ingestion
aniketkatkar97 Oct 16, 2024
f205956
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 16, 2024
8e34c02
Fix the unit tests
aniketkatkar97 Oct 16, 2024
5d12348
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 17, 2024
05aa83b
Fix playwright tests
aniketkatkar97 Oct 17, 2024
d08b8ed
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 17, 2024
ba35a2d
Fix the failing playwright tests
aniketkatkar97 Oct 17, 2024
230cf53
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 17, 2024
c118197
Fix the ingestion search issue
aniketkatkar97 Oct 17, 2024
ecf47f0
worked on comments and fixed playwright tests
aniketkatkar97 Oct 17, 2024
d08ea59
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 17, 2024
cf840bb
Remove the unnecessary isEmpty check for the cron string
aniketkatkar97 Oct 17, 2024
c4e376a
Fix the cron values for hour and min not showing correctly
aniketkatkar97 Oct 17, 2024
757e7be
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 17, 2024
1c20a82
Remove the isEmpty check for cron
aniketkatkar97 Oct 17, 2024
6c5e87f
Move the cron error checks to the create ingestion logic
aniketkatkar97 Oct 18, 2024
591f1bc
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 18, 2024
0f92a2c
Fix the failing playwright
aniketkatkar97 Oct 18, 2024
334d494
Merge branch 'main' into GEN-658
aniketkatkar97 Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ test(

await page.getByTestId('add-ingestion-button').click();
await page.getByTestId('select-all-test-cases').click();
await page.getByTestId('cron-type').getByText('Hour').click();
await page.getByTitle('Day').click();

await expect(
page.getByTestId('cron-type').getByText('Day')
).toBeAttached();

await page.getByTestId('deploy-button').click();

await expect(page.getByTestId('view-service-button')).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@ test.describe.serial('Data Insight Report Application', () => {
await page.click('[data-testid="install-application"]');
await page.click('[data-testid="save-button"]');
await page.click('[data-testid="submit-btn"]');
await page.click('[data-testid="cron-type"]');
await page.click('[data-value="5"]');

await expect(
page.getByTestId('cron-type').getByText('Week')
).toBeAttached();

await page
.locator('#schedular-form_dow .week-selector-buttons')
.getByText('F')
.click();
await page.click('[data-testid="deploy-button"]');

await toastNotification(page, 'Application installed successfully');
Expand All @@ -79,7 +86,10 @@ test.describe.serial('Data Insight Report Application', () => {

await page.click('[data-testid="edit-button"]');
await page.click('[data-testid="cron-type"]');
await page.click('[data-value="3"]');
await page
.locator('#schedular-form_dow .week-selector-buttons')
.getByText('W')
.click();
await page.click('[data-testid="hour-options"]');
await page.click('[title="01"]');
await page.click('.ant-modal-body [data-testid="deploy-button"]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ test('Search Index Application', async ({ page }) => {

await test.step('Edit application', async () => {
await page.click('[data-testid="edit-button"]');
await page.click('[data-testid="cron-type"]');
await page.click('.rc-virtual-list [title="None"]');
await page.waitForSelector('[data-testid="schedular-card-container"]');
await page
.getByTestId('schedular-card-container')
.getByText('On Demand')
.click();

const deployResponse = page.waitForResponse('/api/v1/apps/*');
await page.click('.ant-modal-body [data-testid="deploy-button"]');
Expand Down Expand Up @@ -157,10 +160,13 @@ test('Search Index Application', async ({ page }) => {
await page.click('[data-testid="install-application"]');
await page.click('[data-testid="save-button"]');
await page.click('[data-testid="submit-btn"]');
await page.click('[data-testid="cron-type"]');
await page.click('.rc-virtual-list [title="None"]');
await page.waitForSelector('[data-testid="schedular-card-container"]');
await page
.getByTestId('schedular-card-container')
.getByText('On Demand')
.click();

expect(await page.innerText('[data-testid="cron-type"]')).toContain('None');
await expect(page.locator('[data-testid="cron-type"]')).not.toBeVisible();

const installApplicationResponse = page.waitForResponse('api/v1/apps');
await page.click('[data-testid="deploy-button"]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,39 @@ class ServiceBaseClass {
}

async scheduleIngestion(page: Page) {
// Schedule & Deploy
await page.waitForSelector('[data-testid="cron-type"]');
await page.click('[data-testid="cron-type"]');
await page.waitForSelector('.ant-select-item-option-content');
await page.click('.ant-select-item-option-content:has-text("None")');
await page.click('.ant-select-item-option-content:has-text("Custom")');
// Check validation error thrown for a cron that is too frequent
// i.e. having interval less than 1 hour
await page.locator('#schedular-form_cron').fill('* * * 2 6');
await page.click('[data-testid="deploy-button"]');

await expect(
page.getByText(
'Cron schedule too frequent. Please choose at least 1-hour intervals.'
)
).toBeAttached();

// Check validation error thrown for a cron that is invalid
await page.locator('#schedular-form_cron').clear();
await page.click('[data-testid="deploy-button"]');
await page.locator('#schedular-form_cron').fill('* * * 2 ');

await expect(
page.getByText(
'Error: Expression has only 4 parts. At least 5 parts are required.'
)
).toBeAttached();

await page.locator('#schedular-form_cron').clear();

await page.waitForSelector('[data-testid="schedular-card-container"]');
await page
.getByTestId('schedular-card-container')
.getByText('On Demand')
.click();

await expect(page.locator('[data-testid="cron-type"]')).not.toBeVisible();

const deployPipelinePromise = page.waitForRequest(
`/api/v1/services/ingestionPipelines/deploy/**`
Expand Down Expand Up @@ -240,7 +268,7 @@ class ServiceBaseClass {
.then((res) => res.json());

const workflowData = response.data.filter(
(d) => d.pipelineType === ingestionType
(d: { pipelineType: string }) => d.pipelineType === ingestionType
)[0];

const oneHourBefore = Date.now() - 86400000;
Expand Down Expand Up @@ -315,6 +343,11 @@ class ServiceBaseClass {
await page.click('[data-testid="submit-btn"]');

// select schedule
await page.waitForSelector('[data-testid="schedular-card-container"]');
await page
.getByTestId('schedular-card-container')
.getByText('Schedule', { exact: true })
.click();
await page.click('[data-testid="cron-type"]');
await page
.locator('.ant-select-item-option-content', { hasText: 'Hour' })
Expand Down Expand Up @@ -365,7 +398,10 @@ class ServiceBaseClass {
await page.click('[data-testid="submit-btn"]');
await page.click('[data-testid="cron-type"]');
await page.click('.ant-select-item-option-content:has-text("Week")');
await page.click('[data-value="6"]');
await page
.locator('#schedular-form_dow .week-selector-buttons')
.getByText('W')
.click();
await page.click('[data-testid="hour-options"]');
await page.click('#hour-select_list + .rc-virtual-list [title="05"]');
await page.click('[data-testid="minute-options"]');
Expand All @@ -379,7 +415,7 @@ class ServiceBaseClass {
'At 05:05 AM'
);
await expect(page.getByTestId('schedule-secondary-details')).toHaveText(
'Only on saturday'
'Only on wednesday'
);

// click and edit pipeline schedule for Custom
Expand All @@ -388,16 +424,18 @@ class ServiceBaseClass {
await page.click('[data-testid="submit-btn"]');
await page.click('[data-testid="cron-type"]');
await page.click('.ant-select-item-option-content:has-text("Custom")');
await page.fill('#cron', '* * * 2 6');

// Schedule & Deploy
await page.locator('#schedular-form_cron').fill('0 * * 2 6');

await page.click('[data-testid="deploy-button"]');
await page.click('[data-testid="view-service-button"]');

await expect(page.getByTestId('schedule-primary-details')).toHaveText(
'Every minute'
'Every hour'
);
await expect(page.getByTestId('schedule-secondary-details')).toHaveText(
'Every hour, only on saturday, only in february'
'Only on saturday, only in february'
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface TestSuiteIngestionProps {
}

export type TestSuiteIngestionDataType = {
repeatFrequency: string;
cron?: string;
enableDebugLog?: boolean;
testCases?: string[];
name?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
updateIngestionPipeline,
} from '../../../rest/ingestionPipelineAPI';
import {
getIngestionFrequency,
getNameFromFQN,
replaceAllSpacialCharWith_,
Transi18next,
Expand All @@ -51,7 +50,6 @@ import { getScheduleOptionsFromSchedules } from '../../../utils/ScheduleUtils';
import { getIngestionName } from '../../../utils/ServiceUtils';
import { generateUUID } from '../../../utils/StringsUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
import { getWeekCron } from '../../common/CronEditor/CronEditor.constant';
import SuccessScreen from '../../common/SuccessScreen/SuccessScreen';
import DeployIngestionLoaderModal from '../../Modals/DeployIngestionLoaderModal/DeployIngestionLoaderModal';
import {
Expand Down Expand Up @@ -117,15 +115,11 @@ const TestSuiteIngestion: React.FC<TestSuiteIngestionProps> = ({
);
}, [ingestionData, showDeployButton]);

const initialFormData: TestSuiteIngestionDataType = useMemo(() => {
const initialFormData = useMemo(() => {
const testCases = ingestionPipeline?.sourceConfig.config?.testCases;

return {
repeatFrequency:
ingestionPipeline?.airflowConfig.scheduleInterval ??
(config?.enable
? getWeekCron({ hour: 0, min: 0, dow: 0 })
: getIngestionFrequency(PipelineType.TestSuite)),
cron: ingestionPipeline?.airflowConfig.scheduleInterval,
enableDebugLog: ingestionPipeline?.loggerLevel === LogLevels.Debug,
testCases,
name: ingestionPipeline?.displayName,
Expand Down Expand Up @@ -171,9 +165,7 @@ const TestSuiteIngestion: React.FC<TestSuiteIngestionProps> = ({

const ingestionPayload: CreateIngestionPipeline = {
airflowConfig: {
scheduleInterval: isEmpty(data.repeatFrequency)
? undefined
: data.repeatFrequency,
scheduleInterval: data.cron,
},
displayName: updatedName,
name: generateUUID(),
Expand Down Expand Up @@ -211,9 +203,7 @@ const TestSuiteIngestion: React.FC<TestSuiteIngestionProps> = ({
displayName: data.name ?? ingestionPipeline.displayName,
airflowConfig: {
...ingestionPipeline?.airflowConfig,
scheduleInterval: isEmpty(data.repeatFrequency)
? undefined
: data.repeatFrequency,
scheduleInterval: data.cron,
},
loggerLevel: data.enableDebugLog ? LogLevels.Debug : LogLevels.Info,
sourceConfig: {
Expand Down
Loading
Loading