summaryrefslogtreecommitdiffstats
path: root/cds-regression-test/test/remote-ansible/connection-failure
diff options
context:
space:
mode:
authorSantoshB <santosh.bayas@amdocs.com>2020-10-15 14:57:57 +0530
committermrichomme <morgan.richomme@orange.com>2020-11-12 14:52:33 +0100
commitd3cdace51db473c93540229da3a0fd061120957c (patch)
treed2d4f1031c7d577d51fe27b6daf1a1e80cdb409d /cds-regression-test/test/remote-ansible/connection-failure
parent8e75c091c8f2079b8ae59ae544fbd19bbef3f963 (diff)
cds-bash script package
Issue-ID: CCSDK-2913 Change-Id: I2f97b0c78314019d5002e8563c4e433ae5e816b9 Signed-off-by: SantoshB <santosh.bayas@amdocs.com> Signed-off-by: mrichomme <morgan.richomme@orange.com>
Diffstat (limited to 'cds-regression-test/test/remote-ansible/connection-failure')
-rw-r--r--cds-regression-test/test/remote-ansible/connection-failure/expected-response.json28
-rw-r--r--cds-regression-test/test/remote-ansible/connection-failure/request-payload.json27
-rw-r--r--cds-regression-test/test/remote-ansible/connection-failure/test.sh25
3 files changed, 80 insertions, 0 deletions
diff --git a/cds-regression-test/test/remote-ansible/connection-failure/expected-response.json b/cds-regression-test/test/remote-ansible/connection-failure/expected-response.json
new file mode 100644
index 0000000..301e70b
--- /dev/null
+++ b/cds-regression-test/test/remote-ansible/connection-failure/expected-response.json
@@ -0,0 +1,28 @@
+{
+ "commonHeader": {
+ "timestamp": "2020-05-01T19:38:57.529Z",
+ "originatorId": "System",
+ "requestId": "remote-ansible-connection-failure",
+ "subRequestId": "remote-ansible-connection-failure-1",
+ "flags": null
+ },
+ "actionIdentifiers": {
+ "blueprintName": "RT-remote-ansible",
+ "blueprintVersion": "1.0.0",
+ "actionName": "connection-fail",
+ "mode": "sync"
+ },
+ "status": {
+ "code": 500,
+ "eventType": "EVENT_COMPONENT_FAILURE",
+ "timestamp": "2020-05-01T19:38:57.551Z",
+ "errorMessage": "error : ansible-command-logs : Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))",
+ "message": "failure"
+ },
+ "payload": {
+ "connection-fail-response": {
+ "ansible-command-status": "error",
+ "ansible-command-logs": "Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))"
+ }
+ }
+}
diff --git a/cds-regression-test/test/remote-ansible/connection-failure/request-payload.json b/cds-regression-test/test/remote-ansible/connection-failure/request-payload.json
new file mode 100644
index 0000000..08e39c7
--- /dev/null
+++ b/cds-regression-test/test/remote-ansible/connection-failure/request-payload.json
@@ -0,0 +1,27 @@
+{
+ "commonHeader": {
+ "originatorId": "System",
+ "requestId": "remote-ansible-connection-failure",
+ "subRequestId": "remote-ansible-connection-failure-1"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "RT-remote-ansible",
+ "blueprintVersion": "1.0.0",
+ "actionName": "connection-fail",
+ "mode": "sync"
+ },
+ "payload": {
+ "connection-fail-request": {
+ "endpoint-selector": "awx",
+ "job-template-name": "hello_world_job_template",
+ "inventory": "Demo Inventory",
+ "limit": "123",
+ "tags": "some-tag",
+ "skip-tags": "some-skip-tag",
+ "extra-vars": {
+ "site_id": "3 - Belmont",
+ "tor_group": "vEPC"
+ }
+ }
+ }
+}
diff --git a/cds-regression-test/test/remote-ansible/connection-failure/test.sh b/cds-regression-test/test/remote-ansible/connection-failure/test.sh
new file mode 100644
index 0000000..7c880fe
--- /dev/null
+++ b/cds-regression-test/test/remote-ansible/connection-failure/test.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+CBA_NAME="remote-ansible"
+TEST_NAME="connection-failure"
+TEST_NUMBER=$RANDOM
+
+mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/"
+RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers"
+RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload"
+
+REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json"
+EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json"
+
+. ./$TEST_DIRECTORY/utils.sh
+
+echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME"
+
+echo 'Calling CDS process'
+process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE
+
+echo 'Assert statuscode'
+assert_status_code 500 $RESPONSE_HEADERS_FILE
+
+echo 'Assert payload'
+assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE