-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStaticTarantoolContainerIT.java
More file actions
53 lines (45 loc) · 1.74 KB
/
StaticTarantoolContainerIT.java
File metadata and controls
53 lines (45 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package org.testcontainers.containers;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Alexey Kuzin
* @author Oleg Kuznetsov
* @author Ivan Dneprov
*/
@Testcontainers
public class StaticTarantoolContainerIT {
protected static final String tarantoolVersion = System.getenv().get("TARANTOOL_VERSION");
@Container
protected static final TarantoolContainer container = new TarantoolContainer();
@Test
public void testExecuteCommand() throws Exception {
List<?> result = container.executeCommandDecoded("return 1, 2");
assertEquals(2, result.size());
assertEquals(1, result.get(0));
}
@Test
public void testExecuteCommandWithArguments() throws Exception {
List<?> result = container.executeCommandDecoded(
"return require('fun').iter({1, 2, 3}):reduce(function(x, acc) return acc+x end, 0)");
assertEquals(1, result.size());
assertEquals(6, result.get(0));
}
@Test
public void testSetLogLevel() throws Exception {
container.withLogLevel(TarantoolLogLevel.INFO);
List<?> result = container.executeCommandDecoded("return box.cfg.log_level");
assertEquals(1, result.size());
assertEquals(5, result.get(0));
}
@Test
public void testSetMemtxMemory() throws Exception {
int memory = 256 * 1024 * 1024;
container.withMemtxMemory(memory);
List<?> result = container.executeCommandDecoded("return box.cfg.memtx_memory");
assertEquals(1, result.size());
assertEquals(memory, result.get(0));
}
}