Skip to content

Commit fd3bb21

Browse files
committed
modify the test case
1 parent 552955a commit fd3bb21

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/FileIndexSuite.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class FileIndexSuite extends SharedSQLContext {
182182
test("refresh for InMemoryFileIndex with FileStatusCache") {
183183
withTempDir { dir =>
184184
val fileStatusCache = FileStatusCache.getOrCreate(spark)
185-
val dirPath = new Path(dir.getCanonicalPath)
185+
val dirPath = new Path(dir.getAbsolutePath)
186186
val catalog = new InMemoryFileIndex(spark, Seq(dirPath), Map.empty,
187187
None, fileStatusCache) {
188188
def leafFilePaths: Seq[Path] = leafFiles.keys.toSeq
@@ -197,11 +197,13 @@ class FileIndexSuite extends SharedSQLContext {
197197

198198
catalog.refresh()
199199

200-
val path = new Path(file.getCanonicalPath)
201-
assert(catalog.leafFilePaths.nonEmpty && catalog
202-
.leafFilePaths.forall(p => p.toString.startsWith("file:/")))
203-
assert(catalog.leafDirPaths.nonEmpty && catalog
204-
.leafDirPaths.forall(p => p.toString.startsWith("file:/")))
200+
assert(catalog.leafFilePaths.size == 1)
201+
assert(catalog.leafFilePaths.head.toString.stripSuffix("/") ==
202+
s"file:${file.getAbsolutePath.stripSuffix("/")}")
203+
204+
assert(catalog.leafDirPaths.size == 1)
205+
assert(catalog.leafDirPaths.head.toString.stripSuffix("/") ==
206+
s"file:${dir.getAbsolutePath.stripSuffix("/")}")
205207
}
206208
}
207209
}

0 commit comments

Comments
 (0)