Skip to content

Add regression test for ADF schedule trigger time zone IDs - #2237

Open
RolandKrummenacher wants to merge 3 commits into
devfrom
test/adf-trigger-timezone-regression
Open

Add regression test for ADF schedule trigger time zone IDs#2237
RolandKrummenacher wants to merge 3 commits into
devfrom
test/adf-trigger-timezone-regression

Conversation

@RolandKrummenacher

@RolandKrummenacher RolandKrummenacher commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

🛠️ Description

Data Factory schedule triggers validate the timeZone field against Windows time zone IDs (the set enumerated by [TimeZoneInfo]::GetSystemTimeZones() / Get-TimeZone -ListAvailable on Windows). An invalid value — such as the display name Japan Standard Time instead of the Windows ID Tokyo Standard Time, fixed in #2236 — passes template deployment but fails later at trigger activation with ErrorCode=InvalidWorkflowTriggerRecurrence.

This PR adds regression coverage so this class of bug is caught in CI instead of at deployment time, and fixes the shipped deploy templates that had already drifted:

  • New unit test src/powershell/Tests/Unit/HubsAdfTriggerTimeZones.Tests.ps1 parses the timezoneobject mapping in timeZones.bicep and verifies:
    • every mapped value resolves in the Windows time zone registry, with exact casing against the canonical ID (runs on the existing Windows-latest Pester job, i.e. against the same ID set ADF validates);
    • no value is an IANA-style ID (Area/Location) or a known display-name trap (Japan Standard Time, Universal Coordinated Time);
    • every region key matches the toLower(replace(location, ' ', '')) lookup normalization and exists in src/open-data/Regions.csv;
    • the fallback stays pinned to the valid Windows ID 'UTC';
    • a parser guard fails loudly if the bicep/template layout changes (no silent zero-case green run).
  • Shipped artifact coverage (from the #2236 review discussion): the same registry checks also run against the compiled templates users actually deploy from, docs/deploy/finops-hub-latest.json and finops-hub-preview.json, since those are regenerated at release time and can lag a src fix. Older versioned templates are historical artifacts and intentionally not covered.
  • Deploy template fixes: running the new checks surfaced that the shipped templates had already drifted — beyond the Japan entries in finops-hub-latest.json/finops-hub-14.0.json, finops-hub-preview.json shipped a whole set of pre-fix display names (Australian Eastern Standard Time, Brasil Standard Time, Central European Time, Greenwich Mean Time, Japan Standard Time) that all fail trigger activation. This PR surgically corrects those 24 mapping values to the Windows IDs matching the current src mapping (diff is limited to mapping lines only; no full template regeneration, to avoid pulling unreleased dev changes into released artifacts). northeurope maps to GMT Standard Time per src, not W. Europe Standard Time.
  • Workflow change: dev.yml now also triggers the Pester job on changes to timeZones.bicep, finops-hub-latest.json, and finops-hub-preview.json (same pattern as the existing KQL path filters).

On non-Windows machines the registry checks are skipped (-Skip:(-not $IsWindows)) since .NET resolves time zones via ICU/IANA there; the structural checks still run cross-platform.

⚠️ Merge order: depends on #2236. Against current dev the test fails on exactly the two Japan Standard Time entries in timeZones.bicep (that's the bug it exists to catch); the deploy-template checks are green with the fixes in this PR. Keeping this as a draft until #2236 is merged.

📷 Screenshots

Verified in both directions locally (Windows):

🙋‍♀️ Checklist

  • I ran the tests locally
  • The change is covered by automated tests

🤖 Generated with Claude Code

Data Factory schedule triggers validate the timeZone field against
Windows time zone IDs; an invalid value (e.g. the display name
'Japan Standard Time' instead of the Windows ID 'Tokyo Standard Time',
fixed in #2236) passes deployment but fails at trigger activation.

Adds a Pester test that parses timeZones.bicep and verifies every
mapping resolves in the Windows time zone registry with exact casing,
rejects IANA-style and display-name IDs, checks region keys against
open data, and pins the 'UTC' fallback. Extends the PowerShell Tests
workflow paths to trigger on timeZones.bicep changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…loy templates

The compiled templates in docs/deploy are regenerated at release time and
lagged the src fixes: finops-hub-latest.json and finops-hub-14.0.json still
mapped Japan regions to the display name 'Japan Standard Time', and
finops-hub-preview.json shipped a whole set of pre-fix display names
(Australian Eastern/Brasil/Central European/Greenwich Mean) that fail ADF
trigger activation. Surgically corrects the mapping values to the Windows
time zone IDs matching the current src mapping (northeurope goes to
'GMT Standard Time' per src, not W. Europe).

Extends HubsAdfTriggerTimeZones.Tests.ps1 to also validate the mappings in
finops-hub-latest.json and finops-hub-preview.json so shipped artifacts
can no longer drift invalid, and adds those paths to the Pester workflow
triggers. Raised in the PR #2236 review discussion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@RolandKrummenacher RolandKrummenacher added this to the v15 milestone Aug 5, 2026
@RolandKrummenacher
RolandKrummenacher marked this pull request as ready for review August 5, 2026 16:25
Copilot AI lite review requested due to automatic review settings August 5, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds regression coverage to ensure Azure Data Factory schedule-trigger timeZone values used by FinOps hubs remain valid Windows time zone IDs (as validated by ADF at trigger activation time), and updates shipped deploy templates that had drifted to invalid display-name values.

Changes:

  • Adds a new Pester unit test that parses timeZones.bicep and verifies mappings are valid (including canonical ID casing on Windows) and region keys match the expected normalization / open-data region set.
  • Extends the same Windows-registry validation to the shipped deploy artifacts (finops-hub-latest.json and finops-hub-preview.json) and adds parser guards to avoid silent “zero testcases” passes.
  • Fixes invalid time zone mapping values in deploy templates (notably replacing display names with valid Windows time zone IDs) and updates the dev workflow path filters to run the Pester job when these mapping sources change.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/powershell/Tests/Unit/HubsAdfTriggerTimeZones.Tests.ps1 New unit tests validating time zone mappings in source bicep and shipped templates, with Windows-registry validation and structural guards.
docs/deploy/finops-hub-preview.json Corrects multiple region mappings from display names to valid Windows time zone IDs in the shipped preview template.
docs/deploy/finops-hub-latest.json Fixes Japan region mapping values to a valid Windows time zone ID in the shipped latest template (both embedded mapping blocks).
docs/deploy/finops-hub-14.0.json Applies the same Japan mapping fix to the versioned 14.0 shipped template (both embedded mapping blocks).
.github/workflows/dev.yml Expands pull-request path filters so PowerShell tests run when timeZones.bicep or the shipped deploy templates change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Review 👀 PR that is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants