Skip to content

Flaky test fails intermittently in GitHub Action #821

Closed

Description

@johnjaylward

Test case passes on some runs and fails on others: org.json.junit.JSONObjectTest.issue654StackOverflowInputWellFormed

Appears to be due to differences in resources available on each run. The exception expected is a "JSONException", but that's because it is wrapping a "StackOverflowError". StackOverflowError is going to be dependent on the environment and may not hit consistently.

Activity

  1. rudrajyotib commented on Oct 28, 2023

    @rudrajyotib
    Contributor

    I think this test case should be removed, as it never guarantees the behavior. To identify the max depth supported, we can test through configuration. And environment resource related runtime error expectation need not be tested.

  2. stleary commented on Oct 29, 2023

    @stleary
    Owner

    Might be better to see if the test can be fixed, although if you see a chance to add a unit test, that is fine too.

  3. johnjaylward commented on Oct 30, 2023

    @johnjaylward
    ContributorAuthor

    @stleary , I'm leaning towards just marking the test as a "skip/ignore" or removing it altogether. It seems like this test would need regular maintenance to ensure that it was consistently hitting stack overflows.

    @Ignore("This test relies on system constraints and may not always pass.")
    @Test(expected = JSONException.class) 
     public void issue654StackOverflowInputWellFormed() { 
         //String input = new String(java.util.Base64.getDecoder().decode(base64Bytes)); 
         final InputStream resourceAsStream = JSONObjectTest.class.getClassLoader().getResourceAsStream("Issue654WellFormedObject.json"); 
         JSONTokener tokener = new JSONTokener(resourceAsStream); 
         JSONObject json_input = new JSONObject(tokener); 
         assertNotNull(json_input); 
         fail("Excepected Exception."); 
     } 
  4. stleary commented on Oct 31, 2023

    @stleary
    Owner

    @johnjaylward Fair enough, better to silence the test, than have it fail intermittently.

  5. rudrajyotib commented on Nov 4, 2023

    @rudrajyotib
    Contributor

    @johnjaylward - are you annotating the test with Ignore?

  6. added 2 commits that reference this issue on Nov 6, 2023
    13907a5
    a3742ac
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions