fix(server): generate report for T-7days (#14932)

* fix(server): generate report for T-7days

* support weekly option for DataInsightReport application

* fix checkstyle

* add cypress to validate schedule

* skip ml flow schedule spec
This commit is contained in:
Chirag Madlani 2024-01-30 17:00:08 +05:30 committed by GitHub
parent 5940d7219a
commit 727cd48ed5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 113 additions and 7 deletions

View File

@ -74,8 +74,7 @@ public class DataInsightsReportApp extends AbstractNativeApplication {
// Calculate time diff
long currentTime = Instant.now().toEpochMilli();
AppSchedule scheduleConfiguration = app.getAppSchedule();
long scheduleTime =
currentTime - getTimeFromSchedule(scheduleConfiguration, jobExecutionContext);
long scheduleTime = currentTime - 604800000L;
int numberOfDaysChange = getNumberOfDays(scheduleConfiguration);
try {
DataInsightsReportAppConfig insightAlertConfig =

View File

@ -20,6 +20,7 @@ import {
toastNotification,
verifyResponseStatusCode,
} from '../common';
import { visitServiceDetailsPage } from '../serviceUtils';
import { visitEntityDetailsPage } from '../Utils/Entity';
import {
deleteService,
@ -179,6 +180,7 @@ class ServiceBaseClass {
cy.get('[data-testid="view-service-button"]').click();
verifyResponseStatusCode('@serviceDetails', 200);
verifyResponseStatusCode('@ingestionPipelines', 200);
this.handleIngestionRetry();
}
@ -274,6 +276,10 @@ class ServiceBaseClass {
responseTimeout: 50000,
});
}
// Check cron schedule for Hour here
// Being set from this.scheduleIngestion method
cy.get('.ant-table-cell').should('contain', '0 * * * *');
}
};
const checkSuccessState = () => {
@ -321,6 +327,91 @@ class ServiceBaseClass {
this.updateDescriptionForIngestedTables();
}
updateScheduleOptions() {
visitServiceDetailsPage(
{ type: this.category, name: this.serviceName },
false
);
interceptURL(
'GET',
`/api/v1/services/ingestionPipelines/**`,
'pipelineServices'
);
cy.get('[data-testid="ingestions"]').click();
verifyResponseStatusCode('@pipelineServices', 200);
// click and edit pipeline schedule for Minutes
cy.get('[data-testid="edit"]').click();
cy.get('[data-testid="submit-btn"]').click();
// select schedule
cy.get('[data-testid="cron-type"]').click();
cy.get('.ant-select-item-option-content').contains('Minutes').click();
cy.get('[data-testid="minute-segment-options"]').click();
cy.get('.ant-select-item-option-content').contains('10').click();
// Deploy with scehdule
cy.get('[data-testid="deploy-button"]').click();
cy.get('[data-testid="view-service-button"]').click();
cy.get('.ant-table-cell').should('contain', '*/10 * * * *');
// click and edit pipeline schedule for Day
cy.get('[data-testid="edit"]').click();
cy.get('[data-testid="submit-btn"]').click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.ant-select-item-option-content').contains('Day').click();
cy.get('[data-testid="hour-options"]').click();
cy.get('.ant-select-item-option-content').contains('4').click();
cy.get('[data-testid="minute-options"]').click();
cy.get('.ant-select-item-option-content')
.filter(':visible')
.contains('4')
.click();
// Deploy with scehdule
cy.get('[data-testid="deploy-button"]').click();
cy.get('[data-testid="view-service-button"]').click();
cy.get('.ant-table-cell').should('contain', '4 4 * * *');
// click and edit pipeline schedule for Week
cy.get('[data-testid="edit"]').click();
cy.get('[data-testid="submit-btn"]').click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.ant-select-item-option-content').contains('Week').click();
cy.get('[data-value="6"]').click();
cy.get('[data-testid="hour-options"]').click();
cy.get('.ant-select-item-option-content').contains('5').click();
cy.get('[data-testid="minute-options"]').click();
cy.get('.ant-select-item-option-content')
.filter(':visible')
.contains('05')
.click();
// Deploy with scehdule
cy.get('[data-testid="deploy-button"]').click();
cy.get('[data-testid="view-service-button"]').click();
cy.get('.ant-table-cell').should('contain', '5 5 * * 6');
// click and edit pipeline schedule for Custom
cy.get('[data-testid="edit"]').click();
cy.get('[data-testid="submit-btn"]').click();
cy.get('[data-testid="cron-type"]').click();
cy.get('.ant-select-item-option-content').contains('Custom').click();
cy.get('#cron').clear().type('* * * 2 6');
cy.get('[data-testid="deploy-button"]').click();
cy.get('[data-testid="view-service-button"]').click();
cy.get('.ant-table-cell').should('contain', '* * * 2 6');
}
updateDescriptionForIngestedTables() {
const description = `${this.entityName} description`;
interceptURL(

View File

@ -34,6 +34,10 @@ class MlFlowIngestionClass extends ServiceBaseClass {
// Do nothing here
}
updateScheduleOptions() {
// Do nothing here as we are not ingesting anything here
}
fillConnectionDetails() {
cy.get('#root\\/trackingUri').type('mlModelTrackingUri');
checkServiceFieldSectionHighlighting('trackingUri');

View File

@ -128,7 +128,7 @@ export const removeOwner = (ownerName: string, dataTestId?: string) => {
interceptURL('PATCH', `/api/v1/**`, 'patchOwner');
cy.get('[data-testid="remove-owner"]').click();
cy.get('[data-testid="remove-owner"]').scrollIntoView().click();
verifyResponseStatusCode('@patchOwner', 200);
cy.get(`[data-testid=${dataTestId ?? 'owner-link'}]`).should(
@ -206,7 +206,7 @@ export const removeTeamAsOwner = (teamName: string, dataTestId?: string) => {
interceptURL('PATCH', `/api/v1/**`, 'patchOwner');
cy.get('[data-testid="remove-owner"]').click();
cy.get('[data-testid="remove-owner"]').scrollIntoView().click();
verifyResponseStatusCode('@patchOwner', 200);
cy.get('[data-testid="owner-link"]').should('not.contain', teamName);

View File

@ -52,6 +52,10 @@ services.forEach((service) => {
service.updateService();
});
it(`Update schedule options and verify`, () => {
service.updateScheduleOptions();
});
service.runAdditionalTests();
it(`Delete ${service.serviceType} service`, () => {

View File

@ -128,6 +128,16 @@ const AppSchedule = ({
);
}, [appData, isPipelineDeployed, appRunsHistoryRef]);
const initialOptions = useMemo(() => {
if (appData.name === 'DataInsightsReportApplication') {
return ['Week'];
} else if (appData.appType === AppType.External) {
return ['Day'];
}
return undefined;
}, [appData.name, appData.appType]);
useEffect(() => {
fetchPipelineDetails();
}, []);
@ -220,9 +230,7 @@ const AppSchedule = ({
cancelText: t('label.cancel'),
okText: t('label.save'),
}}
includePeriodOptions={
appData.appType === AppType.External ? ['Day'] : undefined
}
includePeriodOptions={initialOptions}
initialData={getIngestionFrequency(PipelineType.Application)}
onCancel={onDialogCancel}
onSubmit={onDialogSave}