Skip to content

[SPARK-17740] Spark tests should mock / interpose HDFS to ensure that streams are closed #15306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

ericl
Copy link
Contributor

@ericl ericl commented Sep 30, 2016

What changes were proposed in this pull request?

As a followup to SPARK-17666, ensure filesystem connections are not leaked at least in unit tests. This is done here by intercepting filesystem calls as suggested by @JoshRosen . At the end of each test, we assert no filesystem streams are left open.

This applies to all tests using SharedSQLContext or SharedSparkContext.

How was this patch tested?

I verified that tests in sql and core are indeed using the filesystem backend, and fixed the detected leaks. I also checked that reverting #15245 causes many actual test failures due to connection leaks.

@rxin
Copy link
Contributor

rxin commented Sep 30, 2016

Thanks - this is super useful!

@rxin
Copy link
Contributor

rxin commented Sep 30, 2016

cc @srowen want to review this?

@SparkQA
Copy link

SparkQA commented Sep 30, 2016

Test build #66143 has finished for PR 15306 at commit 1d80d2e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • trait SharedSQLContext extends SQLTestUtils with BeforeAndAfterEach

@SparkQA
Copy link

SparkQA commented Sep 30, 2016

Test build #66155 has finished for PR 15306 at commit 401b447.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented Oct 1, 2016

Merging in master. Thanks!

@asfgit asfgit closed this in 4bcd9b7 Oct 1, 2016
@rxin
Copy link
Contributor

rxin commented Oct 1, 2016

btw @davies this actually already checks driver side, so we are good here.

@marmbrus
Copy link
Contributor

This is good thing for us to test. However, If you throw an exception in your test that opens a file, it seems that it swallows the exception just telling you that you are leaking files. Is there anyway we could make this less confusing?

@ericl
Copy link
Contributor Author

ericl commented Jun 13, 2017

Hm, we could move the actual throw to the afterAll(), that would cause a suite abort instead but presumably leave the test errors intact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants