Skip to content

test: reduce and improve tests in fuzzy_schedule and dotnet#906

Merged
jamesadevine merged 1 commit into
mainfrom
test-reducer/fuzzy-schedule-dotnet-0c5567dd7e0a7626
Jun 8, 2026
Merged

test: reduce and improve tests in fuzzy_schedule and dotnet#906
jamesadevine merged 1 commit into
mainfrom
test-reducer/fuzzy-schedule-dotnet-0c5567dd7e0a7626

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/fuzzy_schedule.rs + src/runtimes/dotnet/extension.rs

What was wrong

  • test_cron_format (fuzzy_schedule.rs): only validated the minute (0–59) and hour (0–23) fields of the generated cron expression for a Daily schedule. The last three fields (day-of-month, month, day-of-week) were unchecked — a regression that added a day-of-week or day-of-month constraint would silently convert a daily schedule into a weekly or monthly one without any test failure.

  • test_generate_schedule_yaml (fuzzy_schedule.rs): always: true was not asserted. That flag is load-bearing: without it, ADO only fires the schedule when the target branch has new commits since the last run. Removing it from the template would cause pipelines to silently skip unconditional runs, and the old test would not catch it.

  • test_generate_schedule_yaml_with_branches (fuzzy_schedule.rs): same missing always: true assertion as above.

  • test_validate_global_json_sentinel_skips_injection_check (dotnet/extension.rs): the sole assertion was is_ok(). Since global.json contains no injection characters ($(, ${{, $[, ##vso[, {{, or newlines), validate() returns Ok regardless of whether the sentinel bypass exists. The test would pass even if the sentinel recognition code was deleted. This is a strict subset of the stronger test_validate_global_json_sentinel_accepted_with_file_present, which exercises the meaningful scenario (compile directory contains a global.json file and the sentinel version resolves the conflict).

Changes

Test File Action Reason
test_cron_format fuzzy_schedule.rs Rewritten Added assert_eq!(parts[2], "*"), assert_eq!(parts[3], "*"), assert_eq!(parts[4], "*")
test_generate_schedule_yaml fuzzy_schedule.rs Rewritten Added assert!(yaml.contains("always: true"))
test_generate_schedule_yaml_with_branches fuzzy_schedule.rs Rewritten Added assert!(yaml.contains("always: true"))
test_validate_global_json_sentinel_skips_injection_check dotnet/extension.rs Removed Vacuous — is_ok() always true; strict subset of test_validate_global_json_sentinel_accepted_with_file_present

Verification

  • cargo test: all 1 761 + integration tests pass ✅
  • cargo clippy --all-targets --all-features: no warnings ✅

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com
  • spsprodweu4.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"
    - "spsprodweu4.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Test Reducer · sonnet46 5.6M ·

fuzzy_schedule.rs:
- test_cron_format: add assertions that day-of-month, month, and
  day-of-week fields are '*' for a Daily schedule. Without these, a
  regression that added a day-of-week or day-of-month constraint would
  silently turn a daily schedule into a weekly or monthly one.
- test_generate_schedule_yaml / test_generate_schedule_yaml_with_branches:
  add 'assert!(yaml.contains("always: true"))'. The 'always: true' flag
  is load-bearing — without it ADO only fires the schedule when the
  target branch has new commits, silently skipping unconditional runs.
  Removing it from the template would pass the old tests undetected.

dotnet/extension.rs:
- Remove test_validate_global_json_sentinel_skips_injection_check.
  The assertion 'is_ok()' is vacuous: 'global.json' contains no
  injection characters, so validate() returns Ok regardless of whether
  the sentinel bypass exists. The stronger
  test_validate_global_json_sentinel_accepted_with_file_present already
  covers the meaningful scenario (compile_dir contains global.json,
  sentinel version resolves the conflict).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine marked this pull request as ready for review June 8, 2026 19:01
@jamesadevine jamesadevine merged commit 9fdbeb5 into main Jun 8, 2026
@jamesadevine jamesadevine deleted the test-reducer/fuzzy-schedule-dotnet-0c5567dd7e0a7626 branch June 8, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant