Skip to content

Commit 15a9004

Browse files
committed
Move setting max_parser_depth just after container start,
remove testcontainers junit dependency as it starts container on each test
1 parent 76b1611 commit 15a9004

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies {
2828

2929
testImplementation("org.testcontainers", "testcontainers", "1.16.0")
3030
testImplementation("org.testcontainers", "clickhouse", "1.16.0")
31-
testImplementation("org.testcontainers", "junit-jupiter", "1.16.0")
3231
}
3332

3433
tasks.withType<KotlinJvmCompile> {

src/test/kotlin/tanvd/aorm/type/TypesTest.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ class TypesTest : AormTestBase() {
8383

8484
InsertClickhouse.insert(database, InsertExpression(AllTypesTable, AllTypesTable.columns, arrayListOf(row)))
8585

86-
// we need to disable query parser stack limitation for tests, so we add line "<max_parser_depth>0</max_parser_depth>" to the config:
87-
serverContainer.execInContainer("sed", "-i", "/^.*\\<max_memory_usage\\>.*/a \\<max_parser_depth\\>0\\<\\/max_parser_depth\\>", "/etc/clickhouse-server/users.xml")
88-
Thread.sleep(1000) // wait for server to reload just changed config
89-
9086
val gotRow = (AllTypesTable.select() where ((AllTypesTable.dateCol eq getDate("2000-01-01")) and
9187
//TODO-tanvd date has not working in JDBC
9288
// (AllTypesTable.arrayDateCol has getDate("2001-01-01")) and

src/test/kotlin/tanvd/aorm/utils/AormTestBase.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@ package tanvd.aorm.utils
22

33
import org.junit.jupiter.api.BeforeEach
44
import org.testcontainers.containers.ClickHouseContainer
5-
import org.testcontainers.junit.jupiter.Container
6-
import org.testcontainers.junit.jupiter.Testcontainers
75
import ru.yandex.clickhouse.ClickHouseDataSource
86
import ru.yandex.clickhouse.settings.ClickHouseProperties
97
import tanvd.aorm.*
108
import tanvd.aorm.expression.Column
119
import tanvd.aorm.expression.Expression
1210
import tanvd.aorm.insert.DefaultInsertWorker
1311

14-
@Testcontainers
1512
abstract class AormTestBase {
1613
companion object {
1714
const val testInsertWorkerDelayMs = 2000L
1815

19-
@Container
20-
val serverContainer = ClickHouseContainer("yandex/clickhouse-server:21.1").apply { start() }
16+
val serverContainer = ClickHouseContainer("yandex/clickhouse-server:21.1").apply {
17+
start()
18+
// we need to disable query parser stack limitation for tests, so we add line "<max_parser_depth>0</max_parser_depth>" to the config:
19+
execInContainer("sed", "-i", "/^.*\\<max_memory_usage\\>.*/a \\<max_parser_depth\\>0\\<\\/max_parser_depth\\>", "/etc/clickhouse-server/users.xml")
20+
Thread.sleep(5_000) // wait for server to reload just changed config
21+
}
2122
}
2223

2324
val database by lazy {

0 commit comments

Comments
 (0)