Merge "[k8s][conformance] Check sonobuoy container runs"
authorCristina Pauna <cristina.pauna@enea.com>
Fri, 15 Nov 2019 09:13:15 +0000 (09:13 +0000)
committerGerrit Code Review <gerrit@akraino.org>
Fri, 15 Nov 2019 09:13:15 +0000 (09:13 +0000)
docker/k8s/pip-requirements.txt
docker/os/Dockerfile
tests/k8s/conformance/conformance.robot
ui/src/main/java/org/akraino/validation/ui/client/nexus/NexusExecutorClient.java
ui/src/main/webapp/app/BluvalUI/CommittedSubmissions/CommittedSubmissions.html

index 6139a45..18b264c 100644 (file)
@@ -1,4 +1,5 @@
 robotframework
 robotframework-httplibrary
+robotframework-jsonlibrary
 robotframework-requests
 robotframework-sshlibrary
index 61d1848..a47485e 100644 (file)
@@ -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
index 17f05d3..edd2271 100644 (file)
@@ -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}
@@ -140,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}
index 263d7de..38c653d 100644 (file)
@@ -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<ValidationDbTestResult> 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<ValidationDbTestResult> 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<String> 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<WRobotNexusTestResult> 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<WRobotNexusTestResult> listOfwrappers = new ArrayList<WRobotNexusTestResult>();
@@ -473,24 +473,31 @@ public final class NexusExecutorClient {
         List<Element> 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;
     }
index 3352960..45eebd2 100644 (file)
@@ -49,7 +49,7 @@ limitations under the License.
     href="app/fusion/styles/ecomp.css">
 
 <link rel="stylesheet"
-    href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
+    href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
 <link rel="stylesheet"
     href="https://cdnjs.cloudflare.com/ajax/libs/ng-table/1.0.0/ng-table.css">