mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-11-06 05:17:08 +00:00
The setup and teardown functions intended for TestOSFileTypeChecker suggest that it was intended to use real files where possible, but it doesn't (or no longer does). This reworks the test function to use a temporary directory and real files for all appropriate tests (based on directories and files), and adds scenarios to cover the various code paths in the checkType(). The resulting coverage includes all the code covered by TestHostPathTypeCheckerInternal, so the latter can be dropped, which allows checkType() to be simplified and the whole hostPathTypeChecker interface and implementations to be dropped. Type checks all end up comparing strings returned by HostUtils, so the IsDir(), IsFile() etc. functions are also dropped in favour of direct type comparisons. Overall hostpath test coverage increases from 65.8% to 68.1%, on fewer lines of code. Signed-off-by: Stephen Kitt <skitt@redhat.com>