Skip to content

Fix broken CI/CD pipeline #1930

Closed
Closed

Description

@remkop

Fix broken tests:

  • a recent change used a Java 1.7+ API which results in broken tests when running on Java 1.6 or earlier:
:compileJava/home/runner/work/picocli/picocli/src/main/java/picocli/CommandLine.java:11634:
 <T>emptyEnumeration() is not public in java.util.Collections; 
cannot be accessed from outside package

The solution is to use Collections.enumeration(Collections.emptyList()) instead.

  • Broken tests using System.setSecurityManager on Java 18-ea -> does not manifest on Java GA, separate ticket System-Rules based tests migration #1932

  • ManPageGeneratorTest has 3 failing tests (testEndOfOptionsWithoutOptions - line 307, testNamelessCommand line 489 and testHiddenOptions line 242), likely related to Update option rendering (fixes #1886) #1896

  • Java 10 on Ubuntu fails the build due to a problem in release-tasks.gradle:

> startup failed:
  script '/home/runner/work/picocli/picocli/gradle/release-tasks.gradle': 1: 
  Can't have an abstract method in a non-abstract class. 
  The class '_BuildScript_' must be declared abstract or the method 
  'void init(java.lang.Object, org.gradle.internal.service.ServiceRegistry)' must be implemented.
   @ line 1, column 1.
     task bumpReadmeVersion {

This may be caused by this change in gradle/wrapper/gradle-wrapper.properties, which bumped Gradle from 7.4 to 7.6...

Temporary fix is to revert to Gradle 7.4.

  • Flaky tests? Broken tests on Java 10 ubuntu:
picocli.HelpAnsiTest > testUsageMainCommand_ANSI FAILED
    org.junit.ComparisonFailure at HelpAnsiTest.java:442
stty: /dev/tty: No such device or address

picocli.HelpTest > testMapFieldHelp_with_unlimitedSplit FAILED
    org.junit.ComparisonFailure at HelpTest.java:2926

2327 tests completed, 2 failed, 27 skipped

Solution: skip non-LTS versions of Java

Activity

  1. added this to the 4.7.1 milestone on Jan 23, 2023
  2. added 14 commits that reference this issue on Jan 24, 2023
  3. changed the title [-]Fix broken CI/CD[/-] [+]Fix broken CI/CD pipeline[/+] on Jan 25, 2023
  4. MikeTheSnowman commented on Jan 27, 2023

    @MikeTheSnowman
    Contributor

    @remkop , In regards to the chanes made to ManPageGenerator from PR #1896, I'm currently looking at the three failed tests in ManPageGeneratorTest and I have a few questions/comments for you so that I can update the tests appropriately.

    Test testEndOfOptionsWithoutOptions:

    This test expects that if a command has no options, then the "options" section in the ascii doc will still get generated. Now that PR #1896 has been merged, do you still want an empty "options" section in the ascii docs to be generated, or would you like for the test to be updated to expect for that section to be missing?

    For reference, here's a screenshot showing a diff of the expected ascii doc vs the ascii doc that got generated:
    image

    Tests testNamelessCommand and testHiddenOptions:

    These tests are failing simply because of an extra white space in various locations or newlines that get added. Not sure if this behavior is acceptable, but I looks harmeless to me, so I'll just update the test cases to accept the extra new lines and white spaces. Based on the updates in #1896, it's not immediately obvious to me why this is now happening. Here's a screenshot of the diffs for reference.

    Diff from testNamelessCommand failed test outputs. This one is when compairing main_class.adoc:
    image

    Diff from testHiddenOptions failed test output:
    image

    To try and not hold you up, I've raised PR with updated test that just accept the whatever the newly generated stuff in the ascii docs. Please see PR #1940.

  5. added a commit that references this issue on Jan 27, 2023
  6. remkop commented on Jan 27, 2023

    @remkop
    OwnerAuthor

    @wtfacoconut Thank you for the PR! Looks good and it is merged. Many thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions