Skip to content

Commit f0d8d1c

Browse files
committed
added remove prom,grafana method
1 parent 9a09050 commit f0d8d1c

File tree

2 files changed

+18
-79
lines changed

2 files changed

+18
-79
lines changed

integration-tests/USECASES.MD

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ Configuration Overrides Usecases
111111
| Append Configuration with varios combinations of attributes via exporter console| Append monitoring exporter configuration [a] to new config [a,b] and verify it was applied |
112112
| Replace Configuration with only one attribute as array via exporter console| Replace monitoring exporter configuration [a,b,c] attributes with new config [a] and verify it was applied |
113113
| Replace Configuration with empty config file via exporter console| Replace monitoring exporter configuration with empty config file, verify it was applied |
114-
| Replace Configuration with not existed config file via exporter console| Try to replace monitoring exporter configuration with not existed config file, verify configuration has not changed |
115-
| Replace Configuration with empty string for config file param via exporter console| Try to replace monitoring exporter configuration with empty string for config file param, verify configuration has not changed |
116114
| Replace/Append Configuration with config file written in non yml format via exporter console| Try to replace/append monitoring exporter configuration with config file written in non yml format, verify configuration has not changed |
117115
| Replace/Append Configuration with corrupted yml file via exporter console| Try to replace/append monitoring exporter configuration with config file written in corrupted yml format, verify configuration has not changed |
118116
| Replace/Append Configuration with dublicated values in the config file via exporter console| Try to replace/append monitoring exporter configuration with dublicated values in the config file, verify configuration has not changed |
119-
| Replace/Append Configuration with dublicated values in the config file via exporter console| Try to replace/append monitoring exporter configuration with varios combos for invalid credentials, verify configuration has not changed and `401 Unauthorized` exception was thrown |
117+
| Replace/Append Configuration with invalid credentials via exporter console| Try to replace/append monitoring exporter configuration with varios combos for invalid credentials, verify configuration has not changed and `401 Unauthorized` exception was thrown |

integration-tests/src/test/java/oracle/kubernetes/operator/ITMonitoringExporter.java

Lines changed: 17 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ public static void staticUnPrepare() throws Exception {
116116
if (operator != null) {
117117
operator.destroy();
118118
}
119-
120119
tearDown(new Object() {}.getClass().getEnclosingClass().getSimpleName());
121-
120+
deletePrometheusGrafana();
122121
logger.info("SUCCESS");
123122
}
124123
}
@@ -276,40 +275,6 @@ public void test06_ReplaceWithEmptyConfiguration() throws Exception {
276275
logger.info("SUCCESS - " + testMethodName);
277276
}
278277

279-
/**
280-
* Replace monitoring exporter configuration with not existed config file
281-
*
282-
* @throws Exception
283-
*/
284-
@Test
285-
public void test06_1ReplaceWithNotExistedFileConfiguration() throws Exception {
286-
Assume.assumeFalse(QUICKTEST);
287-
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
288-
logTestBegin(testMethodName);
289-
boolean testCompletedSuccessfully = false;
290-
HtmlPage page = submitConfigureForm(exporterUrl, "replace", "/scratch/m/test.yml");
291-
assertTrue(page.asText().contains("queries:") && !page.asText().contains("values"));
292-
testCompletedSuccessfully = true;
293-
logger.info("SUCCESS - " + testMethodName);
294-
}
295-
296-
/**
297-
* Replace monitoring exporter configuration with no file name for configuration
298-
*
299-
* @throws Exception
300-
*/
301-
@Test
302-
public void test06_2ReplaceWithNoFileNameConfiguration() throws Exception {
303-
Assume.assumeFalse(QUICKTEST);
304-
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
305-
logTestBegin(testMethodName);
306-
boolean testCompletedSuccessfully = false;
307-
HtmlPage page = submitConfigureForm(exporterUrl, "replace", "");
308-
assertTrue(page.asText().contains("queries:") && !page.asText().contains("values"));
309-
testCompletedSuccessfully = true;
310-
logger.info("SUCCESS - " + testMethodName);
311-
}
312-
313278
/**
314279
* Try to append monitoring exporter configuration with empty configuration
315280
*
@@ -330,46 +295,6 @@ public void test07_AppendWithEmptyConfiguration() throws Exception {
330295
logger.info("SUCCESS - " + testMethodName);
331296
}
332297

333-
/**
334-
* Try to append monitoring exporter configuration with not existed configuration file
335-
*
336-
* @throws Exception
337-
*/
338-
@Test
339-
public void test07_1AppendWithNotExistedFileConfiguration() throws Exception {
340-
Assume.assumeFalse(QUICKTEST);
341-
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
342-
logTestBegin(testMethodName);
343-
boolean testCompletedSuccessfully = false;
344-
final WebClient webClient = new WebClient();
345-
HtmlPage originalPage = webClient.getPage(exporterUrl);
346-
assertNotNull(originalPage);
347-
HtmlPage page = submitConfigureForm(exporterUrl, "append", "/scratch/m/test.yml");
348-
assertTrue(originalPage.asText().equals(page.asText()));
349-
testCompletedSuccessfully = true;
350-
logger.info("SUCCESS - " + testMethodName);
351-
}
352-
353-
/**
354-
* Try to append monitoring exporter configuration with null name for configuration file
355-
*
356-
* @throws Exception
357-
*/
358-
@Test
359-
public void test07_2AppendWithNoFileNameConfiguration() throws Exception {
360-
Assume.assumeFalse(QUICKTEST);
361-
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
362-
logTestBegin(testMethodName);
363-
boolean testCompletedSuccessfully = false;
364-
final WebClient webClient = new WebClient();
365-
HtmlPage originalPage = webClient.getPage(exporterUrl);
366-
assertNotNull(originalPage);
367-
HtmlPage page = submitConfigureForm(exporterUrl, "append", "");
368-
assertTrue(originalPage.asText().equals(page.asText()));
369-
testCompletedSuccessfully = true;
370-
logger.info("SUCCESS - " + testMethodName);
371-
}
372-
373298
/**
374299
* Try to append monitoring exporter configuration with configuration file not in the yaml format
375300
*
@@ -682,6 +607,7 @@ private HtmlPage submitConfigureForm(
682607
// Now submit the form by clicking the button and get back the second page.
683608
HtmlPage page2 = button.click();
684609
assertNotNull(page2);
610+
assertFalse((page2.asText()).contains("Error 500--Internal Server Error"));
685611
return page2;
686612
}
687613

@@ -795,6 +721,21 @@ private static void deployMonitoringExporterPrometethusGrafana(
795721
"wlsexporter", exporterAppPath, BaseTest.getUsername(), BaseTest.getPassword());
796722
}
797723

724+
private static void deletePrometheusGrafana() throws Exception {
725+
726+
String samplesDir = monitoringExporterDir + "/src/samples/kubernetes/";
727+
728+
String crdCmd = " kubectl delete -f " + samplesDir + "prometheus-deployment.yaml";
729+
TestUtils.exec(crdCmd);
730+
731+
crdCmd = " kubectl delete -f " + samplesDir + "grafana-deployment.yaml";
732+
TestUtils.exec(crdCmd);
733+
734+
crdCmd = " kubectl delete -f " + samplesDir + "monitoring-namespace.yaml";
735+
TestUtils.exec(crdCmd);
736+
logger.info("Deleted Prometheus and Grafana");
737+
}
738+
798739
/**
799740
* A utility method to add desired domain namespace to coordinator yaml template file replacing
800741
* the DOMAIN_NS,

0 commit comments

Comments
 (0)