Skip to content

Commit 82354b9

Browse files
committed
Add integration test
1 parent da032bb commit 82354b9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

integration-test/src/main/java/com/scalar/db/api/DistributedStorageAdminRepairIntegrationTestBase.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.scalar.db.api;
22

33
import static org.assertj.core.api.Assertions.assertThat;
4+
import static org.assertj.core.api.Assertions.assertThatCode;
45

56
import com.scalar.db.exception.storage.ExecutionException;
67
import com.scalar.db.io.DataType;
@@ -212,6 +213,21 @@ public void repairTable_ForNonExistingTableButExistingMetadata_ShouldCreateTable
212213
assertThat(admin.getTableMetadata(getNamespace(), getTable())).isEqualTo(getTableMetadata());
213214
}
214215

216+
@Test
217+
public void
218+
repairTable_WhenTableAlreadyExistsWithoutIndexAndMetadataSpecifiesIndex_ShouldCreateIndex()
219+
throws Exception {
220+
// Arrange
221+
admin.dropIndex(getNamespace(), getTable(), COL_NAME5);
222+
223+
// Act
224+
admin.repairTable(getNamespace(), getTable(), getTableMetadata(), getCreationOptions());
225+
226+
// Assert
227+
assertThatCode(() -> admin.dropIndex(getNamespace(), getTable(), COL_NAME5))
228+
.doesNotThrowAnyException();
229+
}
230+
215231
@Test
216232
public void repairNamespace_ForExistingNamespace_ShouldDoNothing() throws Exception {
217233
// Act

0 commit comments

Comments
 (0)