Stale SHA Validation Test in ValidateGuidesTaskSpec Causes Test Suite Failure

Open Beginner friendly
#554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
groovy

Research direction

Open buildSrc/src/test/groovy/website/gradle/tasks/ValidateGuidesTaskSpec.groovy and review the stale SHA rejection test and the sha entry in VALID_MINIMAL. Run ./gradlew -p buildSrc test --tests "website.gradle.tasks.ValidateGuidesTaskSpec" before and after the cleanup; done means all eight tests pass and the fixture matches the current ValidateGuidesTask schema.

Written by the indexing model from the issue text.

Description

Description

In commit 35d2834c, the task VendorGuideTask and all dead sampleRef.sha fields were retired, and ValidateGuidesTask had its SHA_40_HEX regex and sampleRef.sha validation logic removed. However, the test method shape mode rejects a non-40-char SHA and the sha: entry in the VALID_MINIMAL fixture in buildSrc/src/test/groovy/website/gradle/tasks/ValidateGuidesTaskSpec.groovy were inadvertently left behind. Because ValidateGuidesTask no longer validates or rejects non-40-character SHAs, running the test suite causes ValidateGuidesTaskSpec to fail with WrongExceptionThrownError: Expected exception of type 'org.gradle.api.GradleException', but no exception was thrown.

Steps to Reproduce

  1. Open a terminal in the root of the repository.
  2. Run ./gradlew -p buildSrc test --tests "website.gradle.tasks.ValidateGuidesTaskSpec".
  3. Inspect the test output.
  4. See error: ValidateGuidesTaskSpec > shape mode rejects a non-40-char SHA FAILED.

Expected Behavior

The test suite in buildSrc should pass cleanly and accurately reflect the current schema rules of ValidateGuidesTask (where SHA is no longer validated).

Actual Behavior / Error Logs

ValidateGuidesTaskSpec > shape mode rejects a non-40-char SHA STANDARD_OUT
    [validateGuides] mode=shape: 1 guide(s) parsed, 0 SKIP-warned, 0 errors

ValidateGuidesTaskSpec > shape mode rejects a non-40-char SHA FAILED
    org.spockframework.runtime.WrongExceptionThrownError: Expected exception of type 'org.gradle.api.GradleException', but no exception was thrown
        at org.spockframework.lang.SpecInternals.checkExceptionThrown(SpecInternals.java:84)
        at org.spockframework.lang.SpecInternals.thrownImpl(SpecInternals.java:67)
        at website.gradle.tasks.ValidateGuidesTaskSpec.shape mode rejects a non-40-char SHA(ValidateGuidesTaskSpec.groovy:68)

8 tests completed, 1 failed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///D:/grails-static-website/buildSrc/build/reports/tests/test/index.html
Dominant language
Groovy
Stars
31
Forks
100
Avg merge
19h 2m
Merged PRs (30d)
15

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/grails-static-website

All issues in apache/grails-static-website

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.