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

test: fix TimezoneSelector tests on daylight saving time #19156

Merged
merged 4 commits into from
Mar 16, 2022

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented Mar 15, 2022

SUMMARY

Another take on #19148, fixing the tests with jest.isolateModules instead of making the component to get current time every time it is mounted.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

CI

ADDITIONAL INFORMATION

  • Has associated issue: fix: TimezoneSelector is not reliably testable #19148
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@ktmud
Copy link
Member Author

ktmud commented Mar 15, 2022

Managed to fix the tests with jest.isolateModules instead. I think this is good to go.

cc @suddjian

@ktmud ktmud changed the title test: fix a broken TimezoneSelector test test: TimezoneSelector on daylight saving time Mar 15, 2022
Copy link
Member

@suddjian suddjian left a comment

Choose a reason for hiding this comment

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

LGTM, learned a new jest thing 🎉

@codecov
Copy link

codecov bot commented Mar 15, 2022

Codecov Report

Merging #19156 (cf5d6a0) into master (bb618a4) will decrease coverage by 0.18%.
The diff coverage is 100.00%.

❗ Current head cf5d6a0 differs from pull request most recent head e86f73c. Consider uploading reports for the commit e86f73c to get more accurate results

@@            Coverage Diff             @@
##           master   #19156      +/-   ##
==========================================
- Coverage   66.55%   66.37%   -0.19%     
==========================================
  Files        1646     1646              
  Lines       63632    63631       -1     
  Branches     6476     6476              
==========================================
- Hits        42353    42232     -121     
- Misses      19597    19717     +120     
  Partials     1682     1682              
Flag Coverage Δ
hive ?
javascript 51.29% <ø> (+<0.01%) ⬆️
mysql 81.87% <100.00%> (ø)
postgres 81.92% <100.00%> (ø)
presto ?
python 81.97% <100.00%> (-0.39%) ⬇️
sqlite ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...frontend/src/components/TimezoneSelector/index.tsx 96.87% <ø> (+2.93%) ⬆️
superset/utils/async_query_manager.py 82.24% <100.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 70.00% <0.00%> (-15.77%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-5.65%) ⬇️
superset/db_engine_specs/sqlite.py 91.89% <0.00%> (-5.41%) ⬇️
superset/connectors/sqla/utils.py 88.23% <0.00%> (-3.93%) ⬇️
superset/utils/celery.py 86.20% <0.00%> (-3.45%) ⬇️
superset/result_set.py 96.77% <0.00%> (-1.62%) ⬇️
superset/databases/commands/test_connection.py 98.57% <0.00%> (-1.43%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb618a4...e86f73c. Read the comment docs.

@ktmud
Copy link
Member Author

ktmud commented Mar 15, 2022

A Cypress test is consistently failing. I don't think it is related to my changes because this PR only changes a unit test file. Will investigate nonetheless

@ktmud ktmud changed the title test: TimezoneSelector on daylight saving time test: fix TimezoneSelector on daylight saving time Mar 16, 2022
@ktmud ktmud changed the title test: fix TimezoneSelector on daylight saving time test: fix TimezoneSelector tests on daylight saving time Mar 16, 2022
@rusackas
Copy link
Member

If that failing test is unrelated, should we just skip it for now, and unblock the PR logjam?

@ktmud
Copy link
Member Author

ktmud commented Mar 16, 2022

@rusackas Let's see if the new commit mitigate it. If not, I'll just skip it.

@@ -55,49 +77,65 @@ it('use the default timezone when an invalid timezone is provided', async () =>
expect(onTimezoneChange).toHaveBeenLastCalledWith('Africa/Abidjan');
});

it.skip('can select a timezone values and returns canonical value', async () => {
test('render timezones in correct oder for standard time', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

nit (if you happen to need to push more changes):

Suggested change
test('render timezones in correct oder for standard time', async () => {
test('render timezones in correct order for standard time', async () => {

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like I don't... Will fix it in some other PR.

@ktmud ktmud merged commit 8d53db1 into apache:master Mar 16, 2022
villebro pushed a commit that referenced this pull request Apr 3, 2022
@john-bodley john-bodley deleted the fix-timezone-test branch June 8, 2022 05:33
@mistercrunch mistercrunch added 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels lts-v1 size/L 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants