Don’t use cached autoconfig client in config tests #2120
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.