This is an automated email from the ASF dual-hosted git repository. cshannon pushed a commit to branch elasticity in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/elasticity by this push: new 01a8a2759d Update FATE tests to create fate table with system config (#4327) 01a8a2759d is described below commit 01a8a2759d065b9f22e1a572c2fd3c76feea5cd2 Author: Christopher L. Shannon <cshan...@apache.org> AuthorDate: Fri Mar 1 11:19:03 2024 -0500 Update FATE tests to create fate table with system config (#4327) This commit updates the different FATE ITs to create the test table that is used to match the same configuration that is used when creating the system table in InitialConfiguration. This closes #4321 Co-authored-by: Keith Turner <ktur...@apache.org> --- .../test/fate/accumulo/AccumuloFateIT.java | 4 ++- .../test/fate/accumulo/AccumuloStoreFateIT.java | 3 ++- .../test/fate/accumulo/AccumuloStoreIT.java | 30 ++++++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloFateIT.java b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloFateIT.java index 3091f8c88f..eb3743326e 100644 --- a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloFateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloFateIT.java @@ -18,6 +18,8 @@ */ package org.apache.accumulo.test.fate.accumulo; +import static org.apache.accumulo.test.fate.accumulo.AccumuloStoreIT.createFateTable; + import java.util.stream.StreamSupport; import org.apache.accumulo.core.client.Accumulo; @@ -57,7 +59,7 @@ public class AccumuloFateIT extends FateIT { table = getUniqueNames(1)[0]; try (ClientContext client = (ClientContext) Accumulo.newClient().from(getClientProps()).build()) { - client.tableOperations().create(table); + createFateTable(client, table); testMethod.execute(new AccumuloStore<>(client, table, maxDeferred, fateIdGenerator), getCluster().getServerContext()); } diff --git a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreFateIT.java b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreFateIT.java index da0b62e14d..11bdf48e15 100644 --- a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreFateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreFateIT.java @@ -19,6 +19,7 @@ package org.apache.accumulo.test.fate.accumulo; import static org.apache.accumulo.core.fate.accumulo.AccumuloStore.getRowId; +import static org.apache.accumulo.test.fate.accumulo.AccumuloStoreIT.createFateTable; import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.BatchWriter; @@ -53,7 +54,7 @@ public class AccumuloStoreFateIT extends FateStoreIT { String table = getUniqueNames(1)[0] + "fatestore"; try (ClientContext client = (ClientContext) Accumulo.newClient().from(getClientProps()).build()) { - client.tableOperations().create(table); + createFateTable(client, table); testMethod.execute(new AccumuloStore<>(client, table, maxDeferred, fateIdGenerator), getCluster().getServerContext()); } diff --git a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java index 4a5e0c18c7..cb38235242 100644 --- a/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java +++ b/test/src/main/java/org/apache/accumulo/test/fate/accumulo/AccumuloStoreIT.java @@ -33,10 +33,13 @@ import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.accumulo.core.client.admin.TabletAvailability; +import org.apache.accumulo.core.client.admin.TabletInformation; import org.apache.accumulo.core.clientImpl.ClientContext; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.fate.FateId; import org.apache.accumulo.core.fate.FateInstanceType; @@ -59,6 +62,8 @@ import org.junit.jupiter.api.function.Executable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.collect.MoreCollectors; + public class AccumuloStoreIT extends SharedMiniClusterBase { private static final Logger log = LoggerFactory.getLogger(AccumuloStore.class); @@ -148,7 +153,7 @@ public class AccumuloStoreIT extends SharedMiniClusterBase { String table = getUniqueNames(1)[0]; try (ClientContext client = (ClientContext) Accumulo.newClient().from(getClientProps()).build()) { - client.tableOperations().create(table); + createFateTable(client, table); List<Long> txids = List.of(1L, 1L, 1L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L); List<FateId> fateIds = txids.stream().map(txid -> FateId.from(fateInstanceType, txid)) @@ -181,7 +186,7 @@ public class AccumuloStoreIT extends SharedMiniClusterBase { public void setup() throws Exception { client = (ClientContext) Accumulo.newClient().from(getClientProps()).build(); tableName = getUniqueNames(1)[0]; - client.tableOperations().create(tableName); + createFateTable(client, tableName); fateId = FateId.from(fateInstanceType, 1L); store = new TestAccumuloStore(client, tableName, List.of(fateId)); store.create(); @@ -253,4 +258,25 @@ public class AccumuloStoreIT extends SharedMiniClusterBase { } } + // Create the fate table with the exact configuration as the real Fate user instance table + // including table properties and TabletAvailability + protected static void createFateTable(ClientContext client, String table) throws Exception { + final var fateTableProps = + client.tableOperations().getTableProperties(AccumuloTable.FATE.tableName()); + + TabletAvailability availability; + try (var tabletStream = client.tableOperations() + .getTabletInformation(AccumuloTable.FATE.tableName(), new Range())) { + availability = tabletStream.map(TabletInformation::getTabletAvailability).distinct() + .collect(MoreCollectors.onlyElement()); + } + + var newTableConf = new NewTableConfiguration().withInitialTabletAvailability(availability) + .withoutDefaultIterators().setProperties(fateTableProps); + client.tableOperations().create(table, newTableConf); + var testFateTableProps = client.tableOperations().getTableProperties(table); + + // ensure that create did not set any other props + assertEquals(fateTableProps, testFateTableProps); + } }