From 7aaf46c22b09c76bb096b4e24b99f01ee978fcd9 Mon Sep 17 00:00:00 2001 From: Ulas Kozat Date: Fri, 1 Jul 2016 12:21:19 -0700 Subject: return FAILED status when no file is generated for distribution add tests/logdata/ to make CI happy Change-Id: I01e0b9feebd5dee2175999e78885abf7124a8410 Signed-off-by: Ulas Kozat --- DominoServer.py | 6 ++++++ tests/logdata/client1.log | 29 +++++++++++++++++++++++++++++ tests/logdata/server.log | 30 ++++++++++++++++++++++++++++++ tests/refdata/test1.ref | 2 +- tests/run.sh | 6 ++++-- 5 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 tests/logdata/client1.log create mode 100644 tests/logdata/server.log diff --git a/DominoServer.py b/DominoServer.py index 95fbe53..5c5fbd4 100755 --- a/DominoServer.py +++ b/DominoServer.py @@ -317,6 +317,12 @@ class CommunicationHandler: logging.error('Error: %s', sys.exc_info()[0]) pub_r.responseCode = FAILED + # Check if any file is generated for distribution, if not + # return FAILED as responseCode, we should also send description for + # reason + if len(file_paths) == 0: + pub_r.responseCode = FAILED + return pub_r #Query from Domino Client is received diff --git a/tests/logdata/client1.log b/tests/logdata/client1.log new file mode 100644 index 0000000..d234807 --- /dev/null +++ b/tests/logdata/client1.log @@ -0,0 +1,29 @@ +07/01/2016 12:18:05 PM Domino Client Starting... +07/01/2016 12:18:05 PM 1 Sending Registration +07/01/2016 12:18:05 PM Registration Response: Response Code: 1 +07/01/2016 12:18:05 PM CLI Service is starting +07/01/2016 12:18:05 PM RPC service for CLI is starting... +07/01/2016 12:18:06 PM Received CLI ['heartbeat'] +07/01/2016 12:18:06 PM 12467 Sending heartbeat +07/01/2016 12:18:06 PM heart beat received from: 0 ,sequence number: 1 +07/01/2016 12:18:07 PM Received CLI ['subscribe', '-t', 'hot', '-l', 'tosca.policies.Placement:properties:region:nova-1'] +07/01/2016 12:18:07 PM subscribing labels ['tosca.policies.Placement:properties:region:nova-1'] and templates ['hot'] +07/01/2016 12:18:07 PM Subscribe Response is received from: 0 ,sequence number: 2 +07/01/2016 12:18:08 PM Received CLI ['subscribe', '-t', 'dummy1,dummy2', '--top', 'OVERWRITE'] +07/01/2016 12:18:08 PM subscribing labels [] and templates ['dummy1', 'dummy2'] +07/01/2016 12:18:08 PM Subscribe Response is received from: 0 ,sequence number: 3 +07/01/2016 12:18:09 PM Received CLI ['subscribe', '-t', 'dummy1,dummy2', '--top', 'DELETE'] +07/01/2016 12:18:09 PM subscribing labels [] and templates ['dummy1', 'dummy2'] +07/01/2016 12:18:09 PM Subscribe Response is received from: 0 ,sequence number: 4 +07/01/2016 12:18:10 PM Received CLI ['subscribe', '-l', 'tosca.policies.Placement:properties:region:nova-2', 'sleep', '1'] +07/01/2016 12:18:10 PM subscribing labels ['tosca.policies.Placement:properties:region:nova-2'] and templates [] +07/01/2016 12:18:10 PM Subscribe Response is received from: 0 ,sequence number: 5 +07/01/2016 12:18:10 PM Received CLI ['subscribe', '-l', 'tosca.policies.Placement:properties:region:nova-3', '--lop', 'OVERWRITE'] +07/01/2016 12:18:10 PM subscribing labels ['tosca.policies.Placement:properties:region:nova-3'] and templates [] +07/01/2016 12:18:10 PM Subscribe Response is received from: 0 ,sequence number: 6 +07/01/2016 12:18:11 PM Received CLI ['subscribe', '-l', 'tosca.policies.Placement:properties:region:nova-3', '--lop', 'DELETE'] +07/01/2016 12:18:11 PM subscribing labels ['tosca.policies.Placement:properties:region:nova-3'] and templates [] +07/01/2016 12:18:11 PM Subscribe Response is received from: 0 ,sequence number: 7 +07/01/2016 12:18:12 PM Received CLI ['publish', '-t', './tosca-templates/tosca_helloworld_nfv.yaml'] +07/01/2016 12:18:12 PM Publishing the template file: ./tosca-templates/tosca_helloworld_nfv.yaml +07/01/2016 12:18:12 PM Publish Response is received from: 0 ,sequence number: 8 Op. Status: 2 diff --git a/tests/logdata/server.log b/tests/logdata/server.log new file mode 100644 index 0000000..57f1813 --- /dev/null +++ b/tests/logdata/server.log @@ -0,0 +1,30 @@ +07/01/2016 12:18:04 PM Domino Server Starting... +07/01/2016 12:18:05 PM Registration Request received for UDID 12467 from IP: 192.168.254.12 port: 9091 +07/01/2016 12:18:06 PM heartbeat received from 12467 +07/01/2016 12:18:07 PM Subscribe Request received from 12467 +07/01/2016 12:18:07 PM APPENDING Labels... +07/01/2016 12:18:07 PM Supported Template: set(['hot']) Supported Labels: set(['tosca.policies.Placement:properties:region:nova-1']) +07/01/2016 12:18:08 PM Subscribe Request received from 12467 +07/01/2016 12:18:08 PM APPENDING Labels... +07/01/2016 12:18:08 PM Supported Template: set(['dummy2', 'dummy1']) Supported Labels: set(['tosca.policies.Placement:properties:region:nova-1']) +07/01/2016 12:18:09 PM Subscribe Request received from 12467 +07/01/2016 12:18:09 PM APPENDING Labels... +07/01/2016 12:18:09 PM Supported Template: set([]) Supported Labels: set(['tosca.policies.Placement:properties:region:nova-1']) +07/01/2016 12:18:10 PM Subscribe Request received from 12467 +07/01/2016 12:18:10 PM APPENDING Labels... +07/01/2016 12:18:10 PM Supported Template: set([]) Supported Labels: set(['tosca.policies.Placement:properties:region:nova-2', 'tosca.policies.Placement:properties:region:nova-1']) +07/01/2016 12:18:10 PM Subscribe Request received from 12467 +07/01/2016 12:18:10 PM OVERWRITING Labels... +07/01/2016 12:18:10 PM Supported Template: set([]) Supported Labels: set(['tosca.policies.Placement:properties:region:nova-3']) +07/01/2016 12:18:11 PM Subscribe Request received from 12467 +07/01/2016 12:18:11 PM DELETING Labels... +07/01/2016 12:18:11 PM Supported Template: set([]) Supported Labels: set([]) +07/01/2016 12:18:12 PM Publish Request received from 12467 +07/01/2016 12:18:12 PM ['tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0', '', 'description: Template for deploying a single server with predefined properties.', '', 'metadata:', ' template_name: TOSCA NFV Sample Template', '', 'policy_types:', ' tosca.policies.Placement.Geolocation:', ' description: Geolocation policy', ' derived_from: tosca.policies.Placement', '', 'topology_template:', ' node_templates:', ' VNF1:', ' type: tosca.nodes.nfv.VNF', ' properties:', ' id: vnf1', ' vendor: acmetelco', ' version: 1.0', '', ' VNF2:', ' type: tosca.nodes.nfv.VNF', ' properties:', ' id: vnf2', ' vendor: ericsson', ' version: 1.0', '', ' VNF3:', ' type: tosca.nodes.nfv.VNF', ' properties:', ' id: vnf3', ' vendor: huawei', ' version: 1.0', '', ' policies:', ' - rule1:', ' type: tosca.policies.Placement.Geolocation', ' targets: [ VNF1 ]', ' properties:', ' region: [ us-west-1 ]', ' - rule2:', ' type: tosca.policies.Placement.Geolocation', ' targets: [ VNF2, VNF3 ]', ' properties:', ' region: [ us-west-1 , us-west-2 ]'] +07/01/2016 12:18:12 PM nfv +07/01/2016 12:18:12 PM nfv.py +07/01/2016 12:18:12 PM The input "./toscafiles/template1.yaml" successfully passed validation. +07/01/2016 12:18:12 PM Node Labels: {'VNF2': set(['tosca.policies.Placement.Geolocation:properties:region:us-west-1', 'tosca.policies.Placement.Geolocation:properties:region:us-west-2']), 'VNF3': set(['tosca.policies.Placement.Geolocation:properties:region:us-west-1', 'tosca.policies.Placement.Geolocation:properties:region:us-west-2']), 'VNF1': set(['tosca.policies.Placement.Geolocation:properties:region:us-west-1'])} +07/01/2016 12:18:12 PM Site Maps: {'VNF2': set([]), 'VNF3': set([]), 'VNF1': set([])} +07/01/2016 12:18:12 PM Selected Sites: {'VNF2': [], 'VNF3': [], 'VNF1': []} +07/01/2016 12:18:12 PM Per domain file paths: {} diff --git a/tests/refdata/test1.ref b/tests/refdata/test1.ref index 2f3b328..edb865a 100644 --- a/tests/refdata/test1.ref +++ b/tests/refdata/test1.ref @@ -26,4 +26,4 @@ subscribing labels ['tosca.policies.Placement:properties:region:nova-3'] and tem Subscribe Response is received from: 0 ,sequence number: 7 Received CLI ['publish', '-t', './tosca-templates/tosca_helloworld_nfv.yaml'] Publishing the template file: ./tosca-templates/tosca_helloworld_nfv.yaml -Publish Response is received from: 0 ,sequence number: 8 Op. Status: 1 +Publish Response is received from: 0 ,sequence number: 8 Op. Status: 2 diff --git a/tests/run.sh b/tests/run.sh index 33c2749..bf92609 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -112,7 +112,7 @@ sleep 1 echo "Test Publish API" python domino-cli.py $CLIENT1_CLIPORT publish -t "$toscafile_test1" -sleep 5 +sleep 1 #echo "Stopping Domino Client 1..." #stop_client1 @@ -122,6 +122,7 @@ sleep 5 cut -d " " -f 4- "$client1_log" > file1 #will use the form below to declare success or failure +set +e diff -q file1 "$test1_reffile" 1>/dev/null if [[ $? == "0" ]] then @@ -129,6 +130,7 @@ then else echo "FAILURE" fi - +set -e echo "done" + -- cgit 1.2.3-korg