Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-13231

org.apache.cassandra.db.DirectoriesTest(testStandardDirs) unit test failing

    XMLWordPrintableJSON

Details

    • Normal

    Description

      The testStandardDirs(org.apache.cassandra.db.DirectoriesTest) unit test always fails. This appears to be due to a commit by Yuki for CASSANDRA-10587 which switched the SSTable descriptor to use the canonical path.

      From one of Yuki's comments in CASSANDRA-10587:
      "I ended up fixing Descriptor object to always have canonical path as its directory.
      This way we don't need to think about given directory is relative or absolute.
      In fact, right now Desctiptor (and corresponding SSTable) is not considered equal between Descriptor's directory being relative and absolute. (Added simple unit test to DescriptorTest)."

      The issue here is that canonical path will expand out differently than even absolute path. In this case /var/folders -> /private/var/folders. The unit test is looking for /var/folders/... but the Descriptor expands out to /private/var/folders and the unit test fails.

      Descriptor#L88 seems to be the real root cause.

      [junit] Testcase: testStandardDirs(org.apache.cassandra.db.DirectoriesTest): FAILED
      [junit] expected:</var/folders/fk/5j141flj5kbg_01sfvbwgckm0000gn/T/cassandra3608150262426920207unittest/ks/cf1-f5cce670f32311e689fe991a3af9a2eb/snapshots/42> but was:</private/var/folders/fk/5j141flj5kbg_01sfvbwgckm0000gn/T/cassandra3608150262426920207unittest/ks/cf1-f5cce670f32311e689fe991a3af9a2eb/snapshots/42>
      [junit] junit.framework.AssertionFailedError: expected:</var/folders/fk/5j141flj5kbg_01sfvbwgckm0000gn/T/cassandra3608150262426920207unittest/ks/cf1-f5cce670f32311e689fe991a3af9a2eb/snapshots/42> but was:</private/var/folders/fk/5j141flj5kbg_01sfvbwgckm0000gn/T/cassandra3608150262426920207unittest/ks/cf1-f5cce670f32311e689fe991a3af9a2eb/snapshots/42>
      [junit] at org.apache.cassandra.db.DirectoriesTest.testStandardDirs(DirectoriesTest.java:159)
      [junit]
      [junit]
      [junit] Test org.apache.cassandra.db.DirectoriesTest FAILED

      I'm guessing given we went to canonicalPath() on purpose the "fix" here is to call .getCanonicalFile() on both expected Files generated (snapshotDir and backupsDir) for the junit assert.

      Attachments

        1. 674.diff
          1 kB
          Michael Kjellman

        Activity

          People

            mkjellman Michael Kjellman
            mkjellman Michael Kjellman
            Michael Kjellman
            Jason Brown
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: