Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#498] fix(test): Fix port conflict issue in UT #499

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Changes from 1 commit
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 @@ -8,8 +8,10 @@
import static org.junit.jupiter.api.Assertions.assertThrows;

import com.datastrato.graviton.aux.AuxiliaryServiceManager;
import com.datastrato.graviton.rest.RESTUtils;
import com.datastrato.graviton.server.web.JettyServerConfig;
import com.google.common.collect.ImmutableMap;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -30,17 +32,17 @@ public class TestGravitonServer {
private ServerConfig spyServerConfig;

@BeforeAll
void initConfig() {
String confPath =
System.getenv("GRAVITON_HOME")
+ File.separator
+ "conf"
+ File.separator
+ "graviton.conf.template";
ServerConfig serverConfig = GravitonServer.loadConfig(confPath);
void initConfig() throws IOException {
ServerConfig serverConfig = new ServerConfig();
serverConfig.loadFromMap(
ImmutableMap.of(
ENTRY_KV_ROCKSDB_BACKEND_PATH.getKey(),
ROCKS_DB_STORE_PATH,
GravitonServer.WEBSERVER_CONF_PREFIX + JettyServerConfig.WEBSERVER_HTTP_PORT.getKey(),
String.valueOf(RESTUtils.findAvailablePort(5000, 6000))),
yuqi1129 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw the same exception in com.datastrato.graviton.server.web.TestJettyServer, is it need to do the same process?

> Task :server-common:test

TestJettyServer > testStartAndStop() FAILED
    java.lang.RuntimeException at TestJettyServer.java:48
        Caused by: java.io.IOException at TestJettyServer.java:48
            Caused by: java.net.BindException at TestJettyServer.java:48

t -> true);

spyServerConfig = Mockito.spy(serverConfig);
Mockito.when(spyServerConfig.get(ENTRY_KV_ROCKSDB_BACKEND_PATH))
.thenReturn(ROCKS_DB_STORE_PATH);

Mockito.when(
spyServerConfig.getConfigsWithPrefix(
Expand Down