Skip to content

Commit

Permalink
fix(ci): spark-lineage - select mock server port dynamically for unit…
Browse files Browse the repository at this point in the history
… test (#4018)
  • Loading branch information
MugdhaHardikar-GSLab committed Jan 31, 2022
1 parent faac911 commit 4c33124
Showing 1 changed file with 5 additions and 3 deletions.
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;
}
}
}
}

0 comments on commit 4c33124

Please sign in to comment.