Skip to content

Fix DST-sensitive timestamp and cookie expiration tests - #136791

Merged
stephentoub merged 3 commits into
mainfrom
stephentoub-dst-test-fixes
Nov 2, 2026
Merged

stephentoub merged 3 commits into
mainfrom
stephentoub-dst-test-fixes

Conversation

@stephentoub

@stephentoub stephentoub commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

These tests can fail across DST transitions or when execution is delayed because they compare timezone information that the serialized formats do not preserve, or wait for short-lived cookies to expire.

  • Compare ZIP timestamps by their local date/time fields, matching the DOS timestamp stored in the archive rather than an offset reconstructed on reading.
  • Expire the stored CookieContainer cookies directly instead of waiting, and assert the container count and survival of unexpired cookies. These tests no longer require multithreading.
  • Discard the date when formatting expected xsd:time values, matching the serializer's current-local-offset behavior while preserving UTC compatibility-switch handling. Parse inputs using the invariant culture and add winter/summer cases.

stephentoub and others added 3 commits November 1, 2026 13:19
Compare the local date and time fields preserved by DOS timestamps rather than the timezone offset, matching the existing ZIP tests.

Co-authored-by: Copilot App <[email protected]>
Expire the stored cookies directly instead of relying on local wall-clock expiration and delays. Verify that pruning preserves the unexpired cookie and the container count.

Co-authored-by: Copilot App <[email protected]>
Discard the date before formatting expected xsd:time values, matching the serializer's current-offset behavior. Cover winter and summer inputs and parse them using the invariant culture.

Co-authored-by: Copilot App <[email protected]>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@stephentoub
stephentoub enabled auto-merge (squash) November 1, 2026 21:16

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@jkotas
jkotas requested a balanced review from Copilot November 2, 2026 06:55
@stephentoub
stephentoub merged commit 46cd67b into main Nov 2, 2026
87 checks passed
@stephentoub
stephentoub deleted the stephentoub-dst-test-fixes branch November 2, 2026 06:55

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.

🟢 Approval recommended

No active review issues are recorded for the test-only changes targeting DST- and timing-related failures.

No open issues 🎉

What changed in this PR

This test-only PR reduces DST- and timing-related failures in the compression, networking, and XML serialization test suites without changing production code.

Changes:

  • Compare ZIP timestamps by local date/time fields rather than offsets that the archive format does not preserve.
  • Expire stored cookies directly, removing delays and multithreading requirements while checking counts and surviving cookies.
  • Align expected xsd:time formatting with date-discarding behavior, use invariant parsing, and add winter/summer inputs.
File Description
src/​libraries/​System.Private.Xml/​tests/​XmlSerializer/​XmlSerializerTests.cs Adjusts expected time formatting and adds date-bearing test cases.
src/​libraries/​System.Net.Primitives/​tests/​UnitTests/​CookieContainerTest.cs Makes expiration tests synchronous and deterministic, with stronger assertions.
src/​libraries/​System.IO.Compression/​tests/​ZipArchive/​zip_UpdateTests.cs Compares timestamp fields preserved by ZIP serialization.

Review effort: Balanced

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants