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

Use timer mock on Incremental CAgg Refresh policy tests #7813

Merged

Conversation

fabriziomello
Copy link
Contributor

@fabriziomello fabriziomello commented Mar 11, 2025

Disable-check: force-changelog-file
Disable-check: approval-count

@fabriziomello fabriziomello self-assigned this Mar 11, 2025
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.95%. Comparing base (59f50f2) to head (48bae22).
Report is 824 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7813      +/-   ##
==========================================
+ Coverage   80.06%   81.95%   +1.88%     
==========================================
  Files         190      248      +58     
  Lines       37181    45781    +8600     
  Branches     9450    11466    +2016     
==========================================
+ Hits        29770    37521    +7751     
- Misses       2997     3750     +753     
- Partials     4414     4510      +96     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fabriziomello fabriziomello requested a review from svenklemm March 11, 2025 22:26
@akuzm akuzm added the force-auto-backport Automatically backport this PR or fix of this issue, even if it's not marked as "bug" label Mar 12, 2025
@akuzm akuzm merged commit a4c57fe into timescale:main Mar 12, 2025
56 of 59 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 12, 2025
@@ -531,6 +531,7 @@ FROM
'2025-03-11 00:00:00+00'::timestamptz,
'1 hour'::interval) AS t,
generate_series(1,5) AS d;
SET timescaledb.current_timestamp_mock TO '2025-03-11 00:00:00+00';
Copy link
Contributor

Choose a reason for hiding this comment

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

Does timer mock support time zones i.e. is it set to a particular time zone?

Copy link
Contributor Author

@fabriziomello fabriziomello Mar 12, 2025

Choose a reason for hiding this comment

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

Yes it support ... it just return a TimestampTz. We do something like this in our code base:

#ifdef TS_DEBUG
	Datum res = ts_get_mock_time_or_current_time();
#else
	Datum res = TimestampTzGetDatum(GetCurrentTimestamp());
#endif

It means that will return the mock time if you set it, if you don't set a mock timestamp then ts_get_mock_timr_or_current_time() will return GetCurrentTimestamp().

Copy link
Contributor

@natalya-aksman natalya-aksman Mar 12, 2025

Choose a reason for hiding this comment

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

But will the test interpret, say, 2025-03-11 00:00:00+00 timer mock as being in a particular time zone? I.e. will it translate to local time if run, say, in New York vs. Berlin? Is the time zone hard set in the timer mock?

fabriziomello added a commit to fabriziomello/timescaledb that referenced this pull request Mar 13, 2025
The usage of timer mock was wrong because we're setting it on the
current session but the job is executed by a background worker that
don't have the mock time configured.

Fixed it by creating a user with an specific timezone and time mock
configured so any background worker created by the user will have the
proper configuration.

Failed attempts to fix timescale#7813 and timescale#7819.
fabriziomello added a commit to fabriziomello/timescaledb that referenced this pull request Mar 13, 2025
The usage of timer mock was wrong because we're setting it on the
current session but the job is executed by a background worker that
don't have the mock time configured.

Fixed it by creating a user with an specific timezone and time mock
configured so any background worker created by the user will have the
proper configuration.

Failed attempts to fix timescale#7813 and timescale#7819.
fabriziomello added a commit to fabriziomello/timescaledb that referenced this pull request Mar 13, 2025
The usage of timer mock was wrong because we're setting it on the
current session but the job is executed by a background worker that
don't have the mock time configured.

Fixed it by creating a user with an specific timezone and time mock
configured so any background worker created by the user will have the
proper configuration.

Failed attempts to fix timescale#7813 and timescale#7819.
antekresic pushed a commit that referenced this pull request Mar 14, 2025
The usage of timer mock was wrong because we're setting it on the
current session but the job is executed by a background worker that
don't have the mock time configured.

Fixed it by creating a user with an specific timezone and time mock
configured so any background worker created by the user will have the
proper configuration.

Failed attempts to fix #7813 and #7819.
github-actions bot pushed a commit that referenced this pull request Mar 14, 2025
The usage of timer mock was wrong because we're setting it on the
current session but the job is executed by a background worker that
don't have the mock time configured.

Fixed it by creating a user with an specific timezone and time mock
configured so any background worker created by the user will have the
proper configuration.

Failed attempts to fix #7813 and #7819.

(cherry picked from commit adfda01)
timescale-automation pushed a commit that referenced this pull request Mar 14, 2025
The usage of timer mock was wrong because we're setting it on the
current session but the job is executed by a background worker that
don't have the mock time configured.

Fixed it by creating a user with an specific timezone and time mock
configured so any background worker created by the user will have the
proper configuration.

Failed attempts to fix #7813 and #7819.

(cherry picked from commit adfda01)
akuzm pushed a commit that referenced this pull request Mar 14, 2025
This is an automated backport of #7813: Use timer mock on Incremental
CAgg Refresh policy tests.
This PR will be merged automatically after all the relevant CI checks
pass. If this fix should not be backported, or will be backported
manually, just close this PR. You can use the backport branch to add
your changes, it won't be modified automatically anymore.

For more details, please see the
[documentation](https://github.com/timescale/eng-database/wiki/Releasing-TimescaleDB#automated-cherry-picking-of-bug-fixes)

## Original description
### Use timer mock on Incremental CAgg Refresh policy tests
Disable-check: force-changelog-file
Disable-check: approval-count

Co-authored-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>
@timescale-automation
Copy link
Member

Automated backport to 2.19.x not done: cherry-pick failed.

Git status

HEAD detached at origin/2.19.x
You are currently cherry-picking commit a4c57fe0c.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean

Job log

@timescale-automation timescale-automation added the auto-backport-not-done Automated backport of this PR has failed non-retriably (e.g. conflicts) label Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-not-done Automated backport of this PR has failed non-retriably (e.g. conflicts) Continuous Aggregate flaky-test Issue about a flaky test force-auto-backport Automatically backport this PR or fix of this issue, even if it's not marked as "bug"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants