@@ -30,6 +30,8 @@ public class ITElasticLogging extends BaseTest {
30
30
private static String k8sExecCmdPrefix ;
31
31
private static String elasticSearchURL ;
32
32
private static Map <String , Object > testVarMap ;
33
+ private static final String elasticStackYamlLoc =
34
+ "kubernetes/samples/scripts/elasticsearch-and-kibana/elasticsearch_and_kibana.yaml" ;
33
35
34
36
/**
35
37
* This method gets called only once before any of the test methods are executed. It does the
@@ -46,12 +48,13 @@ public static void staticPrepare() throws Exception {
46
48
initialize (APP_PROPS_FILE );
47
49
48
50
// Install Elastic Stack
49
- String cmd =
50
- "kubectl apply -f "
51
- + getProjectRoot ()
52
- + "/kubernetes/samples/scripts/elasticsearch-and-kibana/elasticsearch_and_kibana.yaml" ;
53
- logger .info ("Command to install Elastic search and Kibana: " + cmd );
54
- TestUtils .exec (cmd );
51
+ StringBuffer cmd =
52
+ new StringBuffer ("kubectl apply -f " )
53
+ .append (getProjectRoot ())
54
+ .append ("/" )
55
+ .append (elasticStackYamlLoc );
56
+ logger .info ("Command to Install Elastic Stack: " + cmd .toString ());
57
+ TestUtils .exec (cmd .toString ());
55
58
56
59
// Create operator-elk
57
60
if (operator == null ) {
@@ -69,11 +72,12 @@ public static void staticPrepare() throws Exception {
69
72
// Get Elasticsearch host and port from yaml file and build Elasticsearch URL
70
73
testVarMap = TestUtils .loadYaml (OPERATOR1_ELK_YAML );
71
74
String operatorPodName = operator .getOperatorPodName ();
72
- elasticSearchURL =
73
- "http://"
74
- + testVarMap .get ("elasticSearchHost" )
75
- + ":"
76
- + testVarMap .get ("elasticSearchPort" );
75
+ StringBuffer elasticSearchURLBuff =
76
+ new StringBuffer ("http://" )
77
+ .append (testVarMap .get ("elasticSearchHost" ))
78
+ .append (":" )
79
+ .append (testVarMap .get ("elasticSearchPort" ));
80
+ elasticSearchURL = elasticSearchURLBuff .toString ();
77
81
Assume .assumeFalse (
78
82
"Got null when building Elasticsearch URL" , elasticSearchURL .contains ("null" ));
79
83
@@ -108,12 +112,13 @@ public static void staticUnPrepare() throws Exception {
108
112
tearDown (new Object () {}.getClass ().getEnclosingClass ().getSimpleName ());
109
113
110
114
// Uninstall Elastic Stack
111
- String cmd =
112
- "kubectl delete -f "
113
- + getProjectRoot ()
114
- + "/kubernetes/samples/scripts/elasticsearch-and-kibana/elasticsearch_and_kibana.yaml" ;
115
- logger .info ("Command to uninstall Elastic Stack: " + cmd );
116
- TestUtils .exec (cmd );
115
+ StringBuffer cmd =
116
+ new StringBuffer ("kubectl delete -f " )
117
+ .append (getProjectRoot ())
118
+ .append ("/" )
119
+ .append (elasticStackYamlLoc );
120
+ logger .info ("Command to uninstall Elastic Stack: " + cmd .toString ());
121
+ TestUtils .exec (cmd .toString ());
117
122
118
123
logger .info ("SUCCESS" );
119
124
}
@@ -214,7 +219,7 @@ private void verifySearchResults(String queryCriteria, String regex, boolean che
214
219
Assume .assumeTrue ("Total failed count should be 0!" , failedCount == 0 );
215
220
logger .info ("Total failed count: " + failedCount );
216
221
} else {
217
- Assume .assumeFalse ("Total failed count should be 0 !" , hits .isEmpty ());
222
+ Assume .assumeFalse ("Total hits of search is empty !" , hits .isEmpty ());
218
223
}
219
224
}
220
225
@@ -281,6 +286,7 @@ private static String execElasticStackStatusCheck(String indexName, String varLo
281
286
.toString ();
282
287
logger .info ("Command to exec Elastic Stack status check: " + cmd );
283
288
ExecResult result = TestUtils .exec (cmd );
289
+ logger .info (result .stdout ());
284
290
285
291
return result .stdout ();
286
292
}
0 commit comments