From 2138b6334062db20e74c8f74b423e009df02478a Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Mon, 30 Nov 2020 21:17:32 +0100 Subject: [PATCH] Alinged tests of producer info - including owner Only function test impacted by this change - no impact on delivered images Issue-ID: NONRTRIC-173 Signed-off-by: BjornMagnussonXA Change-Id: I6b4b083fadb51b6c2028f25c35eec42bf850e82b --- test/auto-test/FTC1100.sh | 28 ++++++++++++++-------------- test/auto-test/FTC1800.sh | 16 ++++++++-------- test/auto-test/PM_EI_DEMO.sh | 4 ++-- test/common/README.md | 6 ++++-- test/common/ecs_api_functions.sh | 18 +++++++++--------- test/common/prodstub_api_functions.sh | 14 +++++++------- 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh index 9921108f..4672cb2b 100755 --- a/test/auto-test/FTC1100.sh +++ b/test/auto-test/FTC1100.sh @@ -219,7 +219,7 @@ else fi # Check the job data in the producer -prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json ecs_api_a1_get_job_ids 200 type1 NOWNER job1 ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1 @@ -240,7 +240,7 @@ fi prodstub_equal create/prod-a/job1 1 -ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json +ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json ## Create a second job for prod-a ## job2 - prod-a @@ -251,7 +251,7 @@ else fi # Check the job data in the producer -prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2 ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1 @@ -272,7 +272,7 @@ fi prodstub_equal create/prod-a/job2 1 -ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json job2 type1 $TARGET2 testdata/ecs/job-template.json +ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json ## Setup prod-b ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json @@ -309,7 +309,7 @@ fi prodstub_equal create/prod-b/job3 1 # Check the job data in the producer -prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2 ecs_api_a1_get_job_ids 200 type2 NOWNER job3 @@ -327,8 +327,8 @@ else ecs_api_a1_get_job_status 200 job3 ENABLED fi -ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json job2 type1 $TARGET2 testdata/ecs/job-template.json -ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template.json +ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json +ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json ## Setup prod-c (no types) @@ -387,7 +387,7 @@ else ecs_api_a1_get_job_status 200 job3 ENABLED fi -prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json +prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c @@ -428,7 +428,7 @@ cr_equal received_callbacks 2 30 cr_equal received_callbacks?id=job3-status 2 cr_api_check_all_ecs_events 200 job3-status ENABLED -prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json +prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json ## Setup prod-d @@ -442,7 +442,7 @@ else ecs_api_a1_put_job 201 job8 type4 $TARGET8 ricsim_g3_4 $STATUS8 testdata/ecs/job-template.json fi -prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json prodstub_equal create/prod-d/job8 1 prodstub_equal delete/prod-d/job8 0 @@ -518,7 +518,7 @@ else ecs_api_a1_put_job 201 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template.json fi -prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json prodstub_equal create/prod-e/job10 1 prodstub_equal delete/prod-e/job10 0 @@ -536,7 +536,7 @@ ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ ecs_api_a1_get_job_ids 200 type6 NOWNER job10 -prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json prodstub_equal create/prod-f/job10 1 prodstub_equal delete/prod-f/job10 0 @@ -729,8 +729,8 @@ ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f #Job 10 should be updated when the producer goes enabled deviation "Job 10 should be updated when the producer prod-e goes enabled" -prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 testdata/ecs/job-template2.json -prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 testdata/ecs/job-template2.json +prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json +prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json prodstub_arm_producer 200 prod-f 400 diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh index 048a0111..caec9398 100755 --- a/test/auto-test/FTC1800.sh +++ b/test/auto-test/FTC1800.sh @@ -312,22 +312,22 @@ fi for ((i=1; i<=$NUM_JOBS; i++)) do if [ $(($i%5)) -eq 0 ]; then - prodstub_check_jobdata 200 prod-a job$i type1 $TARGET testdata/ecs/job-template.json - prodstub_check_jobdata 200 prod-b job$i type1 $TARGET testdata/ecs/job-template.json - prodstub_check_jobdata 200 prod-c job$i type1 $TARGET testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-a job$i type1 $TARGET ric1 testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-b job$i type1 $TARGET ric1 testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-c job$i type1 $TARGET ric1 testdata/ecs/job-template.json fi if [ $(($i%5)) -eq 1 ]; then - prodstub_check_jobdata 200 prod-b job$i type2 $TARGET testdata/ecs/job-template.json - prodstub_check_jobdata 200 prod-c job$i type2 $TARGET testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-b job$i type2 $TARGET ric1 testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-c job$i type2 $TARGET ric1 testdata/ecs/job-template.json fi if [ $(($i%5)) -eq 2 ]; then - prodstub_check_jobdata 200 prod-c job$i type3 $TARGET testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-c job$i type3 $TARGET ric1 testdata/ecs/job-template.json fi if [ $(($i%5)) -eq 3 ]; then - prodstub_check_jobdata 200 prod-d job$i type4 $TARGET testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-d job$i type4 $TARGET ric1 testdata/ecs/job-template.json fi if [ $(($i%5)) -eq 4 ]; then - prodstub_check_jobdata 200 prod-d job$i type5 $TARGET testdata/ecs/job-template.json + prodstub_check_jobdata 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json fi done diff --git a/test/auto-test/PM_EI_DEMO.sh b/test/auto-test/PM_EI_DEMO.sh index bb33025c..2915b02c 100755 --- a/test/auto-test/PM_EI_DEMO.sh +++ b/test/auto-test/PM_EI_DEMO.sh @@ -183,7 +183,7 @@ else fi # Check the job data in the producer -prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json ## Create a second job for prod-a @@ -195,7 +195,7 @@ else fi # Check the job data in the producer -prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 testdata/ecs/job-template.json +prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json diff --git a/test/common/README.md b/test/common/README.md index a434ad87..21475c0e 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -1393,7 +1393,7 @@ To also test the response payload add the remaining parameters. | arg list | |--| -| ` (EMPTY | [ ]+)` | +| ` (EMPTY | [ ]+)` | | parameter | description | | --------- | ----------- | @@ -1402,6 +1402,7 @@ To also test the response payload add the remaining parameters. | `` | Id of the job | | `` | Id of the EI type | | `` | Target url for data delivery | +| `` | Id of the job owner | | `` | Path to a job template file | | `EMPTY` | The list of job/type/target/job-file tuples is empty | @@ -1489,7 +1490,7 @@ Check a job in the prodstub towards the list of provided parameters. | arg list | |--| -| ` ` | +| ` ` | | parameter | description | | --------- | ----------- | @@ -1498,6 +1499,7 @@ Check a job in the prodstub towards the list of provided parameters. | `` | Id of the job | | `` | Id of the type | | `` | Target url for data delivery | +| `` | Id of the job owner | | `` | Path to a job template file | ## Function: prodstub_delete_jobdata() ## diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh index 56c2a2e1..6c431734 100644 --- a/test/common/ecs_api_functions.sh +++ b/test/common/ecs_api_functions.sh @@ -806,12 +806,12 @@ ecs_api_edp_put_producer() { } # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs -# args: (EMPTY | [ ]+) +# args: (EMPTY | [ ]+) # (Function for test scripts) ecs_api_edp_get_producer_jobs() { __log_test_start $@ - #Valid number of parameter 2,3,6,10 + #Valid number of parameter 2,3,7,11 paramError=1 if [ $# -eq 2 ]; then paramError=0 @@ -820,11 +820,11 @@ ecs_api_edp_get_producer_jobs() { paramError=0 fi variablecount=$(($#-2)) - if [ $# -gt 3 ] && [ $(($variablecount%4)) -eq 0 ]; then + if [ $# -gt 3 ] && [ $(($variablecount%5)) -eq 0 ]; then paramError=0 fi if [ $paramError -eq 1 ]; then - __print_err " (EMPTY | [ ]+)" $@ + __print_err " (EMPTY | [ ]+)" $@ return 1 fi @@ -840,18 +840,18 @@ ecs_api_edp_get_producer_jobs() { targetJson="[" if [ $# -gt 3 ]; then arr=(${@:3}) - for ((i=0; i<$(($#-3)); i=i+4)); do + for ((i=0; i<$(($#-3)); i=i+5)); do if [ "$targetJson" != "[" ]; then targetJson=$targetJson"," fi - if [ -f ${arr[$i+3]} ]; then - jobfile=$(cat ${arr[$i+3]}) + if [ -f ${arr[$i+4]} ]; then + jobfile=$(cat ${arr[$i+4]}) jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g") else - _log_test_fail_general "Job template file "${arr[$i+3]}", does not exist" + _log_test_fail_general "Job template file "${arr[$i+4]}", does not exist" return 1 fi - targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"ei_job_data\":$jobfile}" + targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"ei_job_data\":$jobfile}" done fi targetJson=$targetJson"]" diff --git a/test/common/prodstub_api_functions.sh b/test/common/prodstub_api_functions.sh index f974df7b..a27f3b4b 100644 --- a/test/common/prodstub_api_functions.sh +++ b/test/common/prodstub_api_functions.sh @@ -155,22 +155,22 @@ prodstub_disarm_type() { } # Prodstub API: Get job data for a job and compare with a target job json -# +# # (Function for test scripts) prodstub_check_jobdata() { __log_test_start $@ - if [ $# -ne 6 ]; then - __print_err " " $@ + if [ $# -ne 7 ]; then + __print_err " " $@ return 1 fi - if [ -f $6 ]; then - jobfile=$(cat $6) + if [ -f $7 ]; then + jobfile=$(cat $7) jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g") else - _log_test_fail_general "Template file "$6" for jobdata, does not exist" + _log_test_fail_general "Template file "$7" for jobdata, does not exist" return 1 fi - targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"ei_job_data\":$jobfile}" + targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"owner\":\"$6\", \"ei_job_data\":$jobfile}" file="./tmp/.p.json" echo "$targetJson" > $file -- 2.16.6