Skip to content

Commit 560f11c

Browse files
committed
add proxy env flag to otel it
1 parent 013bed9 commit 560f11c

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITOpenTelemetryTest.java‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,34 @@
5858
import java.sql.Statement;
5959
import java.util.ArrayList;
6060
import java.util.List;
61+
import org.junit.jupiter.api.AfterAll;
62+
import org.junit.jupiter.api.BeforeAll;
6163
import org.junit.jupiter.api.Test;
6264

6365
public class ITOpenTelemetryTest extends ITBase {
6466

6567
private static final String PROJECT_ID = ServiceOptions.getDefaultProjectId();
6668
private static final String CONNECTION_URL = connectionUrl;
6769

70+
@BeforeAll
71+
public static void setUpProxyProperties() {
72+
DataSource ds = DataSource.fromUrl(CONNECTION_URL);
73+
if (ds.getProxyHost() != null && ds.getProxyPort() != null) {
74+
System.setProperty("https.proxyHost", ds.getProxyHost());
75+
System.setProperty("https.proxyPort", ds.getProxyPort());
76+
System.setProperty("http.proxyHost", ds.getProxyHost());
77+
System.setProperty("http.proxyPort", ds.getProxyPort());
78+
}
79+
}
80+
81+
@AfterAll
82+
public static void tearDownProxyProperties() {
83+
System.clearProperty("https.proxyHost");
84+
System.clearProperty("https.proxyPort");
85+
System.clearProperty("http.proxyHost");
86+
System.clearProperty("http.proxyPort");
87+
}
88+
6889
@Test
6990
public void testExecute_withOpenTelemetryGcpExporter() throws Exception {
7091

0 commit comments

Comments
 (0)