From: Cristina Pauna Date: Fri, 15 Nov 2019 09:14:06 +0000 (+0000) Subject: Merge "LTP installed, executed, cleaned on target node" X-Git-Tag: 2.0.0 X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=validation.git;a=commitdiff_plain;h=b05dede6fa4fdca7ee1faa1e03f1f3d8145eccd8;hp=8acab9fd267fbc5067495b63c5c142cb8b265670 Merge "LTP installed, executed, cleaned on target node" --- diff --git a/docker/k8s/pip-requirements.txt b/docker/k8s/pip-requirements.txt index 6139a45..18b264c 100644 --- a/docker/k8s/pip-requirements.txt +++ b/docker/k8s/pip-requirements.txt @@ -1,4 +1,5 @@ robotframework robotframework-httplibrary +robotframework-jsonlibrary robotframework-requests robotframework-sshlibrary diff --git a/docker/os/Dockerfile b/docker/os/Dockerfile index 61d1848..a47485e 100644 --- a/docker/os/Dockerfile +++ b/docker/os/Dockerfile @@ -57,7 +57,8 @@ COPY --from=build /opt/akraino/validation /opt/akraino/validation COPY --from=build /opt/akraino/ltp.tar.gz /opt/akraino/ltp.tar.gz RUN apt-get update && apt-get -y install \ - python3-pip python3.7 &&\ + python3-pip python3.6 && \ + cd /usr/bin && ln -s python3 python && \ pip3 install -r /wheels/requirements/pip-requirements.txt \ -f /wheels && \ rm -rf /wheels && \ @@ -65,5 +66,5 @@ RUN apt-get update && apt-get -y install \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* -# Install blueval dependencies +# Install bluval dependencies RUN pip3 install -r /opt/akraino/validation/bluval/requirements.txt diff --git a/tests/k8s/conformance/conformance.robot b/tests/k8s/conformance/conformance.robot index 45965c7..edd2271 100644 --- a/tests/k8s/conformance/conformance.robot +++ b/tests/k8s/conformance/conformance.robot @@ -24,8 +24,10 @@ Library Collections Library String Library SSHLibrary Library Process +Library JSONLibrary Test Setup Run Keywords ... Check that k8s cluster is reachable +... Define Images ... Onboard Images ... Create Manifest File Test Teardown Run Keywords @@ -38,7 +40,7 @@ ${LOG} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}.log &{SONOBUOY} path=gcr.io/heptio-images ... name=sonobuoy:v0.16.1 &{E2E} path=akraino -... name=validation:kube-conformance-v1.16 +... name=Actual value set dynamically &{SYSTEMD_LOGS} path=akraino ... name=validation:sonobuoy-plugin-systemd-logs-latest &{SONOBUOY_IMGS} sonobuoy=&{SONOBUOY} @@ -71,6 +73,7 @@ Run Sonobuoy Conformance Test Append To File ${LOG} ${output}${\n} # Wait until the test finishes execution + Wait Until Keyword Succeeds 3x 20 sec Check that sonobuoy is running Run while sonobuoy status | grep "Sonobuoy is still running"; do sleep 180; done Append To File ${LOG} "Sonobuoy has completed"${\n} @@ -91,6 +94,10 @@ Check that k8s cluster is reachable Append To File ${LOG} ${output}${\n} Should Contain ${output} Server Version: version.Info +Check that sonobuoy is running + ${output}= Run kubectl get pod sonobuoy --namespace sonobuoy + Should Contain ${output} Running + Cleanup Sonobuoy ${rc} ${output}= Run And Return Rc And Output ... kubectl delete -f ${CURDIR}${/}sonobuoy.yaml @@ -135,6 +142,14 @@ Onboard Kubernetes e2e Test Images Upload To Internal Registry ${path} ${name} END +Define Images + ${result}= Run Process kubectl version -o json + Should Be Equal As Integers ${result.rc} 0 + ${versions}= Convert String To JSON ${result.stdout} + ${major}= Get Value From Json ${versions} $.serverVersion.major + ${minor}= Get Value From Json ${versions} $.serverVersion.minor + Set To Dictionary ${SONOBUOY_IMGS['e2e']} name=validation:kube-conformance-v${major[0]}.${minor[0]} + Onboard Images ${INT_REG}= Get Variable Value ${INTERNAL_REGISTRY} ${EMPTY} Set Test Variable ${INT_REG} diff --git a/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java b/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java index 263d7de..38c653d 100644 --- a/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java +++ b/ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java @@ -156,8 +156,8 @@ public final class NexusExecutorClient { public ValidationDbTestResult getResult(@Nonnull String name, @Nonnull String version, @Nonnull String siloText, @Nonnull String timestamp) - throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, - IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { + throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, + IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation nexus test result"); WebResource webResource = this.client.resource(nexusUrl + "/"); @@ -215,8 +215,8 @@ public final class NexusExecutorClient { public List getResults(@Nonnull String name, @Nonnull String version, @Nonnull String siloText, int noOfLastElements) - throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, - IOException, KeyManagementException, NoSuchAlgorithmException, ParseException { + throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, + IOException, KeyManagementException, NoSuchAlgorithmException, ParseException { String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus test results"); WebResource webResource = this.client.resource(nexusUrl + "/"); @@ -265,8 +265,8 @@ public final class NexusExecutorClient { public List getResults(@Nonnull String name, @Nonnull String version, @Nonnull String siloText, @Nonnull Date date) - throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, - IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { + throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, + IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.debug(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus results based on date"); WebResource webResource = this.client.resource(nexusUrl + "/"); @@ -298,8 +298,8 @@ public final class NexusExecutorClient { public ValidationDbTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version, @Nonnull String siloText, List layers, Boolean optional, boolean outcome) - throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, - IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { + throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, + IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome"); WebResource webResource = this.client.resource(nexusUrl + "/"); @@ -362,8 +362,8 @@ public final class NexusExecutorClient { public ValidationDbTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version, @Nonnull String siloText, Boolean allLayers, Boolean optional, boolean outcome) - throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, - IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { + throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, + IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException { String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version; LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome"); WebResource webResource = this.client.resource(nexusUrl + "/"); @@ -420,8 +420,8 @@ public final class NexusExecutorClient { public List getWRobotTestResults(@Nonnull String name, @Nonnull String version, @Nonnull String siloText, @Nonnull String timestamp) - throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, - IOException, KeyManagementException, NoSuchAlgorithmException { + throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException, + IOException, KeyManagementException, NoSuchAlgorithmException { String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version + "/" + timestamp + "/results"; List listOfwrappers = new ArrayList(); @@ -473,24 +473,31 @@ public final class NexusExecutorClient { List elements = document.getElementsByTag("body").get(0).getElementsByTag("table").get(0) .getElementsByTag("tbody").get(0).getElementsByTag("tr"); for (int i = 2; i < elements.size(); i++) { - String testSuiteName = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0).text(); - testSuiteName = testSuiteName.substring(0, testSuiteName.length() - 1); - webResource = this.client.resource(resultsUrl + "/" + testSuiteName + "/output.xml"); - LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString()); - response = webResource.get(ClientResponse.class); - if (response.getStatus() != 200) { - throw new HttpException("Could not retrieve test suite result from Nexus. HTTP error code : " - + response.getStatus() + " and message: " + response.getEntity(String.class)); + try { + String testSuiteName = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0) + .text(); + testSuiteName = testSuiteName.substring(0, testSuiteName.length() - 1); + webResource = this.client.resource(resultsUrl + "/" + testSuiteName + "/output.xml"); + LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString()); + response = webResource.get(ClientResponse.class); + if (response.getStatus() != 200) { + throw new HttpException("Could not retrieve test suite result from Nexus. HTTP error code : " + + response.getStatus() + " and message: " + response.getEntity(String.class)); + } + String result = response.getEntity(String.class); + JSONObject xmlJSONObj = XML.toJSONObject(result); + ObjectMapper mapper = new ObjectMapper(); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + mapper.setSerializationInclusion(Include.NON_NULL); + RobotTestResult robotTestResult = mapper.readValue(xmlJSONObj.toString(), RobotTestResult.class); + robotTestResult.setName(testSuiteName); + rTestResults.add(robotTestResult); + } catch (Exception ex) { + LOGGER.warn(EELFLoggerDelegate.auditLogger, + "Exception occured while retrieving robot results. " + UserUtils.getStackTrace(ex)); + continue; } - String result = response.getEntity(String.class); - JSONObject xmlJSONObj = XML.toJSONObject(result); - ObjectMapper mapper = new ObjectMapper(); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - mapper.setSerializationInclusion(Include.NON_NULL); - RobotTestResult robotTestResult = mapper.readValue(xmlJSONObj.toString(), RobotTestResult.class); - robotTestResult.setName(testSuiteName); - rTestResults.add(robotTestResult); } return rTestResults; } diff --git a/ui/src/main/webapp/app/BluvalUI/CommittedSubmissions/CommittedSubmissions.html b/ui/src/main/webapp/app/BluvalUI/CommittedSubmissions/CommittedSubmissions.html index 3352960..45eebd2 100644 --- a/ui/src/main/webapp/app/BluvalUI/CommittedSubmissions/CommittedSubmissions.html +++ b/ui/src/main/webapp/app/BluvalUI/CommittedSubmissions/CommittedSubmissions.html @@ -49,7 +49,7 @@ limitations under the License. href="app/fusion/styles/ecomp.css"> + href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />