Skip to content
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

Don’t use cached autoconfig client in config tests #2120

Merged
merged 2 commits into from
May 21, 2017

Conversation

daveFNbuck
Copy link
Contributor

Description

In hdfs_test.ConfigurationTest, calls to hdfs.get_autoconfig_client return the version cached in the call to setUp. Because this is called before the config is set by the helpers.with_config decorator, this means that the tests aren’t actually testing different configurations.

Luckily, get_autoconfig_client takes an optional argument to specify its cache. When passing a fresh cache, these will actually test what they’re supposed to. This PR passes a fresh cache to get_autoconfig_client in each test.

Motivation and Context

While working on #2119 I tried copying code from the config tests to get a snakebite client and found that I was still getting the same responses as expected from a hadoop cli client. This is just applying my solution to that problem from #2119 to the config tests so they'll do what they're supposed to.

Have you tested this? If so, how?

I ran the unit tests with the isinstance check added but not the fix and the two that didn't use hadopcli failed. With the fix, they all succeed.

In hdfs_test.ConfigurationTest, calls to hdfs.get_autoconfig_client
return the version cached in the call to setUp. Because this is called
before the config is set by the helpers.with_config decorator, this
means that the tests aren’t actually testing different configurations.

Luckily, get_autoconfig_client takes an optional argument to specify its
cache. When passing a fresh cache, these will actually test what they’re
supposed to. This PR passes a fresh cache to get_autoconfig_client in
each test.
@mention-bot
Copy link

@daveFNbuck, thanks for your PR! By analyzing the history of the files in this pull request, we identified @freider, @lallea and @Tarrasch to be potential reviewers.

@Tarrasch
Copy link
Contributor

Nice catch. From the days Luigi didn't care for python 3 as much I suppose. :)

@Tarrasch Tarrasch merged commit 50ec7fe into spotify:master May 21, 2017
@daveFNbuck daveFNbuck deleted the actually_test_config branch May 23, 2017 17:54
This was referenced Jun 29, 2022
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.

3 participants