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

fix(spark-lineage): select mock server port dynamically for unit test #4018

Merged
merged 1 commit into from Jan 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -39,6 +39,7 @@
import org.mockserver.matchers.Times;
import org.mockserver.model.HttpResponse;
import org.mockserver.model.JsonBody;
import org.mockserver.socket.PortFactory;
import org.mockserver.verify.VerificationTimes;
import org.testcontainers.containers.PostgreSQLContainer;

Expand All @@ -64,7 +65,8 @@ public class TestSparkJobsLineage {

private static final int N = 3; // num of GMS requests per spark job

private static final int GMS_PORT = MOCK_GMS ? 8089 : 8080;
private static final int MOCK_PORT = PortFactory.findFreePort();
private static final int GMS_PORT = MOCK_GMS ? MOCK_PORT : 8080;

private static final String EXPECTED_JSON_ROOT = "src/test/resources/expected/";
@ClassRule
Expand Down Expand Up @@ -101,7 +103,7 @@ public static void resetBaseExpectations() {
}

public static void init() {
mockServer = startClientAndServer();
mockServer = startClientAndServer(GMS_PORT);
resetBaseExpectations();
}

Expand Down Expand Up @@ -434,4 +436,4 @@ public void close() throws IOException {
closed = true;
}
}
}
}