Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-34231

AvroSuite has test failure when run from IDE due to bad loading of resource file

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 2.4.8, 3.0.2, 3.1.1
    • Component/s: SQL, Tests
    • Labels:
      None

      Description

      Within AvroSuite the test Ignore corrupt Avro file if flag IGNORE_CORRUPT_FILES enabled attempts to load a resource file like:

              val srcFile = new File("src/test/resources/episodes.avro")
              val destFile = new File(dir, "episodes.avro")
              FileUtils.copyFile(srcFile, destFile)
      

      This works okay when tests are run via Maven/sbt , but really isn't the right way to access a resource, causing failures when run via IntelliJ, and actually episodes.avro has already been loaded properly as episodesAvro. Switch over to loading it properly:

              Files.copy(
                Paths.get(new URL(episodesAvro).toURI),
                Paths.get(dir.getCanonicalPath, "episodes.avro"))
      

        Attachments

          Activity

            People

            • Assignee:
              xkrogen Erik Krogen
              Reporter:
              xkrogen Erik Krogen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: