[HUDI-4224] Fix CI issues (#5842)
- Upgrade junit to 5.7.2 - Downgrade surefire and failsafe to 2.22.2 - Fix test failures that were previously not reported - Improve azure pipeline configs Co-authored-by: liujinhui1994 <965147871@qq.com> Co-authored-by: Y Ethan Guo <ethan.guoyihua@gmail.com>
This commit is contained in:
@@ -205,6 +205,24 @@
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.parquet</groupId>
|
||||
<artifactId>parquet-avro</artifactId>
|
||||
@@ -259,31 +277,71 @@
|
||||
<artifactId>hadoop-hdfs</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- HDFS test dependencies -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-common</artifactId>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-hdfs</artifactId>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
|
||||
@@ -148,7 +148,7 @@ public class SparkMain {
|
||||
}
|
||||
configs = new ArrayList<>();
|
||||
if (args.length > 9) {
|
||||
configs.addAll(Arrays.asList(args).subList(8, args.length));
|
||||
configs.addAll(Arrays.asList(args).subList(9, args.length));
|
||||
}
|
||||
|
||||
returnCode = compact(jsc, args[3], args[4], null, Integer.parseInt(args[5]), args[6],
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hudi.cli.testutils;
|
||||
package org.apache.hudi.cli;
|
||||
|
||||
import org.apache.hudi.common.util.Option;
|
||||
import org.apache.hudi.cli.utils.SparkUtil;
|
||||
@@ -30,7 +30,7 @@ import java.net.URISyntaxException;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class SparkUtilTest {
|
||||
public class TestSparkUtil {
|
||||
|
||||
@Test
|
||||
public void testInitSparkLauncher() throws URISyntaxException {
|
||||
@@ -22,7 +22,7 @@ import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.HoodiePrintHelper;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.functional.TestBootstrap;
|
||||
import org.apache.hudi.common.model.HoodieTableType;
|
||||
import org.apache.hudi.common.table.timeline.versioning.TimelineLayoutVersion;
|
||||
@@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
/**
|
||||
* Test class of {@link org.apache.hudi.cli.commands.BootstrapCommand}.
|
||||
*/
|
||||
public class ITTestBootstrapCommand extends AbstractShellIntegrationTest {
|
||||
public class ITTestBootstrapCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
private static final int NUM_OF_RECORDS = 100;
|
||||
private static final String PARTITION_FIELD = "datestr";
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.apache.hudi.cli.integ;
|
||||
|
||||
import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.client.SparkRDDWriteClient;
|
||||
import org.apache.hudi.client.WriteStatus;
|
||||
import org.apache.hudi.client.common.HoodieSparkEngineContext;
|
||||
@@ -57,7 +57,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* A command use SparkLauncher need load jars under lib which generate during mvn package.
|
||||
* Use integration test instead of unit test.
|
||||
*/
|
||||
public class ITTestClusteringCommand extends AbstractShellIntegrationTest {
|
||||
public class ITTestClusteringCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
@BeforeEach
|
||||
public void init() throws IOException {
|
||||
@@ -105,9 +105,10 @@ public class ITTestClusteringCommand extends AbstractShellIntegrationTest {
|
||||
|
||||
// get clustering instance
|
||||
HoodieActiveTimeline timeline = HoodieCLI.getTableMetaClient().getActiveTimeline();
|
||||
Option<String> instance =
|
||||
Option<String> instanceOpt =
|
||||
timeline.filterPendingReplaceTimeline().firstInstant().map(HoodieInstant::getTimestamp);
|
||||
assertTrue(instance.isPresent(), "Must have pending clustering.");
|
||||
assertTrue(instanceOpt.isPresent(), "Must have pending clustering.");
|
||||
final String instance = instanceOpt.get();
|
||||
|
||||
CommandResult cr2 = getShell().executeCommand(
|
||||
String.format("clustering run --parallelism %s --clusteringInstant %s --sparkMaster %s",
|
||||
|
||||
@@ -21,7 +21,7 @@ package org.apache.hudi.cli.integ;
|
||||
import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.commands.RollbacksCommand;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.common.model.HoodieTableType;
|
||||
import org.apache.hudi.common.table.HoodieTableMetaClient;
|
||||
import org.apache.hudi.common.table.timeline.HoodieActiveTimeline;
|
||||
@@ -29,6 +29,7 @@ import org.apache.hudi.common.table.timeline.versioning.TimelineLayoutVersion;
|
||||
import org.apache.hudi.common.testutils.HoodieTestTable;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.shell.core.CommandResult;
|
||||
|
||||
@@ -41,6 +42,7 @@ import static org.apache.hudi.common.testutils.HoodieTestDataGenerator.DEFAULT_F
|
||||
import static org.apache.hudi.common.testutils.HoodieTestDataGenerator.DEFAULT_PARTITION_PATHS;
|
||||
import static org.apache.hudi.common.testutils.HoodieTestDataGenerator.DEFAULT_SECOND_PARTITION_PATH;
|
||||
import static org.apache.hudi.common.testutils.HoodieTestDataGenerator.DEFAULT_THIRD_PARTITION_PATH;
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -50,7 +52,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* A command use SparkLauncher need load jars under lib which generate during mvn package.
|
||||
* Use integration test instead of unit test.
|
||||
*/
|
||||
public class ITTestCommitsCommand extends AbstractShellIntegrationTest {
|
||||
@Disabled("HUDI-4226")
|
||||
public class ITTestCommitsCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
@Override
|
||||
protected HoodieTableType getTableType() {
|
||||
return HoodieTableType.COPY_ON_WRITE;
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void init() throws IOException {
|
||||
@@ -79,19 +87,21 @@ public class ITTestCommitsCommand extends AbstractShellIntegrationTest {
|
||||
put(DEFAULT_THIRD_PARTITION_PATH, "file-3");
|
||||
}
|
||||
};
|
||||
final String rollbackCommit = "102";
|
||||
HoodieTestTable.of(metaClient)
|
||||
.withPartitionMetaFiles(DEFAULT_PARTITION_PATHS)
|
||||
.addCommit("100")
|
||||
.withBaseFilesInPartitions(partitionAndFileId)
|
||||
.addCommit("101")
|
||||
.withBaseFilesInPartitions(partitionAndFileId)
|
||||
.addCommit(rollbackCommit)
|
||||
.addCommit("102")
|
||||
.withBaseFilesInPartitions(partitionAndFileId);
|
||||
|
||||
CommandResult cr = getShell().executeCommand(String.format("commit rollback --commit %s --sparkMaster %s --sparkMemory %s",
|
||||
rollbackCommit, "local", "4G"));
|
||||
assertTrue(cr.isSuccess());
|
||||
"102", "local", "4G"));
|
||||
|
||||
assertAll("Command run failed",
|
||||
() -> assertTrue(cr.isSuccess()),
|
||||
() -> assertEquals("Commit 102 rolled back", cr.getResult().toString()));
|
||||
|
||||
metaClient = HoodieTableMetaClient.reload(HoodieCLI.getTableMetaClient());
|
||||
|
||||
@@ -103,15 +113,17 @@ public class ITTestCommitsCommand extends AbstractShellIntegrationTest {
|
||||
|
||||
// rollback complete commit
|
||||
CommandResult cr2 = getShell().executeCommand(String.format("commit rollback --commit %s --sparkMaster %s --sparkMemory %s",
|
||||
"101", "local", "4G"));
|
||||
assertTrue(cr2.isSuccess());
|
||||
"101", "local", "4G"));
|
||||
assertAll("Command run failed",
|
||||
() -> assertTrue(cr2.isSuccess()),
|
||||
() -> assertEquals("Commit 101 rolled back", cr2.getResult().toString()));
|
||||
|
||||
metaClient = HoodieTableMetaClient.reload(HoodieCLI.getTableMetaClient());
|
||||
|
||||
HoodieActiveTimeline rollbackTimeline2 = new RollbacksCommand.RollbackTimeline(metaClient);
|
||||
assertEquals(1, rollbackTimeline2.getRollbackTimeline().countInstants(), "There should have 2 rollback instant.");
|
||||
assertEquals(2, rollbackTimeline2.getRollbackTimeline().countInstants(), "There should have 2 rollback instant.");
|
||||
|
||||
HoodieActiveTimeline timeline2 = metaClient.reloadActiveTimeline();
|
||||
assertEquals(2, timeline2.getCommitsTimeline().countInstants(), "There should have 1 instants.");
|
||||
assertEquals(1, timeline2.getCommitsTimeline().countInstants(), "There should have 1 instants.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.apache.hudi.cli.integ;
|
||||
|
||||
import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.client.CompactionAdminClient;
|
||||
import org.apache.hudi.client.SparkRDDWriteClient;
|
||||
import org.apache.hudi.client.TestCompactionAdminClient;
|
||||
@@ -69,7 +69,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* A command use SparkLauncher need load jars under lib which generate during mvn package.
|
||||
* Use integration test instead of unit test.
|
||||
*/
|
||||
public class ITTestCompactionCommand extends AbstractShellIntegrationTest {
|
||||
public class ITTestCompactionCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
@BeforeEach
|
||||
public void init() throws IOException {
|
||||
@@ -147,7 +147,8 @@ public class ITTestCompactionCommand extends AbstractShellIntegrationTest {
|
||||
writeSchemaToTmpFile(schemaPath);
|
||||
|
||||
CommandResult cr2 = getShell().executeCommand(
|
||||
String.format("compaction scheduleAndExecute --parallelism %s --schemaFilePath %s --sparkMaster %s",
|
||||
String.format("compaction scheduleAndExecute --parallelism %s --schemaFilePath %s --sparkMaster %s "
|
||||
+ "--hoodieConfigs hoodie.compact.inline.max.delta.commits=1",
|
||||
2, schemaPath, "local"));
|
||||
|
||||
assertAll("Command run failed",
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.apache.hudi.cli.integ;
|
||||
|
||||
import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.common.model.HoodieTableType;
|
||||
import org.apache.hudi.common.table.HoodieTableMetaClient;
|
||||
import org.apache.hudi.common.table.timeline.versioning.TimelineLayoutVersion;
|
||||
@@ -55,7 +55,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* Test class for {@link org.apache.hudi.cli.commands.HDFSParquetImportCommand}.
|
||||
*/
|
||||
@Disabled("Disable due to flakiness and feature deprecation.")
|
||||
public class ITTestHDFSParquetImportCommand extends AbstractShellIntegrationTest {
|
||||
public class ITTestHDFSParquetImportCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
private Path sourcePath;
|
||||
private Path targetPath;
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.apache.hudi.cli.integ;
|
||||
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.common.model.HoodieTableType;
|
||||
import org.apache.hudi.common.model.IOType;
|
||||
import org.apache.hudi.common.table.timeline.versioning.TimelineLayoutVersion;
|
||||
@@ -40,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* A command use SparkLauncher need load jars under lib which generate during mvn package.
|
||||
* Use integration test instead of unit test.
|
||||
*/
|
||||
public class ITTestMarkersCommand extends AbstractShellIntegrationTest {
|
||||
public class ITTestMarkersCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
private String tablePath;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.apache.hudi.avro.HoodieAvroUtils;
|
||||
import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.commands.RepairsCommand;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.common.model.HoodieBaseFile;
|
||||
import org.apache.hudi.common.model.HoodieFileFormat;
|
||||
import org.apache.hudi.common.model.HoodieRecord;
|
||||
@@ -57,7 +57,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* A command use SparkLauncher need load jars under lib which generate during mvn package.
|
||||
* Use integration test instead of unit test.
|
||||
*/
|
||||
public class ITTestRepairsCommand extends AbstractShellIntegrationTest {
|
||||
public class ITTestRepairsCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
private String duplicatedPartitionPath;
|
||||
private String duplicatedPartitionPathWithUpdates;
|
||||
|
||||
@@ -21,7 +21,7 @@ package org.apache.hudi.cli.integ;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.commands.TableCommand;
|
||||
import org.apache.hudi.cli.testutils.AbstractShellIntegrationTest;
|
||||
import org.apache.hudi.cli.testutils.HoodieCLIIntegrationTestBase;
|
||||
import org.apache.hudi.client.common.HoodieSparkEngineContext;
|
||||
import org.apache.hudi.common.config.HoodieMetadataConfig;
|
||||
import org.apache.hudi.common.model.HoodieTableType;
|
||||
@@ -51,7 +51,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
* A command use SparkLauncher need load jars under lib which generate during mvn package.
|
||||
* Use integration test instead of unit test.
|
||||
*/
|
||||
public class ITTestSavepointsCommand extends AbstractShellIntegrationTest {
|
||||
public class ITTestSavepointsCommand extends HoodieCLIIntegrationTestBase {
|
||||
|
||||
private String tablePath;
|
||||
|
||||
@@ -139,11 +139,7 @@ public class ITTestSavepointsCommand extends AbstractShellIntegrationTest {
|
||||
HoodieTestDataGenerator.createSavepointFile(tablePath, savepoint, jsc.hadoopConfiguration());
|
||||
|
||||
// re-bootstrap metadata table
|
||||
// delete first
|
||||
String basePath = metaClient.getBasePath();
|
||||
Path metadataTableBasePath = new Path(HoodieTableMetadata.getMetadataTableBasePath(basePath));
|
||||
metaClient.getFs().delete(metadataTableBasePath, true);
|
||||
|
||||
Path metadataTableBasePath = new Path(HoodieTableMetadata.getMetadataTableBasePath(HoodieCLI.basePath));
|
||||
// then bootstrap metadata table at instant 104
|
||||
HoodieWriteConfig writeConfig = HoodieWriteConfig.newBuilder().withPath(HoodieCLI.basePath)
|
||||
.withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(true).build()).build();
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
/**
|
||||
* Class to initial resources for shell.
|
||||
*/
|
||||
public abstract class AbstractShellIntegrationTest extends AbstractShellBaseIntegrationTest {
|
||||
public class HoodieCLIIntegrationTestBase extends HoodieCLIIntegrationTestHarness {
|
||||
|
||||
@Override
|
||||
@BeforeEach
|
||||
@@ -30,7 +30,7 @@ import org.springframework.shell.core.JLineShellComponent;
|
||||
/**
|
||||
* Class to start Bootstrap and JLineShellComponent.
|
||||
*/
|
||||
public class AbstractShellBaseIntegrationTest extends HoodieClientTestHarness {
|
||||
public class HoodieCLIIntegrationTestHarness extends HoodieClientTestHarness {
|
||||
|
||||
private static JLineShellComponent shell;
|
||||
|
||||
Reference in New Issue
Block a user