@@ -31,7 +31,7 @@ import org.scalatest.funsuite.AnyFunSuite
31
31
32
32
class CatalogManagedEnablementSuite extends AnyFunSuite with TestUtils {
33
33
34
- case class CatalogManagedEnablementTestCase (
34
+ case class CatalogManagedTestCase (
35
35
testName : String ,
36
36
operationType : String , // "CREATE", "UPDATE", or "REPLACE"
37
37
initialTableProperties : Map [String , String ] = Map .empty,
@@ -42,42 +42,51 @@ class CatalogManagedEnablementSuite extends AnyFunSuite with TestUtils {
42
42
expectedCatalogManagedSupported : Boolean = false )
43
43
44
44
val catalogManagedTestCases = Seq (
45
- CatalogManagedEnablementTestCase (
46
- testName = " CREATE: catalogManaged enablement flag => enables catalogManaged and ICT" ,
45
+ // ===== CREATE cases =====
46
+ CatalogManagedTestCase (
47
+ testName = " CREATE: set catalogManaged=supported => enables catalogManaged and ICT" ,
47
48
operationType = " CREATE" ,
48
49
transactionProperties = Map (" delta.feature.catalogOwned-preview" -> " supported" ),
49
50
expectedSuccess = true ,
50
51
expectedIctEnabled = true ,
51
52
expectedCatalogManagedSupported = true ),
52
- CatalogManagedEnablementTestCase (
53
- testName = " UPDATE: catalogManaged enablement flag => enables catalogManaged and ICT" ,
53
+ CatalogManagedTestCase (
54
+ testName = " ILLEGAL CREATE: set catalogManaged=supported and explicitly disable ICT => THROW" ,
55
+ operationType = " CREATE" ,
56
+ transactionProperties = Map (
57
+ " delta.feature.catalogOwned-preview" -> " supported" ,
58
+ " delta.enableInCommitTimestamps" -> " false" ),
59
+ expectedSuccess = false ,
60
+ expectedExceptionMessage =
61
+ Some (" Cannot disable inCommitTimestamp when enabling catalogManaged" )),
62
+
63
+ // ===== UPDATE cases =====
64
+ CatalogManagedTestCase (
65
+ testName = " UPDATE: set catalogManaged=supported => enables catalogManaged and ICT" ,
54
66
operationType = " UPDATE" ,
55
67
initialTableProperties = Map .empty, // Start with basic table
56
68
transactionProperties = Map (" delta.feature.catalogOwned-preview" -> " supported" ),
57
69
expectedSuccess = true ,
58
70
expectedIctEnabled = true ,
59
71
expectedCatalogManagedSupported = true ),
60
- CatalogManagedEnablementTestCase (
61
- testName = " UPDATE: catalogManaged enablement flag => enables ICT if previously disabled" ,
72
+ CatalogManagedTestCase (
73
+ testName = " UPDATE: set catalogManaged=supported => enables ICT if previously disabled" ,
62
74
operationType = " UPDATE" ,
63
75
initialTableProperties = Map (" delta.enableInCommitTimestamps" -> " false" ),
64
76
transactionProperties = Map (" delta.feature.catalogOwned-preview" -> " supported" ),
65
77
expectedSuccess = true ,
66
78
expectedIctEnabled = true ,
67
79
expectedCatalogManagedSupported = true ),
68
- CatalogManagedEnablementTestCase (
69
- testName =
70
- " ILLEGAL CREATE: catalogManaged enablement flag but ICT explicitly disabled too => THROW" ,
71
- operationType = " CREATE" ,
72
- transactionProperties = Map (
73
- " delta.feature.catalogOwned-preview" -> " supported" ,
74
- " delta.enableInCommitTimestamps" -> " false" ),
75
- expectedSuccess = false ,
76
- expectedExceptionMessage =
77
- Some (" Cannot disable inCommitTimestamp when enabling catalogManaged" )),
78
- CatalogManagedEnablementTestCase (
79
- testName =
80
- " ILLEGAL UPDATE: catalogManaged enablement flag but ICT explicitly disabled too => THROW" ,
80
+ CatalogManagedTestCase (
81
+ testName = " UPDATE: set catalogManaged=supported and ICT already enabled => Okay" ,
82
+ operationType = " UPDATE" ,
83
+ initialTableProperties = Map (" delta.enableInCommitTimestamps" -> " true" ),
84
+ transactionProperties = Map (" delta.feature.catalogOwned-preview" -> " supported" ),
85
+ expectedSuccess = true ,
86
+ expectedIctEnabled = true ,
87
+ expectedCatalogManagedSupported = true ),
88
+ CatalogManagedTestCase (
89
+ testName = " ILLEGAL UPDATE: set catalogManaged=supported and disable ICT => THROW" ,
81
90
operationType = " UPDATE" ,
82
91
initialTableProperties = Map .empty,
83
92
transactionProperties = Map (
@@ -86,38 +95,48 @@ class CatalogManagedEnablementSuite extends AnyFunSuite with TestUtils {
86
95
expectedSuccess = false ,
87
96
expectedExceptionMessage =
88
97
Some (" Cannot disable inCommitTimestamp when enabling catalogManaged" )),
89
- CatalogManagedEnablementTestCase (
90
- testName = " UPDATE: catalogManaged enablement flag => ICT already enabled " ,
98
+ CatalogManagedTestCase (
99
+ testName = " ILLEGAL UPDATE: catalogManaged already supported, then disable ICT => THROW " ,
91
100
operationType = " UPDATE" ,
92
- initialTableProperties = Map (" delta.enableInCommitTimestamps " -> " true " ),
93
- transactionProperties = Map (" delta.feature.catalogOwned-preview " -> " supported " ),
94
- expectedSuccess = true ,
95
- expectedIctEnabled = true ,
96
- expectedCatalogManagedSupported = true ),
97
- CatalogManagedEnablementTestCase (
98
- testName = " No-op : catalogManaged not being enabled should not affect ICT" ,
101
+ initialTableProperties = Map (" delta.feature.catalogOwned-preview " -> " supported " ),
102
+ transactionProperties = Map (" delta.enableInCommitTimestamps " -> " false " ),
103
+ expectedSuccess = false ,
104
+ expectedExceptionMessage =
105
+ Some ( " Cannot disable inCommitTimestamp on a catalogManaged table " ) ),
106
+ CatalogManagedTestCase (
107
+ testName = " NO-OP UPDATE : catalogManaged not being enabled should not affect ICT" ,
99
108
operationType = " UPDATE" ,
100
109
initialTableProperties = Map .empty,
101
110
transactionProperties = Map (),
102
111
expectedSuccess = true ,
103
112
expectedIctEnabled = false ,
104
113
expectedCatalogManagedSupported = false ),
105
- CatalogManagedEnablementTestCase (
106
- testName = " ILLEGAL REPLACE: catalogManaged enablement flag => THROW" ,
114
+
115
+ // ===== REPLACE cases =====
116
+ CatalogManagedTestCase (
117
+ testName = " REPLACE: normal replace should succeed on a catalogManaged table" ,
118
+ operationType = " REPLACE" ,
119
+ initialTableProperties = Map (" delta.feature.catalogOwned-preview" -> " supported" ),
120
+ transactionProperties = Map (),
121
+ expectedSuccess = true ,
122
+ expectedIctEnabled = true ,
123
+ expectedCatalogManagedSupported = true ),
124
+ CatalogManagedTestCase (
125
+ testName = " ILLEGAL REPLACE: set catalogManaged=supported => THROW" ,
107
126
operationType = " REPLACE" ,
108
127
initialTableProperties = Map .empty,
109
128
transactionProperties = Map (" delta.feature.catalogOwned-preview" -> " supported" ),
110
129
expectedSuccess = false ,
111
130
expectedExceptionMessage =
112
131
Some (" Cannot enable the catalogManaged feature during a REPLACE command." )),
113
- CatalogManagedEnablementTestCase (
114
- testName = " REPLACE: should succeed on a catalogManaged table " ,
132
+ CatalogManagedTestCase (
133
+ testName = " ILLEGAL REPLACE: catalogManaged already supported, then disable ICT => THROW " ,
115
134
operationType = " REPLACE" ,
116
135
initialTableProperties = Map (" delta.feature.catalogOwned-preview" -> " supported" ),
117
- transactionProperties = Map (),
118
- expectedSuccess = true ,
119
- expectedIctEnabled = true ,
120
- expectedCatalogManagedSupported = true ))
136
+ transactionProperties = Map (" delta.enableInCommitTimestamps " -> " false " ),
137
+ expectedSuccess = false ,
138
+ expectedExceptionMessage =
139
+ Some ( " Cannot disable inCommitTimestamp on a catalogManaged table " ) ))
121
140
122
141
catalogManagedTestCases.foreach { testCase =>
123
142
test(testCase.testName) {
@@ -199,7 +218,7 @@ class CatalogManagedEnablementSuite extends AnyFunSuite with TestUtils {
199
218
} else {
200
219
// Transaction building should fail
201
220
val exception = intercept[Exception ] {
202
- txnBuilder.build(defaultEngine).commit(defaultEngine, emptyIterable[ Row ])
221
+ txnBuilder.build(defaultEngine)
203
222
}
204
223
205
224
testCase.expectedExceptionMessage.foreach { expectedMsg =>
0 commit comments