Skip to content

Commit 416f302

Browse files
committed
test & logs
1 parent f4a525f commit 416f302

File tree

8 files changed

+35
-3
lines changed

8 files changed

+35
-3
lines changed

query/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<configuration>
4646
<environmentVariables>
4747
<YDB_DOCKER_FEATURE_FLAGS>enable_resource_pools</YDB_DOCKER_FEATURE_FLAGS>
48+
<YDB_DOCKER_IMAGE>ydbplatform/local-ydb:trunk</YDB_DOCKER_IMAGE>
4849
</environmentVariables>
4950
</configuration>
5051
</plugin>

query/src/test/java/tech/ydb/query/TableExampleTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.junit.BeforeClass;
1515
import org.junit.ClassRule;
1616
import org.junit.FixMethodOrder;
17+
import org.junit.Ignore;
1718
import org.junit.Test;
1819
import org.junit.runners.MethodSorters;
1920

@@ -43,6 +44,7 @@
4344
* @author Alexandr Gorshenin <[email protected]>
4445
*/
4546
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
47+
@Ignore
4648
public class TableExampleTest {
4749
@ClassRule
4850
public final static GrpcTransportRule ydbRule = new GrpcTransportRule();

query/src/test/java/tech/ydb/query/impl/QueryIntegrationTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
*
4545
* @author Aleksandr Gorshenin
4646
*/
47+
@Ignore
4748
public class QueryIntegrationTest {
4849
private final static Logger logger = LoggerFactory.getLogger(QueryIntegrationTest.class);
4950
private final static String TEST_TABLE = "query_service_test";

query/src/test/java/tech/ydb/query/impl/ResourcePoolTest.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.junit.Assert;
88
import org.junit.BeforeClass;
99
import org.junit.ClassRule;
10-
import org.junit.Ignore;
1110
import org.junit.Test;
1211
import org.slf4j.Logger;
1312
import org.slf4j.LoggerFactory;
@@ -40,7 +39,6 @@
4039
*
4140
* @author Evgeny Kuvardin
4241
*/
43-
@Ignore // Resource pools are unstable now
4442
public class ResourcePoolTest {
4543
private final static Logger logger = LoggerFactory.getLogger(ResourcePoolTest.class);
4644

@@ -98,7 +96,7 @@ private Status selectWithPool(String poolName) {
9896
private Status createResourcePool(String poolName) {
9997
String createPool = "CREATE RESOURCE POOL " + poolName + " WITH ("
10098
+ "CONCURRENT_QUERY_LIMIT=10,"
101-
+ "QUEUE_SIZE=\"-1\"," // Query size works unstable
99+
+ "QUEUE_SIZE=1000,"
102100
+ "DATABASE_LOAD_CPU_THRESHOLD=80);";
103101
return retryCtx.supplyResult(s -> s.createQuery(createPool, TxMode.NONE).execute()).join().getStatus();
104102
}

tests/common/src/main/java/tech/ydb/test/integration/docker/DockerHelperFactory.java

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public byte[] pemCert() {
7171

7272
@Override
7373
public void close() {
74+
container.logStdErr();
75+
7476
if (env.dockerReuse() && TestcontainersConfiguration.getInstance().environmentSupportsReuse()) {
7577
return;
7678
}

tests/common/src/main/java/tech/ydb/test/integration/docker/YdbDockerContainer.java

+20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package tech.ydb.test.integration.docker;
22

3+
import java.io.BufferedReader;
34
import java.io.ByteArrayOutputStream;
5+
import java.io.InputStreamReader;
46
import java.util.Collections;
57
import java.util.UUID;
68

@@ -61,6 +63,7 @@ public void init() {
6163

6264
withEnv("YDB_USE_IN_MEMORY_PDISKS", "true");
6365
withEnv("YDB_ENABLE_COLUMN_TABLES", "true");
66+
withEnv("YDB_DEFAULT_LOG_LEVEL", "DEBUG");
6467

6568
if (env.dockerFeatures() != null && !env.dockerFeatures().isEmpty()) {
6669
withEnv("YDB_FEATURE_FLAGS", env.dockerFeatures());
@@ -104,6 +107,23 @@ public byte[] pemCert() {
104107
});
105108
}
106109

110+
public void logStdErr() {
111+
try {
112+
copyFileFromContainer("/stderr", is -> {
113+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
114+
String line = reader.readLine();
115+
while (line != null) {
116+
System.out.println(line);
117+
line = reader.readLine();
118+
}
119+
}
120+
return null;
121+
});
122+
} catch (Exception e) {
123+
// ignore
124+
}
125+
}
126+
107127
public String database() {
108128
return env.dockerDatabase();
109129
}

tests/common/src/test/java/tech/ydb/test/integration/DockerHelperFactoryTest.java

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ public String getHost() {
6060

6161
@Override
6262
public <T> T copyFileFromContainer(String containerPath, ThrowingFunction<InputStream, T> function) {
63+
if (!pemPath.equals(containerPath)) {
64+
try (ByteArrayInputStream bais = new ByteArrayInputStream("".getBytes())) {
65+
return function.apply(bais);
66+
} catch (Exception ex) {
67+
throw new AssertionError("mock error", ex);
68+
}
69+
}
6370
Assert.assertEquals("check pem path", pemPath, containerPath);
6471

6572
try (ByteArrayInputStream bais = new ByteArrayInputStream(pemCert)) {

tests/junit4-support/src/main/java/tech/ydb/test/junit4/GrpcTransportRule.java

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public void evaluate() throws Throwable {
4848
base.evaluate();
4949
proxy.set(null);
5050
}
51+
5152
}
5253
}
5354
};

0 commit comments

Comments
 (0)