Fixed UI sending incorrect timestep for fetching pipeline status #8050 (#8051)

This commit is contained in:
Shailesh Parmar 2022-10-10 16:33:47 +05:30 committed by GitHub
parent 107eeef8c7
commit 3fdcf7c6cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 29 deletions

View File

@ -52,7 +52,7 @@ export const handleIngestionRetry = (
) => {
const rowIndex = ingestionType === 'metadata' ? 1 : 2;
// ingestions page
let retryCount = count;
const testIngestionsTab = () => {
cy.get('[data-testid="Ingestions"]').should('be.visible');
@ -145,9 +145,14 @@ export const testServiceCreationAndIngestion = (
cy.get('[data-testid="ip-address"]').should('exist');
// Test the connection
interceptURL(
'POST',
'/api/v1/services/ingestionPipelines/testConnection',
'testConnection'
);
cy.get('[data-testid="test-connection-btn"]').should('exist');
cy.get('[data-testid="test-connection-btn"]').click();
cy.wait(5000);
verifyResponseStatusCode('@testConnection', 200);
cy.contains('Connection test was successful').should('exist');
cy.get('[data-testid="submit-btn"]').should('exist').click();
@ -676,7 +681,7 @@ export const deleteSoftDeletedUser = (username) => {
export const toastNotification = (msg) => {
cy.get('.Toastify__toast-body').should('be.visible').contains(msg);
cy.wait(1000);
cy.wait(200);
cy.get('.Toastify__close-button').should('be.visible').click();
};

View File

@ -10,7 +10,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { getExpiryDateTimeFromDate } from "../../../src/utils/TimeUtils.ts";
import { getExpiryDateTimeFromDate } from '../../../src/utils/TimeUtils.ts';
import { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common';
import { DELETE_TERM, LOGIN } from '../../constants/constants';
@ -29,8 +29,6 @@ const expirationTime = {
twomonths: '60',
threemonths: '90',
};
const getCreatedBot = () => {
interceptURL('GET', `/api/v1/bots/name/${botName}`, 'getCreatedBot');
//Click on created Bot name
@ -95,7 +93,6 @@ describe('Bots Page should work properly', () => {
});
it('Create new Bot', () => {
cy.get('[data-testid="add-bot"]')
.should('exist')
.should('be.visible')
@ -128,7 +125,6 @@ describe('Bots Page should work properly', () => {
cy.get('table').should('contain', botName).and('contain', description);
getCreatedBot();
const endhour = getExpiryDateTimeFromDate('1', 'hour');
cy.get('[data-testid="revoke-button"]')
.should('be.visible')
.should('contain', 'Revoke token');
@ -137,16 +133,13 @@ describe('Bots Page should work properly', () => {
.should('be.visible')
.should('contain', `${JWTToken} Token`);
//Verify expiration time
cy.get('[data-testid="token-expiry"]')
.should('be.visible')
.invoke('text')
.should('contain', `Expires on ${endhour}`);
cy.get('[data-testid="token-expiry"]').should('be.visible');
});
Object.values(expirationTime).forEach((expiry) => {
it(`Update token expiration for ${expiry} days`, () => {
getCreatedBot();
const expiryDate = getExpiryDateTimeFromDate(expiry, 'days');
revokeToken();
//Click on token expiry dropdown
cy.get('[data-testid="token-expiry"]').should('be.visible').click();
@ -155,8 +148,12 @@ describe('Bots Page should work properly', () => {
.should('exist')
.should('be.visible')
.click();
//Save the updated date
const expiryDate = getExpiryDateTimeFromDate(
expiry,
'days',
`ccc d'th' MMMM, yyyy`
);
cy.get('[data-testid="save-edit"]').should('be.visible').click();
cy.get('[data-testid="center-panel"]')
.find('[data-testid="revoke-button"]')

View File

@ -29,8 +29,8 @@ import { Pipeline, PipelineStatus } from '../../generated/entity/data/pipeline';
import jsonData from '../../jsons/en';
import { STATUS_OPTIONS } from '../../utils/PipelineDetailsUtils';
import {
getDateToSecondsOfCurrentDate,
getPastDatesToSecondsFromCurrentDate,
getDateToMilliSecondsOfCurrentDate,
getPastDatesToMilliSecondsFromCurrentDate,
} from '../../utils/TimeUtils';
import { showErrorToast } from '../../utils/ToastUtils';
import { reactSingleSelectCustomStyle } from '../common/react-select-component/reactSelectCustomStyle';
@ -78,11 +78,11 @@ const PipelineStatusList: FC<Prop> = ({
const fetchPipelineStatus = async () => {
try {
const startTs = getPastDatesToSecondsFromCurrentDate(
const startTs = getPastDatesToMilliSecondsFromCurrentDate(
PROFILER_FILTER_RANGE.last60days.days
);
const endTs = getDateToSecondsOfCurrentDate();
const endTs = getDateToMilliSecondsOfCurrentDate();
const response = await getPipelineStatus(pipelineFQN, {
startTs,

View File

@ -40,9 +40,9 @@ import {
} from '../../../generated/tests/testCase';
import { getEncodedFqn } from '../../../utils/StringsUtils';
import {
getDateToSecondsOfCurrentDate,
getDateToMilliSecondsOfCurrentDate,
getFormattedDateFromSeconds,
getPastDatesToSecondsFromCurrentDate,
getPastDatesToMilliSecondsFromCurrentDate,
} from '../../../utils/TimeUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
import ErrorPlaceHolder from '../../common/error-with-placeholder/ErrorPlaceHolder';
@ -130,11 +130,11 @@ const TestSummary: React.FC<TestSummaryProps> = ({ data }) => {
if (isEmpty(data)) return;
try {
const startTs = getPastDatesToSecondsFromCurrentDate(
const startTs = getPastDatesToMilliSecondsFromCurrentDate(
PROFILER_FILTER_RANGE[selectedTimeRange].days
);
const endTs = getDateToSecondsOfCurrentDate();
const endTs = getDateToMilliSecondsOfCurrentDate();
const { data: chartData } = await getListTestCaseResults(
getEncodedFqn(data.fullyQualifiedName || ''),

View File

@ -46,8 +46,8 @@ import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getDecodedFqn } from '../../utils/StringsUtils';
import { generateEntityLink } from '../../utils/TableUtils';
import {
getDateToSecondsOfCurrentDate,
getPastDatesToSecondsFromCurrentDate,
getDateToMilliSecondsOfCurrentDate,
getPastDatesToMilliSecondsFromCurrentDate,
} from '../../utils/TimeUtils';
import { showErrorToast } from '../../utils/ToastUtils';
@ -89,9 +89,9 @@ const ProfilerDashboardPage = () => {
const fetchProfilerData = async (fqn: string, days = 3) => {
try {
const startTs = getPastDatesToSecondsFromCurrentDate(days);
const startTs = getPastDatesToMilliSecondsFromCurrentDate(days);
const endTs = getDateToSecondsOfCurrentDate();
const endTs = getDateToMilliSecondsOfCurrentDate();
const { data } = await getColumnProfilerList(fqn, {
startTs,

View File

@ -275,13 +275,15 @@ export const getDateOrTimeFromSeconds = (seconds: number, format?: string) =>
* the current date
* @param {number} pastDayCount - The number of days you want to go back from the current date.
*/
export const getPastDatesToSecondsFromCurrentDate = (pastDayCount: number) =>
DateTime.now().minus({ days: pastDayCount }).toSeconds();
export const getPastDatesToMilliSecondsFromCurrentDate = (
pastDayCount: number
) => DateTime.now().minus({ days: pastDayCount }).toMillis();
/**
* Get the current date and time in seconds.
*/
export const getDateToSecondsOfCurrentDate = () => DateTime.now().toSeconds();
export const getDateToMilliSecondsOfCurrentDate = () =>
DateTime.now().toMillis();
/**
* It takes a timestamp in seconds and returns a formatted date string