Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13237-tests-1767269372512.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Fix flaky CI failures by removing invalid UI-to-UTC time comparisons in metrics tests ([#13237](https://github.com/linode/manager/pull/13237))
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const databaseMock: Database = databaseFactory.build({
});
// Profile timezone is set to 'UTC'
const mockProfile = profileFactory.build({
timezone: 'UTC',
timezone: 'America/New_York',
});
/**
* Generates a date in Indian Standard Time (IST) based on a specified number of days offset,
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function documentation mentions 'Indian Standard Time (IST)' but the function now uses a configurable timezone (America/New_York). The docstring should be updated to reflect this change.

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -149,30 +149,23 @@ const getDateRangeInGMT = (
* @returns {{start: string, end: string}} - The start and end dates of the current month in ISO 8601 format.
*/

const getThisMonthRange = (): DateTimeWithPreset => {
const nowUtc = DateTime.utc(); // Current time in UTC

const startOfMonthUtc = nowUtc.startOf('month'); // Start of current month in UTC
const getThisMonthRange = (timeZone: string): DateTimeWithPreset => {
const now = DateTime.now().setZone(timeZone);

return {
start: startOfMonthUtc.toFormat(formatter),
end: nowUtc.toFormat(formatter),
start: now.startOf('month').toUTC().toFormat(formatter),
end: now.toUTC().toFormat(formatter),
};
};
const getLastMonthRange = (): DateTimeWithPreset => {
// Get current time in UTC
const now = DateTime.utc();

// Get last month in UTC
const lastMonth = now.minus({ months: 1 });
const getLastMonthRange = (timeZone: string): DateTimeWithPreset => {
const now = DateTime.now().setZone(timeZone);

// Get start and end of last month in UTC and format
const start = lastMonth.startOf('month').toFormat(formatter);
const end = lastMonth.endOf('month').toFormat(formatter);
const lastMonth = now.minus({ months: 1 });

return {
start,
end,
start: lastMonth.startOf('month').toUTC().toFormat(formatter),
end: lastMonth.endOf('month').toUTC().toFormat(formatter),
};
};

Expand Down Expand Up @@ -522,7 +515,7 @@ describe('Integration tests for verifying Cloudpulse custom and preset configura
});

it('Select the "Last Month" preset from the "Time Range" dropdown and verify its functionality.', () => {
const { end, start } = getLastMonthRange();
const { start, end } = getLastMonthRange(mockProfile.timezone);

ui.button.findByTitle('Last hour').as('startDateInput');
cy.get('@startDateInput').scrollIntoView();
Expand Down Expand Up @@ -558,7 +551,7 @@ describe('Integration tests for verifying Cloudpulse custom and preset configura
});

it('Select the "This Month" preset from the "Time Range" dropdown and verify its functionality.', () => {
const { end, start } = getThisMonthRange();
const { start, end } = getThisMonthRange(mockProfile.timezone);

ui.button.findByTitle('Last hour').as('startDateInput');
cy.get('@startDateInput').scrollIntoView();
Expand Down