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

Test failures caused by a changed wording of failure messages #6708

Closed
vatbub opened this issue Dec 11, 2023 · 5 comments · Fixed by #6710
Closed

Test failures caused by a changed wording of failure messages #6708

vatbub opened this issue Dec 11, 2023 · 5 comments · Fixed by #6710

Comments

@vatbub
Copy link
Contributor

vatbub commented Dec 11, 2023

Expected Behavior

The build and tests succeed when checking out origin/main

Observed Behavior

The build fails with the following message:

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':detektMain'.
    > Analysis failed with 3 weighted issues.

    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    > Get more help at https://help.gradle.org.

    BUILD FAILED in 29s
    3 actionable tasks: 3 executed
    "
    to contain:
      "failed with 3 issues." 
        at io.gitlab.arturbosch.detekt.JvmSpec.Type resolution on JVM(JvmSpec.kt:17)

The full build log is attached here: buildLog.txt

Amongst others, it fails at JvmSpec.kt line 17 which states:

assertThat(result.output).contains("failed with 3 issues.")

The actual output, however, contains "failed with 3 weighted issues.", so, changing the above line to

assertThat(result.output).contains("failed with 3 weighted issues.")

fixes the issue. I will shortly post a PR that contains all places where this is happening.

Steps to Reproduce

  1. Clone the repo
  2. Checkout origin/main (In particular, I ran this on 8e350ee7a895baacdbeb4480812cfb173ae750a8)
  3. Run ./gradlew build -x dokkaHtml

Context

N/A

Your Environment

  • Version of detekt used: N/A

  • Commit affected: 8e350ee7a895baacdbeb4480812cfb173ae750a8

  • Version of Gradle used (if applicable): 8.5

  • Gradle scan link (add --scan option when running the gradle task): https://gradle.com/s/bwo67jnwume24

  • Operating System and version: Windows 10 Version 21H2

  • Link to your project (if it's a public repository): N/A

@vatbub vatbub added the bug label Dec 11, 2023
vatbub pushed a commit to vatbub/detekt that referenced this issue Dec 11, 2023
@vatbub vatbub mentioned this issue Dec 11, 2023
@vatbub
Copy link
Contributor Author

vatbub commented Dec 11, 2023

I can also reproduce this locally with 7bbdb026e320600c1e97eaf199a266681d83f5e9. Funnily enough, the CI now fails on my PR because of those changes.

@vatbub
Copy link
Contributor Author

vatbub commented Dec 11, 2023

Hmm, even when I build detekt on our internal CI (which runs ubuntu), the same test failures happen and are fixed using my PR. It seems as if my CI and your CI use different versions of detekt, even though it is all built from the same commit...

@3flex
Copy link
Member

3flex commented Dec 11, 2023

Run ./gradlew publishToMavenLocal before the build. This is unfortunately a necessary step to make sure the functional tests are using artifacts produced by the build. Without that step the artifacts will be pulled from Maven Central and the behaviour won't always align, leading to these failures.

#6415 is stalled but should fix the build dependency issue which avoids this problem.

@vatbub
Copy link
Contributor Author

vatbub commented Dec 11, 2023 via email

@3flex
Copy link
Member

3flex commented Dec 12, 2023

Agreed, this should be covered in that doc. A PR is very welcome, thanks!

vatbub added a commit to vatbub/detekt that referenced this issue Dec 12, 2023
Adds a small note to Contributing.md that detekt needs to be built before running functional tests (Closes detekt#6708)
cortinico pushed a commit that referenced this issue Dec 13, 2023
Adds a small note to Contributing.md that detekt needs to be built before running functional tests (Closes #6708)
mgroth0 pushed a commit to mgroth0/detekt that referenced this issue Feb 11, 2024
Adds a small note to Contributing.md that detekt needs to be built before running functional tests (Closes detekt#6708)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants