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

add a test to keep available cron time zones in sync #15929

Merged
merged 2 commits into from
Aug 25, 2022

Conversation

mfsiega-airbyte
Copy link
Contributor

What

Add a test to keep the available cron timezone list in sync between frontend and backend.

How

(1) copy the frontend list into the server package; (2) for each timezone, check that the API accepts it; (3) leave a large comment and test failure message to point on that the frontend list should be updated if the test fails.

@mfsiega-airbyte mfsiega-airbyte requested review from a team and c-p-b and removed request for a team August 24, 2022 16:29
@github-actions github-actions bot added area/platform issues related to the platform area/server labels Aug 24, 2022
@mfsiega-airbyte mfsiega-airbyte requested a review from a team August 24, 2022 16:29
Comment on lines 659 to 671
final StandardSync actual = new StandardSync();
ConnectionScheduleHelper.populateSyncFromScheduleTypeAndData(actual,
ConnectionScheduleType.CRON, new ConnectionScheduleData()
.cron(new ConnectionScheduleDataCron()
.cronTimeZone(expectedTimezone)
.cronExpression(EXPECTED_CRON_EXPRESSION)));
assertEquals(ScheduleType.CRON, actual.getScheduleType());
assertEquals(expectedTimezone, actual.getScheduleData().getCron().getCronTimeZone());
assertEquals(EXPECTED_CRON_EXPRESSION, actual.getScheduleData().getCron().getCronExpression());
} catch (IllegalArgumentException | JsonValidationException e) {
throw (RuntimeException) new RuntimeException(
"One of the timezones is not supported - update airbyte-webapp/src/config/availableCronTimeZones.json!")
.initCause(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb question: what here is actually validating the cron string is valid? Put another way, trying to understand what part of the call chain changing here will require us changing the FE supported time zones.

Copy link
Contributor Author

@mfsiega-airbyte mfsiega-airbyte Aug 24, 2022

Choose a reason for hiding this comment

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

It's actually not super obvious, but: https://github.com/airbytehq/airbyte/blob/master/airbyte-server/src/main/java/io/airbyte/server/handlers/helpers/ConnectionScheduleHelper.java#L62 (which is in the API codepath) will throw an exception if we give it a bad timezone.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice! can we add this in as a comment for future readers?

@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets August 25, 2022 15:17 Inactive
@mfsiega-airbyte mfsiega-airbyte temporarily deployed to more-secrets August 25, 2022 15:43 Inactive
@mfsiega-airbyte mfsiega-airbyte merged commit dca92b0 into master Aug 25, 2022
@mfsiega-airbyte mfsiega-airbyte deleted the msiega/cronstrings branch August 25, 2022 15:53
rodireich pushed a commit that referenced this pull request Aug 25, 2022
* add a test to keep available cron time zones in sync

* clarify test comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform area/server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants