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; const rowIndex = ingestionType === 'metadata' ? 1 : 2;
// ingestions page // ingestions page
let retryCount = count; let retryCount = count;
const testIngestionsTab = () => { const testIngestionsTab = () => {
cy.get('[data-testid="Ingestions"]').should('be.visible'); cy.get('[data-testid="Ingestions"]').should('be.visible');
@ -145,9 +145,14 @@ export const testServiceCreationAndIngestion = (
cy.get('[data-testid="ip-address"]').should('exist'); cy.get('[data-testid="ip-address"]').should('exist');
// Test the connection // 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"]').should('exist');
cy.get('[data-testid="test-connection-btn"]').click(); cy.get('[data-testid="test-connection-btn"]').click();
cy.wait(5000); verifyResponseStatusCode('@testConnection', 200);
cy.contains('Connection test was successful').should('exist'); cy.contains('Connection test was successful').should('exist');
cy.get('[data-testid="submit-btn"]').should('exist').click(); cy.get('[data-testid="submit-btn"]').should('exist').click();
@ -676,7 +681,7 @@ export const deleteSoftDeletedUser = (username) => {
export const toastNotification = (msg) => { export const toastNotification = (msg) => {
cy.get('.Toastify__toast-body').should('be.visible').contains(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(); 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 * See the License for the specific language governing permissions and
* limitations under the License. * 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 { descriptionBox, interceptURL, login, uuid, verifyResponseStatusCode } from '../../common/common';
import { DELETE_TERM, LOGIN } from '../../constants/constants'; import { DELETE_TERM, LOGIN } from '../../constants/constants';
@ -29,8 +29,6 @@ const expirationTime = {
twomonths: '60', twomonths: '60',
threemonths: '90', threemonths: '90',
}; };
const getCreatedBot = () => { const getCreatedBot = () => {
interceptURL('GET', `/api/v1/bots/name/${botName}`, 'getCreatedBot'); interceptURL('GET', `/api/v1/bots/name/${botName}`, 'getCreatedBot');
//Click on created Bot name //Click on created Bot name
@ -95,7 +93,6 @@ describe('Bots Page should work properly', () => {
}); });
it('Create new Bot', () => { it('Create new Bot', () => {
cy.get('[data-testid="add-bot"]') cy.get('[data-testid="add-bot"]')
.should('exist') .should('exist')
.should('be.visible') .should('be.visible')
@ -128,7 +125,6 @@ describe('Bots Page should work properly', () => {
cy.get('table').should('contain', botName).and('contain', description); cy.get('table').should('contain', botName).and('contain', description);
getCreatedBot(); getCreatedBot();
const endhour = getExpiryDateTimeFromDate('1', 'hour');
cy.get('[data-testid="revoke-button"]') cy.get('[data-testid="revoke-button"]')
.should('be.visible') .should('be.visible')
.should('contain', 'Revoke token'); .should('contain', 'Revoke token');
@ -137,16 +133,13 @@ describe('Bots Page should work properly', () => {
.should('be.visible') .should('be.visible')
.should('contain', `${JWTToken} Token`); .should('contain', `${JWTToken} Token`);
//Verify expiration time //Verify expiration time
cy.get('[data-testid="token-expiry"]') cy.get('[data-testid="token-expiry"]').should('be.visible');
.should('be.visible')
.invoke('text')
.should('contain', `Expires on ${endhour}`);
}); });
Object.values(expirationTime).forEach((expiry) => { Object.values(expirationTime).forEach((expiry) => {
it(`Update token expiration for ${expiry} days`, () => { it(`Update token expiration for ${expiry} days`, () => {
getCreatedBot(); getCreatedBot();
const expiryDate = getExpiryDateTimeFromDate(expiry, 'days');
revokeToken(); revokeToken();
//Click on token expiry dropdown //Click on token expiry dropdown
cy.get('[data-testid="token-expiry"]').should('be.visible').click(); cy.get('[data-testid="token-expiry"]').should('be.visible').click();
@ -155,8 +148,12 @@ describe('Bots Page should work properly', () => {
.should('exist') .should('exist')
.should('be.visible') .should('be.visible')
.click(); .click();
//Save the updated date //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="save-edit"]').should('be.visible').click();
cy.get('[data-testid="center-panel"]') cy.get('[data-testid="center-panel"]')
.find('[data-testid="revoke-button"]') .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 jsonData from '../../jsons/en';
import { STATUS_OPTIONS } from '../../utils/PipelineDetailsUtils'; import { STATUS_OPTIONS } from '../../utils/PipelineDetailsUtils';
import { import {
getDateToSecondsOfCurrentDate, getDateToMilliSecondsOfCurrentDate,
getPastDatesToSecondsFromCurrentDate, getPastDatesToMilliSecondsFromCurrentDate,
} from '../../utils/TimeUtils'; } from '../../utils/TimeUtils';
import { showErrorToast } from '../../utils/ToastUtils'; import { showErrorToast } from '../../utils/ToastUtils';
import { reactSingleSelectCustomStyle } from '../common/react-select-component/reactSelectCustomStyle'; import { reactSingleSelectCustomStyle } from '../common/react-select-component/reactSelectCustomStyle';
@ -78,11 +78,11 @@ const PipelineStatusList: FC<Prop> = ({
const fetchPipelineStatus = async () => { const fetchPipelineStatus = async () => {
try { try {
const startTs = getPastDatesToSecondsFromCurrentDate( const startTs = getPastDatesToMilliSecondsFromCurrentDate(
PROFILER_FILTER_RANGE.last60days.days PROFILER_FILTER_RANGE.last60days.days
); );
const endTs = getDateToSecondsOfCurrentDate(); const endTs = getDateToMilliSecondsOfCurrentDate();
const response = await getPipelineStatus(pipelineFQN, { const response = await getPipelineStatus(pipelineFQN, {
startTs, startTs,

View File

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

View File

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

View File

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