Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

package org.apache.uniffle.common.util;

import java.util.concurrent.atomic.AtomicInteger;

import com.google.common.collect.Sets;
import org.apache.uniffle.common.exception.RssException;
import org.junit.jupiter.api.Test;

import java.util.concurrent.atomic.AtomicInteger;
import org.apache.uniffle.common.exception.RssException;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand All @@ -39,6 +40,7 @@ public void testRetry() {
callbackTime.incrementAndGet();
}, 10, maxTryTime, Sets.newHashSet(RssException.class));
} catch (Throwable throwable) {
// ignore
}
assertEquals(tryTimes.get(), maxTryTime);
assertEquals(callbackTime.get(), maxTryTime - 1);
Expand All @@ -50,6 +52,7 @@ public void testRetry() {
throw new Exception("");
}, 10, maxTryTime);
} catch (Throwable throwable) {
// ignore
}
assertEquals(tryTimes.get(), maxTryTime);

Expand All @@ -61,6 +64,7 @@ public void testRetry() {
}, 10, maxTryTime);
assertEquals(ret, 1);
} catch (Throwable throwable) {
// ignore
}
assertEquals(tryTimes.get(), 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void clear() {
@Test
public void test(@TempDir File tempDir) throws Exception {
File cfgFile = File.createTempFile("tmp", ".conf", tempDir);
String cfgFileName = cfgFile.getAbsolutePath();
final String cfgFileName = cfgFile.getAbsolutePath();
final String filePath = Objects.requireNonNull(
getClass().getClassLoader().getResource("coordinator.conf")).getFile();
CoordinatorConf conf = new CoordinatorConf(filePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ public MockAccessCheckerAlwaysFalse(AccessManager accessManager) throws Exceptio
super(accessManager);
}

public void close() {}
public void close() {

}

public AccessCheckResult check(AccessInfo accessInfo) {
return new AccessCheckResult(false, "MockAccessCheckerAlwaysFalse");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import com.google.common.collect.Sets;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.apache.uniffle.common.RemoteStorageInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@

package org.apache.uniffle.coordinator;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.stream.Collectors;
import org.apache.uniffle.common.PartitionRange;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.stream.Collectors;

import com.google.common.collect.Sets;
import org.apache.hadoop.conf.Configuration;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.apache.uniffle.common.PartitionRange;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class BasicAssignmentStrategyTest {

Set<String> tags = Sets.newHashSet("test");
Expand Down Expand Up @@ -112,11 +113,11 @@ public void testRandomAssign() {

@Test
public void testAssignWithDifferentNodeNum() {
ServerNode sn1 = new ServerNode("sn1", "", 0, 0, 0,
final ServerNode sn1 = new ServerNode("sn1", "", 0, 0, 0,
20, 0, tags, true);
ServerNode sn2 = new ServerNode("sn2", "", 0, 0, 0,
final ServerNode sn2 = new ServerNode("sn2", "", 0, 0, 0,
10, 0, tags, true);
ServerNode sn3 = new ServerNode("sn3", "", 0, 0, 0,
final ServerNode sn3 = new ServerNode("sn3", "", 0, 0, 0,
0, 0, tags, true);

clusterManager.add(sn1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import org.apache.uniffle.common.RemoteStorageInfo;
import org.apache.uniffle.common.util.Constants;
import org.junit.jupiter.api.io.TempDir;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand All @@ -56,7 +56,7 @@ public void clear() {
@Test
public void test(@TempDir File tempDir) throws Exception {
File cfgFile = File.createTempFile("tmp", ".conf", tempDir);
String cfgFileName = cfgFile.getAbsolutePath();
final String cfgFileName = cfgFile.getAbsolutePath();
final String filePath = Objects.requireNonNull(
getClass().getClassLoader().getResource("coordinator.conf")).getFile();
CoordinatorConf conf = new CoordinatorConf(filePath);
Expand Down Expand Up @@ -139,9 +139,9 @@ public void test(@TempDir File tempDir) throws Exception {
@Test
public void dynamicRemoteStorageTest() throws Exception {
int updateIntervalSec = 2;
String remotePath1 = "hdfs://host1/path1";
String remotePath2 = "hdfs://host2/path2";
String remotePath3 = "hdfs://host3/path3";
final String remotePath1 = "hdfs://host1/path1";
final String remotePath2 = "hdfs://host2/path2";
final String remotePath3 = "hdfs://host3/path3";
File cfgFile = Files.createTempFile("dynamicRemoteStorageTest", ".conf").toFile();
cfgFile.deleteOnExit();
writeRemoteStorageConf(cfgFile, remotePath1);
Expand All @@ -152,7 +152,7 @@ public void dynamicRemoteStorageTest() throws Exception {
conf.set(CoordinatorConf.COORDINATOR_DYNAMIC_CLIENT_CONF_ENABLED, true);
ApplicationManager applicationManager = new ApplicationManager(conf);

ClientConfManager clientConfManager = new ClientConfManager(conf, new Configuration(), applicationManager);
final ClientConfManager clientConfManager = new ClientConfManager(conf, new Configuration(), applicationManager);
Thread.sleep(500);
Set<String> expectedAvailablePath = Sets.newHashSet(remotePath1);
assertEquals(expectedAvailablePath, applicationManager.getAvailableRemoteStorageInfo().keySet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

package org.apache.uniffle.coordinator;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Objects;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class CoordinatorConfTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void testGrpcMetrics() throws Exception {
assertEquals(6, actualObj.get("metrics").size());
}

static private void writeRemoteStorageConf(File cfgFile, String value) throws Exception {
private static void writeRemoteStorageConf(File cfgFile, String value) throws Exception {
FileWriter fileWriter = new FileWriter(cfgFile);
PrintWriter printWriter = new PrintWriter(fileWriter);
printWriter.println(CoordinatorConf.COORDINATOR_REMOTE_STORAGE_PATH.key() + " " + value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@

package org.apache.uniffle.coordinator;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.Test;

import org.apache.uniffle.common.util.ExitUtils;
import org.apache.uniffle.common.util.ExitUtils.ExitException;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

public class CoordinatorServerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Uninterruptibles;

import java.util.stream.Collectors;
import org.apache.hadoop.conf.Configuration;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -128,7 +127,7 @@ public void testAssign() {
valid(expect);

list = Lists.newArrayList();
for (int i = 0; i< 20; i++) {
for (int i = 0; i < 20; i++) {
if (i % 2 == 0) {
list.add(10L);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@

package org.apache.uniffle.coordinator;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.google.common.collect.Sets;
import org.apache.uniffle.common.PartitionRange;
import org.apache.uniffle.proto.RssProtos;
import java.util.Collections;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;

import com.google.common.collect.Sets;
import org.junit.jupiter.api.Test;

import org.apache.uniffle.common.PartitionRange;
import org.apache.uniffle.proto.RssProtos;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class PartitionRangeAssignmentTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

package org.apache.uniffle.coordinator;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import org.junit.jupiter.api.Test;

import org.apache.uniffle.common.PartitionRange;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

public class PartitionRangeTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@

package org.apache.uniffle.coordinator;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import java.util.Collections;
import java.util.List;
import java.util.Set;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class ServerNodeTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.Set;

import com.google.common.collect.Sets;

import org.apache.hadoop.conf.Configuration;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -117,7 +116,7 @@ public void heartbeatTimeoutTest() throws Exception {
try {
Thread.sleep(800);
} catch (Exception e) {

// ignore
}
}

Expand Down