Skip to content

Commit

Permalink
[SC-87654] Clean up several iffy unit tests
Browse files Browse the repository at this point in the history
This PR fixes unit tests that were violating the Delta specification, such as:

- Creating Delta logs directly in the table's directory, rather than a `_delta_log` subdirectory

Test change only, and the affected unit tests still pass.

GitOrigin-RevId: 5cbf3ae6149046d5a2642b83bfa64aaee6ca2b03
  • Loading branch information
ryan-johnson-databricks authored and Yaohua628 committed Oct 28, 2021
1 parent 685820b commit 323e909
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ trait OptimisticTransactionLegacyTests

test("block append against metadata change") {
withTempDir { tempDir =>
val log = DeltaLog(spark, new Path(tempDir.getCanonicalPath))
val log = DeltaLog.forTable(spark, tempDir)
// Initialize the log.
log.startTransaction().commitManually()

Expand All @@ -55,7 +55,7 @@ trait OptimisticTransactionLegacyTests

test("block read+append against append") {
withTempDir { tempDir =>
val log = DeltaLog(spark, new Path(tempDir.getCanonicalPath))
val log = DeltaLog.forTable(spark, tempDir)
// Initialize the log.
log.startTransaction().commitManually()

Expand All @@ -72,7 +72,7 @@ trait OptimisticTransactionLegacyTests

test("allow blind-append against any data change") {
withTempDir { tempDir =>
val log = DeltaLog(spark, new Path(tempDir.getCanonicalPath))
val log = DeltaLog.forTable(spark, tempDir)
// Initialize the log and add data.
log.startTransaction().commitManually(addA)

Expand All @@ -86,7 +86,7 @@ trait OptimisticTransactionLegacyTests

test("allow read+append+delete against no data change") {
withTempDir { tempDir =>
val log = DeltaLog(spark, new Path(tempDir.getCanonicalPath))
val log = DeltaLog.forTable(spark, tempDir)
// Initialize the log and add data. ManualUpdate is just a no-op placeholder.
log.startTransaction().commitManually(addA)

Expand Down Expand Up @@ -665,7 +665,7 @@ trait OptimisticTransactionLegacyTests
val actionWithMetaData = actions :+ metadata

withTempDir { tempDir =>
val log = DeltaLog(spark, new Path(tempDir.getCanonicalPath))
val log = DeltaLog.forTable(spark, tempDir)
// Initialize the log and add data. ManualUpdate is just a no-op placeholder.
log.startTransaction().commit(Seq(metadata), ManualUpdate)
log.startTransaction().commitManually(actionWithMetaData: _*)
Expand All @@ -675,7 +675,7 @@ trait OptimisticTransactionLegacyTests

test("allow concurrent set-txns with different app ids") {
withTempDir { tempDir =>
val log = DeltaLog(spark, new Path(tempDir.getCanonicalPath))
val log = DeltaLog.forTable(spark, tempDir)
// Initialize the log.
log.startTransaction().commitManually()

Expand All @@ -691,7 +691,7 @@ trait OptimisticTransactionLegacyTests

test("block concurrent set-txns with the same app id") {
withTempDir { tempDir =>
val log = DeltaLog(spark, new Path(tempDir.getCanonicalPath))
val log = DeltaLog.forTable(spark, tempDir)
// Initialize the log.
log.startTransaction().commitManually()

Expand Down

0 comments on commit 323e909

Please sign in to comment.