-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCartridgeContainerTestUtils.java
More file actions
41 lines (33 loc) · 1.56 KB
/
CartridgeContainerTestUtils.java
File metadata and controls
41 lines (33 loc) · 1.56 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
package org.testcontainers.containers;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Vladimir Rogach
* @author Ivan Dneprov
*/
public class CartridgeContainerTestUtils {
private CartridgeContainerTestUtils() {
}
static public void executeProfileReplaceSmokeTest(TarantoolCartridgeContainer container) throws Exception {
container.executeCommand(
"return profile_replace({1, \"Ivanov Ivan Ivanovich\", 33, 100500})");
List<?> result = container.executeCommandDecoded("return profile_get(1)");
assertEquals(1, result.size());
assertEquals(33, ((List<?>) result.get(0)).get(3));
}
public static boolean isEnvInStdout(String stdout, Map<String, String> env) {
Map<String, String> envMap = Arrays.stream(stdout.split("\n"))
.collect(Collectors.toMap(toKey -> toKey.split("=")[0],
toValue -> {
String[] pair = toValue.split("=");
if (pair.length == 1) {
return "null";
}
return pair[1];
}));
return envMap.entrySet().containsAll(env.entrySet());
}
}