@@ -21,87 +21,4 @@ class Opensearch82Cest extends OpensearchCest
2121 */
2222 protected const TEMPLATE_VERSION = '2.4.6 ' ;
2323
24- /**
25- * @param CliTester $I
26- * @param Example $data
27- * @dataProvider dataProvider
28- * @return void
29- * @throws TaskException
30- */
31- public function testOpensearch (CliTester $ I , Example $ data )
32- {
33- $ I ->generateDockerCompose ($ this ->buildCommand ($ data ));
34- $ I ->replaceImagesWithCustom ();
35- $ I ->startEnvironment ();
36- if (!empty ($ data ['plugins ' ])) {
37- $ I ->runDockerComposeCommand ('logs opensearch ' );
38- foreach ($ data ['plugins ' ] as $ plugin ) {
39- $ I ->seeInOutput ($ plugin );
40- }
41- }
42- $ I ->runDockerComposeCommand ('exec -T opensearch curl localhost:9200/_nodes ' );
43- $ I ->seeInOutput ('-Xms ' . $ data ['xms ' ]);
44- $ I ->seeInOutput ('-Xmx ' . $ data ['xmx ' ]);
45-
46- if (!empty ($ data ['param ' ])) {
47- $ I ->runDockerComposeCommand ('exec -T opensearch curl http://localhost:9200/_nodes/settings ' );
48- $ I ->seeInOutput ($ data ['param ' ]['needle ' ]);
49- }
50- }
51-
52- /**
53- * Builds build:compose command from given test data
54- *
55- * @param Example $data
56- * @return string
57- */
58- private function buildCommand (Example $ data ): string
59- {
60- $ command = sprintf (
61- '--mode=production --os=%s --os-env-var="OPENSEARCH_JAVA_OPTS=-Xms%s -Xmx%s" ' ,
62- $ data ['version ' ],
63- $ data ['xms ' ],
64- $ data ['xmx ' ]
65- );
66-
67- if (!empty ($ data ['param ' ])) {
68- $ command .= " --os-env-var= {$ data ['param ' ]['key ' ]}= {$ data ['param ' ]['value ' ]}" ;
69- }
70- if (!empty ($ data ['plugins ' ])) {
71- $ command .= sprintf (' --os-env-var="OS_PLUGINS=%s" ' , implode (' ' , $ data ['plugins ' ]));
72- }
73-
74- return $ command ;
75- }
76-
77- /**
78- * @return array
79- */
80- protected function dataProvider (): array
81- {
82- return [
83- [
84- 'version ' => '2.3 ' ,
85- 'xms ' => '520m ' ,
86- 'xmx ' => '520m ' ,
87- 'plugins ' => ['analysis-nori ' ],
88- 'param ' => [
89- 'key ' => 'node.store.allow_mmap ' ,
90- 'value ' => 'false ' ,
91- 'needle ' => '"store":{"allow_mmap":"false"} ' ,
92- ]
93- ],
94- [
95- 'version ' => '2.4 ' ,
96- 'xms ' => '520m ' ,
97- 'xmx ' => '520m ' ,
98- 'plugins ' => ['analysis-nori ' ],
99- 'param ' => [
100- 'key ' => 'node.store.allow_mmap ' ,
101- 'value ' => 'false ' ,
102- 'needle ' => '"store":{"allow_mmap":"false"} ' ,
103- ]
104- ],
105- ];
106- }
10724}
0 commit comments