From 0f6a1cff85cc2c2ecd50ac264cf8414934019e95 Mon Sep 17 00:00:00 2001 From: "filip.batkowski" Date: Mon, 19 Nov 2018 12:31:33 +0100 Subject: [PATCH 1/4] Fixed issue with lack of clear error message, when there are syntax errors in test suite. --- client/client-scripts/aet.sh | 5 ++-- report/src/main/webapp/package-lock.json | 28 ++++++++++++++----- .../cognifide/aet/executor/SuiteServlet.java | 6 ++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/client/client-scripts/aet.sh b/client/client-scripts/aet.sh index 9abc7ea6d..d1a67e5a6 100755 --- a/client/client-scripts/aet.sh +++ b/client/client-scripts/aet.sh @@ -81,8 +81,9 @@ function process_locked_suite { ((UNLOCK_TIMEOUT-=5)) start_suite else + errorMessage=$(echo $body | jq -r ".errorMessage") echo "Unsuccessful Request to \"$endpoint$SUITE_ENDPOINT\", status: $code - $body" +$errorMessage" exit 1 fi } @@ -196,4 +197,4 @@ while $process_status; do $body" exit 1 fi -done +done \ No newline at end of file diff --git a/report/src/main/webapp/package-lock.json b/report/src/main/webapp/package-lock.json index 92ec69283..360117353 100644 --- a/report/src/main/webapp/package-lock.json +++ b/report/src/main/webapp/package-lock.json @@ -5379,12 +5379,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5399,17 +5401,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -5526,7 +5531,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -5538,6 +5544,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5552,6 +5559,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -5559,12 +5567,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -5583,6 +5593,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -5663,7 +5674,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5675,6 +5687,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5796,6 +5809,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java b/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java index ef4d8e0db..cc88b3c0c 100644 --- a/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java +++ b/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java @@ -92,8 +92,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) String responseBody = gson.toJson(suiteExecutionResult); if (resultWrapper.hasError()) { - response.sendError(resultWrapper.getStatusCode(), - suiteExecutionResult.getErrorMessage()); + response.setStatus(resultWrapper.getStatusCode()); + response.setContentType("application/json"); + response.setCharacterEncoding(CharEncoding.UTF_8); + response.getWriter().write(responseBody); } else { response.setStatus(HttpStatus.SC_OK); response.setContentType("application/json"); From 050cee1c66563b2aa1e5c149447944ccc69e8396 Mon Sep 17 00:00:00 2001 From: "filip.batkowski" Date: Mon, 19 Nov 2018 16:10:09 +0100 Subject: [PATCH 2/4] Simplified the if-else part of doPost. --- report/src/main/webapp/package-lock.json | 28 +++++-------------- .../cognifide/aet/executor/SuiteServlet.java | 15 +++------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/report/src/main/webapp/package-lock.json b/report/src/main/webapp/package-lock.json index 360117353..92ec69283 100644 --- a/report/src/main/webapp/package-lock.json +++ b/report/src/main/webapp/package-lock.json @@ -5379,14 +5379,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5401,20 +5399,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -5531,8 +5526,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -5544,7 +5538,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5559,7 +5552,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -5567,14 +5559,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -5593,7 +5583,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -5674,8 +5663,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -5687,7 +5675,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -5809,7 +5796,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java b/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java index cc88b3c0c..1c32995dd 100644 --- a/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java +++ b/test-executor/src/main/java/com/cognifide/aet/executor/SuiteServlet.java @@ -91,17 +91,10 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) String responseBody = gson.toJson(suiteExecutionResult); - if (resultWrapper.hasError()) { - response.setStatus(resultWrapper.getStatusCode()); - response.setContentType("application/json"); - response.setCharacterEncoding(CharEncoding.UTF_8); - response.getWriter().write(responseBody); - } else { - response.setStatus(HttpStatus.SC_OK); - response.setContentType("application/json"); - response.setCharacterEncoding(CharEncoding.UTF_8); - response.getWriter().write(responseBody); - } + response.setStatus(resultWrapper.getStatusCode()); + response.setContentType("application/json"); + response.setCharacterEncoding(CharEncoding.UTF_8); + response.getWriter().write(responseBody); } else { response.sendError(HttpStatus.SC_BAD_REQUEST, "Request does not contain the test suite"); } From 03c9b730bdbd411f081fbb99eba2b8af9f71a26c Mon Sep 17 00:00:00 2001 From: "filip.batkowski" Date: Mon, 19 Nov 2018 17:11:46 +0100 Subject: [PATCH 3/4] Updated the CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffbfc8373..a341f1d1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to AET will be documented in this file. - [PR-429](https://github.com/Cognifide/aet/pull/429) - `aet-cookbook` version updated to [`v5.1.1`](https://github.com/Cognifide/aet-cookbook/blob/master/CHANGELOG.md#511) in Vagrant. **Important**: please follow the instructions from [PR-43 description](https://github.com/Cognifide/aet-cookbook/pull/43) in order to keep the MongoDB data on your local environment. - [PR-422](https://github.com/Cognifide/aet/pull/422) RunnerConfiguration's urlPackageSize property got set to 1 +- [PR-432](https://github.com/Cognifide/aet/pull/432) Fixed issue with lack of clear message for erroneous suite definition. ## Version 3.1.0 From 270562ac4ddb27d7f66a3d0317317b9b90c13797 Mon Sep 17 00:00:00 2001 From: Filip Batkowski Date: Tue, 20 Nov 2018 10:28:19 +0100 Subject: [PATCH 4/4] Update of error message (CR correction). --- client/client-scripts/aet.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client-scripts/aet.sh b/client/client-scripts/aet.sh index d1a67e5a6..0607705aa 100755 --- a/client/client-scripts/aet.sh +++ b/client/client-scripts/aet.sh @@ -82,7 +82,7 @@ function process_locked_suite { start_suite else errorMessage=$(echo $body | jq -r ".errorMessage") - echo "Unsuccessful Request to \"$endpoint$SUITE_ENDPOINT\", status: $code + echo "Unsuccessful Request to \"$endpoint$SUITE_ENDPOINT\", status: $code, error: $errorMessage" exit 1 fi