Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-3070

PigTest - Patch for PIG-3027 - Pls review to see if trim required after replacing all "\r\n" with "\n" to avoid additional newline at end of expected string.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 0.10.0
    • 0.12.0
    • build
    • None
    • Patch Available

    Description

      Ref Patch: https://issues.apache.org/jira/secure/attachment/12552008/PIG-3027.trunk.1.patch

      With the above patch fix:
      readFile(expected).replaceAll("\r\n", "\n") gives the expected file contents as (note: the exp file does not contain a "\n" after the last line of text):
      ~~~~~~~~~~~~~~~~~~~~
      (yahoo,25)
      (facebook,15)
      (twitter,7)

      12/11/28 02:59:06 INFO pigunit.PigTest:..............
      ~~~~~~~~~~~~~~~~~~~~

      And the test case fails with:
      ~~~~~~~~~~~~~~~~~~~~
      junit.framework.ComparisonFailure: expected:<...book,15)
      (twitter,7)[
      ]> but was:<...book,15)
      (twitter,7)[]>
      at junit.framework.Assert.assertEquals(Assert.java:85)
      at junit.framework.Assert.assertEquals(Assert.java:91)
      ~~~~~~~~~~~~~~~~~~~~

      After adding trim to the above patch:
      readFile(expected).replaceAll("\r\n", "\n").trim() gives the expected file contents as:
      ~~~~~~~~~~~~~~~~~~~~
      (yahoo,25)
      (facebook,15)
      (twitter,7)
      12/11/28 03:10:06 INFO pigunit.PigTest:..............
      ~~~~~~~~~~~~~~~~~~~~
      And the above test case passed.

      Please review if trim should be added to avoid the additional newline at the end of expected string.

      Pls note: I was running the tests in rhel environment.

      Thank you.

      Attachments

        Activity

          People

            daijy Daniel Dai
            srgv Raghavendra Saravanamurthy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: