From 9d8fafb7f03db136ded73eddcc717a87a4b1df27 Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Mon, 10 May 2021 11:11:49 +0200 Subject: [PATCH] Updated test of info-types Added tests of info-types Added test of info type persistency Issue-ID: NONRTRIC-497 Signed-off-by: BjornMagnussonXA Change-Id: I2407b0914f688f236753c5dd2f0b84c14ab1539c --- test/auto-test/FTC1100.sh | 650 +++++++++++++++++++++++++- test/auto-test/FTC1800.sh | 228 ++++++++- test/auto-test/testdata/ecs/info-type-1.json | 6 + test/auto-test/testdata/ecs/info-type-2.json | 6 + test/auto-test/testdata/ecs/info-type-3.json | 6 + test/auto-test/testdata/ecs/info-type-4.json | 6 + test/auto-test/testdata/ecs/info-type-5.json | 6 + test/auto-test/testdata/ecs/info-type-50.json | 6 + test/auto-test/testdata/ecs/info-type-6.json | 6 + test/auto-test/testdata/ecs/info-type-60.json | 6 + test/common/README.md | 115 +++++ test/common/agent_api_functions.sh | 4 +- test/common/ecs_api_functions.sh | 344 +++++++++++++- test/common/prodstub_api_functions.sh | 4 +- test/common/test_env-onap-honolulu.sh | 3 +- test/common/test_env-onap-istanbul.sh | 3 +- test/common/test_env-oran-cherry.sh | 1 + test/common/test_env-oran-d-release.sh | 3 +- 18 files changed, 1367 insertions(+), 36 deletions(-) create mode 100644 test/auto-test/testdata/ecs/info-type-1.json create mode 100644 test/auto-test/testdata/ecs/info-type-2.json create mode 100644 test/auto-test/testdata/ecs/info-type-3.json create mode 100644 test/auto-test/testdata/ecs/info-type-4.json create mode 100644 test/auto-test/testdata/ecs/info-type-5.json create mode 100644 test/auto-test/testdata/ecs/info-type-50.json create mode 100644 test/auto-test/testdata/ecs/info-type-6.json create mode 100644 test/auto-test/testdata/ecs/info-type-60.json diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh index 76f03d50..c5f23540 100755 --- a/test/auto-test/FTC1100.sh +++ b/test/auto-test/FTC1100.sh @@ -79,7 +79,7 @@ fi start_prod_stub -set_ecs_trace +set_ecs_debug start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE @@ -95,18 +95,38 @@ start_cr CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK" CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK" +#Targets for ei jobs TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery" TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery" TARGET3="$RIC_SIM_HTTPX://ricsim_g3_3:$RIC_SIM_PORT/datadelivery" TARGET8="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery" TARGET10="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery" +#Targets for info jobs +TARGET101="http://localhost:80/target" # Dummy target, no target for info data in this env... +TARGET102="http://localhost:80/target" # Dummy target, no target for info data in this env... +TARGET103="http://localhost:80/target" # Dummy target, no target for info data in this env... +TARGET108="http://localhost:80/target" # Dummy target, no target for info data in this env... +TARGET110="http://localhost:80/target" # Dummy target, no target for info data in this env... +TARGET150="http://localhost:80/target" # Dummy target, no target for info data in this env... +TARGET160="http://localhost:80/target" # Dummy target, no target for info data in this env... + +#Status callbacks for eijobs STATUS1="$CR_SERVICE_PATH/job1-status" STATUS2="$CR_SERVICE_PATH/job2-status" STATUS3="$CR_SERVICE_PATH/job3-status" STATUS8="$CR_SERVICE_PATH/job8-status" STATUS10="$CR_SERVICE_PATH/job10-status" +#Status callbacks for infojobs +INFOSTATUS101="$CR_SERVICE_PATH/info-job101-status" +INFOSTATUS102="$CR_SERVICE_PATH/info-job102-status" +INFOSTATUS103="$CR_SERVICE_PATH/info-job103-status" +INFOSTATUS108="$CR_SERVICE_PATH/info-job108-status" +INFOSTATUS110="$CR_SERVICE_PATH/info-job110-status" +INFOSTATUS150="$CR_SERVICE_PATH/info-job150-status" +INFOSTATUS160="$CR_SERVICE_PATH/info-job160-status" + ### Setup prodstub sim to accept calls for producers, types and jobs ## prod-a type1 ## prod-b type1 and type2 @@ -1029,6 +1049,632 @@ fi cr_equal received_callbacks 6 + +if [[ "$ECS_FEATURE_LEVEL" != *"INFO-TYPES"* ]]; then + + # End test if info types is not impl in tested version + check_ecs_logs + + store_logs END + + #### TEST COMPLETE #### + + print_result + + auto_clean_environment +fi + + +############################################ +# Test of info types +############################################ + +### Setup prodstub sim to accept calls for producers, info types and jobs +## prod-ia type101 +## prod-ib type101 and type102 +## prod-ic no-type +## prod-id type104 +## prod-ie type106 +## prod-if type106 +## prod-ig type150 (configured later) +## prod-ig type160 (configured later) + +## job101 -> prod-ia +## job102 -> prod-ia +## job103 -> prod-ib +## job104 -> prod-ia +## job106 -> prod-ib +## job108 -> prod-id +## job110 -> prod-ie and prod-if +## job150 -> prod-ig (configured later) + +prodstub_arm_producer 200 prod-ia +prodstub_arm_producer 200 prod-ib +prodstub_arm_producer 200 prod-ic +prodstub_arm_producer 200 prod-id +prodstub_arm_producer 200 prod-ie +prodstub_arm_producer 200 prod-if + +prodstub_arm_type 200 prod-ia type101 +prodstub_arm_type 200 prod-ib type102 +prodstub_arm_type 200 prod-ib type103 +prodstub_arm_type 200 prod-id type104 +prodstub_arm_type 200 prod-ie type106 +prodstub_arm_type 200 prod-if type106 + +prodstub_disarm_type 200 prod-ib type103 +prodstub_arm_type 200 prod-ib type101 +prodstub_disarm_type 200 prod-ib type101 + + +prodstub_arm_job_create 200 prod-ia job101 +prodstub_arm_job_create 200 prod-ia job102 +prodstub_arm_job_create 200 prod-ib job103 + +prodstub_arm_job_delete 200 prod-ia job101 +prodstub_arm_job_delete 200 prod-ia job102 +prodstub_arm_job_delete 200 prod-ib job103 + +prodstub_arm_job_create 200 prod-ib job104 +prodstub_arm_job_create 200 prod-ia job104 + +prodstub_arm_job_create 200 prod-ib job106 + +prodstub_arm_job_create 200 prod-id job108 + +prodstub_arm_job_create 200 prod-ie job110 +prodstub_arm_job_create 200 prod-if job110 + + +# NOTE: types, jobs and producers are still present related to eitypes + + +### Initial tests - no config made +### GET: type ids, types, producer ids, producers, job ids, jobs +### DELETE: jobs +ecs_api_idc_get_type_ids 200 type1 type2 type4 type6 +ecs_api_idc_get_type 404 test-type + +ecs_api_edp_get_type_ids 200 type1 type2 type4 type6 +ecs_api_edp_get_type_2 404 test-type + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e +ecs_api_edp_get_producer_2 404 test-prod +ecs_api_edp_get_producer_status 404 test-prod + +ecs_api_edp_delete_producer 404 test-prod + +ecs_api_idc_get_job_ids 200 test-type NOWNER EMPTY +ecs_api_idc_get_job_ids 200 test-type test-owner EMPTY + +ecs_api_idc_get_job 404 test-job + +ecs_api_idc_get_job_status 404 test-job + +ecs_api_idc_delete_job 404 test-job + +ecs_api_edp_get_producer_jobs_2 404 test-prod + +ecs_api_edp_get_type_2 404 test-type +ecs_api_edp_delete_type_2 404 test-type + +### Setup of producer/job and testing apis ### + +## Setup prod-ia +ecs_api_edp_get_type_ids 200 type1 type2 type4 type6 +ecs_api_edp_get_type_2 404 type101 +ecs_api_edp_put_producer_2 404 prod-ia $CB_JOB/prod-ia $CB_SV/prod-ia type101 + +# Create type, delete and create again +ecs_api_edp_put_type_2 201 type101 testdata/ecs/info-type-1.json +ecs_api_edp_get_type_2 200 type101 +ecs_api_edp_get_type_ids 200 type101 type1 type2 type4 type6 +ecs_api_edp_delete_type_2 204 type101 +ecs_api_edp_get_type_2 404 type101 +ecs_api_edp_get_type_ids 200 type1 type2 type4 type6 +ecs_api_edp_put_type_2 201 type101 testdata/ecs/info-type-1.json +ecs_api_edp_get_type_ids 200 type101 type1 type2 type4 type6 +ecs_api_edp_get_type_2 200 type101 testdata/ecs/info-type-1.json + +ecs_api_edp_put_producer_2 201 prod-ia $CB_JOB/prod-ia $CB_SV/prod-ia type101 +ecs_api_edp_put_producer_2 200 prod-ia $CB_JOB/prod-ia $CB_SV/prod-ia type101 + +ecs_api_edp_delete_type_2 406 type101 + + +#ecs_api_idc_get_type_ids 200 type101 +#ecs_api_idc_get_type 200 type101 testdata/ecs/empty-type.json + +ecs_api_edp_get_type_ids 200 type101 type1 type2 type4 type6 +ecs_api_edp_get_type_2 200 type101 testdata/ecs/info-type-1.json + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-b prod-c prod-d prod-e +ecs_api_edp_get_producer_ids_2 200 type101 prod-ia +ecs_api_edp_get_producer_ids_2 200 type102 EMPTY + +ecs_api_edp_get_producer_2 200 prod-ia $CB_JOB/prod-ia $CB_SV/prod-ia type101 + +ecs_api_edp_get_producer_status 200 prod-ia ENABLED + +ecs_api_idc_get_job_ids 200 type101 NOWNER EMPTY +ecs_api_idc_get_job_ids 200 type101 test-owner EMPTY + +ecs_api_idc_get_job 404 test-job + +ecs_api_idc_get_job_status 404 test-job +ecs_api_edp_get_producer_jobs_2 200 prod-ia EMPTY + +## Create a job for prod-ia +## job101 - prod-ia +ecs_api_idc_put_job 201 job101 type101 $TARGET101 info-owner-1 $INFOSTATUS101 testdata/ecs/job-template.json VALIDATE + +# Check the job data in the producer +prodstub_check_jobdata_2 200 prod-ia job101 type101 $TARGET101 info-owner-1 testdata/ecs/job-template.json + +ecs_api_idc_get_job_ids 200 type101 NOWNER job101 +ecs_api_idc_get_job_ids 200 type101 info-owner-1 job101 + +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job1 job2 job3 job8 job10 + +ecs_api_idc_get_job 200 job101 type101 $TARGET101 info-owner-1 $INFOSTATUS101 testdata/ecs/job-template.json + +ecs_api_idc_get_job_status 200 job101 ENABLED + +prodstub_equal create/prod-ia/job101 1 + +ecs_api_edp_get_producer_jobs_2 200 prod-ia job101 type101 $TARGET101 info-owner-1 testdata/ecs/job-template.json + +## Create a second job for prod-ia +## job102 - prod-ia +ecs_api_idc_put_job 201 job102 type101 $TARGET102 info-owner-2 $INFOSTATUS102 testdata/ecs/job-template.json VALIDATE + +# Check the job data in the producer +prodstub_check_jobdata_2 200 prod-ia job102 type101 $TARGET102 info-owner-2 testdata/ecs/job-template.json +ecs_api_idc_get_job_ids 200 type101 NOWNER job101 job102 +ecs_api_idc_get_job_ids 200 type101 info-owner-1 job101 +ecs_api_idc_get_job_ids 200 type101 info-owner-2 job102 +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job1 job2 job3 job8 job10 + +ecs_api_idc_get_job 200 job102 type101 $TARGET102 info-owner-2 $INFOSTATUS102 testdata/ecs/job-template.json + +ecs_api_idc_get_job_status 200 job102 ENABLED + +prodstub_equal create/prod-ia/job102 1 + +ecs_api_edp_get_producer_jobs_2 200 prod-ia job101 type101 $TARGET101 info-owner-1 testdata/ecs/job-template.json job102 type101 $TARGET102 info-owner-2 testdata/ecs/job-template.json + + +## Setup prod-ib +ecs_api_edp_put_type_2 201 type102 testdata/ecs/info-type-2.json +ecs_api_edp_put_producer_2 201 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102 + + +ecs_api_idc_get_type_ids 200 type101 type102 type1 type2 type4 type6 + +ecs_api_idc_get_type 200 type101 testdata/ecs/info-type-1.json + +ecs_api_idc_get_type 200 type102 testdata/ecs/info-type-2.json + +ecs_api_edp_get_type_ids 200 type101 type102 type1 type2 type4 type6 +ecs_api_edp_get_type_2 200 type101 testdata/ecs/info-type-1.json +ecs_api_edp_get_type_2 200 type102 testdata/ecs/info-type-2.json + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_2 200 prod-ia $CB_JOB/prod-ia $CB_SV/prod-ia type101 +ecs_api_edp_get_producer_2 200 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102 + +ecs_api_edp_get_producer_status 200 prod-ib ENABLED + +## Create job for prod-ib +## job103 - prod-ib +ecs_api_idc_put_job 201 job103 type102 $TARGET103 info-owner-3 $INFOSTATUS103 testdata/ecs/job-template.json VALIDATE + +prodstub_equal create/prod-ib/job103 1 + +# Check the job data in the producer +prodstub_check_jobdata_2 200 prod-ib job103 type102 $TARGET103 info-owner-3 testdata/ecs/job-template.json + +ecs_api_idc_get_job_ids 200 type101 NOWNER job101 job102 +ecs_api_idc_get_job_ids 200 type102 NOWNER job103 +ecs_api_idc_get_job_ids 200 type101 info-owner-1 job101 +ecs_api_idc_get_job_ids 200 type101 info-owner-2 job102 +ecs_api_idc_get_job_ids 200 type102 info-owner-3 job103 + +ecs_api_idc_get_job 200 job103 type102 $TARGET103 info-owner-3 $INFOSTATUS103 testdata/ecs/job-template.json + +ecs_api_idc_get_job_status 200 job103 ENABLED + +ecs_api_edp_get_producer_jobs_2 200 prod-ia job101 type101 $TARGET101 info-owner-1 testdata/ecs/job-template.json job102 type101 $TARGET102 info-owner-2 testdata/ecs/job-template.json +ecs_api_edp_get_producer_jobs_2 200 prod-ib job103 type102 $TARGET103 info-owner-3 testdata/ecs/job-template.json + +## Setup prod-ic (no types) +ecs_api_edp_put_producer_2 201 prod-ic $CB_JOB/prod-ic $CB_SV/prod-ic NOTYPE + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_2 200 prod-ia $CB_JOB/prod-ia $CB_SV/prod-ia type101 +ecs_api_edp_get_producer_2 200 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102 +ecs_api_edp_get_producer_2 200 prod-ic $CB_JOB/prod-ic $CB_SV/prod-ic EMPTY + +ecs_api_edp_get_producer_status 200 prod-ic ENABLED + + +## Delete job103 and prod-ib and re-create if different order + +# Delete job then producer +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job1 job2 job3 job8 job10 +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-b prod-c prod-d prod-e + +ecs_api_idc_delete_job 204 job103 + +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job1 job2 job3 job8 job10 +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-b prod-c prod-d prod-e + +ecs_api_edp_delete_producer 204 prod-ib + +ecs_api_edp_get_producer_status 404 prod-ib + +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job1 job2 job3 job8 job10 +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ic prod-b prod-c prod-d prod-e + +prodstub_equal delete/prod-ib/job103 1 + +ecs_api_idc_put_job 201 job103 type102 $TARGET103 info-owner-3 $INFOSTATUS103 testdata/ecs/job-template.json VALIDATE +ecs_api_idc_get_job_status 200 job103 DISABLED + +# Put producer then job +ecs_api_edp_put_producer_2 201 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102 + +ecs_api_edp_get_producer_status 200 prod-ib ENABLED + +ecs_api_idc_put_job 200 job103 type102 $TARGET103 info-owner-3 $INFOSTATUS103 testdata/ecs/job-template2.json VALIDATE +ecs_api_idc_get_job_status 200 job103 ENABLED + +prodstub_check_jobdata_2 200 prod-ib job103 type102 $TARGET103 info-owner-3 testdata/ecs/job-template2.json + +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job1 job2 job3 job8 job10 +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-b prod-c prod-d prod-e + +prodstub_equal create/prod-ib/job103 3 +prodstub_equal delete/prod-ib/job103 1 + +# Delete only the producer +ecs_api_edp_delete_producer 204 prod-ib + +ecs_api_edp_get_producer_status 404 prod-ib + +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job1 job2 job3 job8 job10 +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ic prod-b prod-c prod-d prod-e + +ecs_api_idc_get_job_status 200 job103 DISABLED + +cr_equal received_callbacks 7 30 +cr_equal received_callbacks?id=info-job103-status 1 +cr_api_check_all_ecs_events 200 info-job103-status DISABLED + +# Re-create the producer +ecs_api_edp_put_producer_2 201 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102 + +ecs_api_edp_get_producer_status 200 prod-ib ENABLED + +ecs_api_idc_get_job_status 200 job103 ENABLED + +cr_equal received_callbacks 8 30 +cr_equal received_callbacks?id=info-job103-status 2 +cr_api_check_all_ecs_events 200 info-job103-status ENABLED + +prodstub_check_jobdata_2 200 prod-ib job103 type102 $TARGET103 info-owner-3 testdata/ecs/job-template2.json + +## Setup prod-id +ecs_api_edp_put_type_2 201 type104 testdata/ecs/info-type-4.json +ecs_api_edp_put_producer_2 201 prod-id $CB_JOB/prod-id $CB_SV/prod-id type104 + +ecs_api_idc_get_job_ids 200 type104 NOWNER EMPTY + +ecs_api_idc_put_job 201 job108 type104 $TARGET108 info-owner-4 $INFOSTATUS108 testdata/ecs/job-template.json VALIDATE + +prodstub_check_jobdata_2 200 prod-id job108 type104 $TARGET108 info-owner-4 testdata/ecs/job-template.json + +prodstub_equal create/prod-id/job108 1 +prodstub_equal delete/prod-id/job108 0 + +ecs_api_idc_get_job_ids 200 type104 NOWNER job108 + +ecs_api_idc_get_job_status 200 job108 ENABLED + +# Re-PUT the producer with zero types +ecs_api_edp_put_producer_2 200 prod-id $CB_JOB/prod-id $CB_SV/prod-id NOTYPE + +ecs_api_idc_get_job_ids 200 type104 NOWNER job108 +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job108 job1 job2 job3 job8 job10 + +ecs_api_idc_get_job_status 200 job108 DISABLED + +cr_equal received_callbacks 9 30 +cr_equal received_callbacks?id=info-job108-status 1 +cr_api_check_all_ecs_events 200 info-job108-status DISABLED + +prodstub_equal create/prod-id/job108 1 +prodstub_equal delete/prod-id/job108 0 + +## Re-setup prod-id +ecs_api_edp_put_type_2 200 type104 testdata/ecs/info-type-4.json +ecs_api_edp_put_producer_2 200 prod-id $CB_JOB/prod-id $CB_SV/prod-id type104 + +ecs_api_idc_get_job_ids 200 type104 NOWNER job108 +ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job108 job1 job2 job3 job8 job10 + +ecs_api_idc_get_job_status 200 job108 ENABLED + +ecs_api_edp_get_producer_status 200 prod-ia ENABLED +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED + +cr_equal received_callbacks 10 30 +cr_equal received_callbacks?id=info-job108-status 2 +cr_api_check_all_ecs_events 200 info-job108-status ENABLED + +prodstub_equal create/prod-id/job108 2 +prodstub_equal delete/prod-id/job108 0 + + +## Setup prod-ie +ecs_api_edp_put_type_2 201 type106 testdata/ecs/info-type-6.json +ecs_api_edp_put_producer_2 201 prod-ie $CB_JOB/prod-ie $CB_SV/prod-ie type106 + +ecs_api_idc_get_job_ids 200 type106 NOWNER EMPTY + +ecs_api_idc_put_job 201 job110 type106 $TARGET110 info-owner-4 $INFOSTATUS110 testdata/ecs/job-template.json VALIDATE + +prodstub_check_jobdata_2 200 prod-ie job110 type106 $TARGET110 info-owner-4 testdata/ecs/job-template.json + +prodstub_equal create/prod-ie/job110 1 +prodstub_equal delete/prod-ie/job110 0 + +ecs_api_idc_get_job_ids 200 type106 NOWNER job110 + +ecs_api_idc_get_job_status 200 job110 ENABLED + +## Setup prod-if +ecs_api_edp_put_type_2 200 type106 testdata/ecs/info-type-6.json +ecs_api_edp_put_producer_2 201 prod-if $CB_JOB/prod-if $CB_SV/prod-if type106 + +ecs_api_idc_get_job_ids 200 type106 NOWNER job110 + +prodstub_check_jobdata_2 200 prod-if job110 type106 $TARGET110 info-owner-4 testdata/ecs/job-template.json + +prodstub_equal create/prod-if/job110 1 +prodstub_equal delete/prod-if/job110 0 + +ecs_api_idc_get_job_ids 200 type106 NOWNER job110 + +ecs_api_idc_get_job_status 200 job110 ENABLED + +## Status updates prod-ia and jobs + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-id prod-ie prod-if prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_status 200 prod-ia ENABLED +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED +ecs_api_edp_get_producer_status 200 prod-ie ENABLED +ecs_api_edp_get_producer_status 200 prod-if ENABLED + +# Arm producer prod-ia for supervision failure +prodstub_arm_producer 200 prod-ia 400 + +# Wait for producer prod-ia to go disabled +ecs_api_edp_get_producer_status 200 prod-ia DISABLED 360 + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-id prod-ie prod-if prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_status 200 prod-ia DISABLED +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED +ecs_api_edp_get_producer_status 200 prod-ie ENABLED +ecs_api_edp_get_producer_status 200 prod-if ENABLED + + +ecs_api_idc_get_job_status 200 job101 ENABLED +ecs_api_idc_get_job_status 200 job102 ENABLED +ecs_api_idc_get_job_status 200 job103 ENABLED +ecs_api_idc_get_job_status 200 job108 ENABLED +ecs_api_idc_get_job_status 200 job110 ENABLED + +# Arm producer prod-ia for supervision +prodstub_arm_producer 200 prod-ia 200 + +# Wait for producer prod-ia to go enabled +ecs_api_edp_get_producer_status 200 prod-ia ENABLED 360 + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-id prod-ie prod-if prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_status 200 prod-ia ENABLED +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED +ecs_api_edp_get_producer_status 200 prod-ie ENABLED +ecs_api_edp_get_producer_status 200 prod-if ENABLED + +ecs_api_idc_get_job_status 200 job101 ENABLED +ecs_api_idc_get_job_status 200 job102 ENABLED +ecs_api_idc_get_job_status 200 job103 ENABLED +ecs_api_idc_get_job_status 200 job108 ENABLED +ecs_api_idc_get_job_status 200 job110 ENABLED + +# Arm producer prod-ia for supervision failure +prodstub_arm_producer 200 prod-ia 400 + +# Wait for producer prod-ia to go disabled +ecs_api_edp_get_producer_status 200 prod-ia DISABLED 360 + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ib prod-ic prod-id prod-ie prod-if prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_status 200 prod-ia DISABLED +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED +ecs_api_edp_get_producer_status 200 prod-ie ENABLED +ecs_api_edp_get_producer_status 200 prod-if ENABLED + +ecs_api_idc_get_job_status 200 job101 ENABLED +ecs_api_idc_get_job_status 200 job102 ENABLED +ecs_api_idc_get_job_status 200 job103 ENABLED +ecs_api_idc_get_job_status 200 job108 ENABLED +ecs_api_idc_get_job_status 200 job110 ENABLED + +# Wait for producer prod-ia to be removed +ecs_equal json:ei-producer/v1/eiproducers 9 1000 + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ib prod-ic prod-id prod-ie prod-if prod-b prod-c prod-d prod-e + + +ecs_api_edp_get_producer_status 404 prod-ia +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED +ecs_api_edp_get_producer_status 200 prod-ie ENABLED +ecs_api_edp_get_producer_status 200 prod-if ENABLED + +ecs_api_idc_get_job_status 200 job101 DISABLED +ecs_api_idc_get_job_status 200 job102 DISABLED +ecs_api_idc_get_job_status 200 job103 ENABLED +ecs_api_idc_get_job_status 200 job108 ENABLED +ecs_api_idc_get_job_status 200 job110 ENABLED + +cr_equal received_callbacks 12 30 +cr_equal received_callbacks?id=info-job101-status 1 +cr_equal received_callbacks?id=info-job102-status 1 + +cr_api_check_all_ecs_events 200 info-job101-status DISABLED +cr_api_check_all_ecs_events 200 info-job102-status DISABLED + + +# Arm producer prod-ie for supervision failure +prodstub_arm_producer 200 prod-ie 400 + +ecs_api_edp_get_producer_status 200 prod-ie DISABLED 1000 + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ib prod-ic prod-id prod-ie prod-if prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_status 404 prod-ia +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED +ecs_api_edp_get_producer_status 200 prod-ie DISABLED +ecs_api_edp_get_producer_status 200 prod-if ENABLED + +ecs_api_idc_get_job_status 200 job101 DISABLED +ecs_api_idc_get_job_status 200 job102 DISABLED +ecs_api_idc_get_job_status 200 job103 ENABLED +ecs_api_idc_get_job_status 200 job108 ENABLED +ecs_api_idc_get_job_status 200 job110 ENABLED + +#Disable create for job110 in prod-ie +prodstub_arm_job_create 200 prod-ie job110 400 + +#Update tjob 10 - only prod-if will be updated +ecs_api_idc_put_job 200 job110 type106 $TARGET110 info-owner-4 $INFOSTATUS110 testdata/ecs/job-template2.json VALIDATE +#Reset producer and job responses +prodstub_arm_producer 200 prod-ie 200 +prodstub_arm_job_create 200 prod-ie job110 200 + +ecs_api_edp_get_producer_status 200 prod-ie ENABLED 360 + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ib prod-ic prod-id prod-ie prod-if prod-b prod-c prod-d prod-e + +#Wait for job to be updated +sleep_wait 120 + +prodstub_check_jobdata_2 200 prod-if job110 type106 $TARGET110 info-owner-4 testdata/ecs/job-template2.json + +prodstub_arm_producer 200 prod-if 400 + +ecs_api_edp_get_producer_status 200 prod-if DISABLED 360 + +ecs_equal json:ei-producer/v1/eiproducers 8 1000 + +ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ib prod-ic prod-id prod-ie prod-b prod-c prod-d prod-e + +ecs_api_edp_get_producer_status 404 prod-ia +ecs_api_edp_get_producer_status 200 prod-ib ENABLED +ecs_api_edp_get_producer_status 200 prod-ic ENABLED +ecs_api_edp_get_producer_status 200 prod-id ENABLED +ecs_api_edp_get_producer_status 200 prod-ie ENABLED +ecs_api_edp_get_producer_status 404 prod-if + +ecs_api_idc_get_job_status 200 job101 DISABLED +ecs_api_idc_get_job_status 200 job102 DISABLED +ecs_api_idc_get_job_status 200 job103 ENABLED +ecs_api_idc_get_job_status 200 job108 ENABLED +ecs_api_idc_get_job_status 200 job110 ENABLED + +cr_equal received_callbacks 12 + +### Test of pre and post validation + +ecs_api_idc_get_type_ids 200 type1 type2 type4 type6 type101 type102 type104 type106 +ecs_api_idc_put_job 404 job150 type150 $TARGET150 info-owner-1 $INFOSTATUS150 testdata/ecs/job-template.json VALIDATE +ecs_api_idc_put_job 201 job160 type160 $TARGET160 info-owner-1 $INFOSTATUS160 testdata/ecs/job-template.json + +ecs_api_idc_get_job_status 404 job150 +ecs_api_idc_get_job_status 200 job160 DISABLED 60 + +prodstub_arm_producer 200 prod-ig +prodstub_arm_job_create 200 prod-ig job150 +prodstub_arm_job_create 200 prod-ig job160 + +ecs_api_edp_put_producer_2 201 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig NOTYPE +ecs_api_edp_get_producer_status 200 prod-ig ENABLED 360 + +ecs_api_edp_get_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig EMPTY + +ecs_api_idc_get_job_status 404 job150 +ecs_api_idc_get_job_status 200 job160 DISABLED 60 + +prodstub_arm_type 200 prod-ig type160 + +ecs_api_edp_put_type_2 201 type160 testdata/ecs/info-type-60.json +ecs_api_idc_get_type_ids 200 type1 type2 type4 type6 type101 type102 type104 type106 type160 + +ecs_api_edp_put_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig type160 +ecs_api_edp_get_producer_status 200 prod-ig ENABLED 360 +ecs_api_edp_get_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig type160 + +ecs_api_idc_put_job 404 job150 type150 $TARGET150 info-owner-1 $INFOSTATUS150 testdata/ecs/job-template.json VALIDATE + +ecs_api_idc_get_job_status 404 job150 +ecs_api_idc_get_job_status 200 job160 ENABLED 60 + +prodstub_check_jobdata_2 200 prod-ig job160 type160 $TARGET160 info-owner-1 testdata/ecs/job-template.json + +prodstub_equal create/prod-ig/job160 1 +prodstub_equal delete/prod-ig/job160 0 + +prodstub_arm_type 200 prod-ig type150 + +ecs_api_edp_put_type_2 201 type150 testdata/ecs/info-type-50.json +ecs_api_idc_get_type_ids 200 type1 type2 type4 type6 type101 type102 type104 type106 type160 type150 + +ecs_api_edp_put_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig type160 type150 +ecs_api_edp_get_producer_status 200 prod-ig ENABLED 360 + +ecs_api_edp_get_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig type160 type150 + +ecs_api_idc_get_job_status 404 job150 +ecs_api_idc_get_job_status 200 job160 ENABLED + +ecs_api_idc_put_job 201 job150 type150 $TARGET150 info-owner-1 $INFOSTATUS150 testdata/ecs/job-template.json VALIDATE + +ecs_api_idc_get_job_status 200 job150 ENABLED 60 +ecs_api_idc_get_job_status 200 job160 ENABLED + +cr_equal received_callbacks 12 + check_ecs_logs store_logs END @@ -1037,4 +1683,4 @@ store_logs END print_result -auto_clean_environment +auto_clean_environment \ No newline at end of file diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh index 01f01788..3b2b0da8 100755 --- a/test/auto-test/FTC1800.sh +++ b/test/auto-test/FTC1800.sh @@ -18,7 +18,7 @@ # -TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persistency" +TC_ONELINE_DESCR="ECS Create 10000 jobs (ei and info) restart, test job persistency" #App names to include in the test when running docker, space separated list DOCKER_INCLUDED_IMAGES="ECS PRODSTUB CR CP NGW" @@ -123,6 +123,48 @@ do fi done +if [ $use_info_jobs ]; then + prodstub_arm_producer 200 prod-a + prodstub_arm_producer 200 prod-b + prodstub_arm_producer 200 prod-c + prodstub_arm_producer 200 prod-d + + prodstub_arm_type 200 prod-a type101 + + prodstub_arm_type 200 prod-b type101 + prodstub_arm_type 200 prod-b type102 + + prodstub_arm_type 200 prod-c type101 + prodstub_arm_type 200 prod-c type102 + prodstub_arm_type 200 prod-c type103 + + prodstub_arm_type 200 prod-d type104 + prodstub_arm_type 200 prod-d type105 + + for ((i=1; i<=$NUM_JOBS; i++)) + do + if [ $(($i%5)) -eq 0 ]; then + prodstub_arm_job_create 200 prod-a job$(($i+$NUM_JOBS)) + prodstub_arm_job_create 200 prod-b job$(($i+$NUM_JOBS)) + prodstub_arm_job_create 200 prod-c job$(($i+$NUM_JOBS)) + fi + if [ $(($i%5)) -eq 1 ]; then + prodstub_arm_job_create 200 prod-b job$(($i+$NUM_JOBS)) + prodstub_arm_job_create 200 prod-c job$(($i+$NUM_JOBS)) + fi + if [ $(($i%5)) -eq 2 ]; then + prodstub_arm_job_create 200 prod-c job$(($i+$NUM_JOBS)) + fi + if [ $(($i%5)) -eq 3 ]; then + prodstub_arm_job_create 200 prod-d job$(($i+$NUM_JOBS)) + fi + if [ $(($i%5)) -eq 4 ]; then + prodstub_arm_job_create 200 prod-d job$(($i+$NUM_JOBS)) + fi + done +fi + + if [ $ECS_VERSION == "V1-1" ]; then ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json @@ -148,6 +190,22 @@ else ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3 ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5 + + if [ $use_info_jobs ]; then + ecs_api_edp_put_type_2 201 type101 testdata/ecs/info-type-1.json + ecs_api_edp_put_type_2 201 type102 testdata/ecs/info-type-2.json + ecs_api_edp_put_type_2 201 type103 testdata/ecs/info-type-3.json + ecs_api_edp_put_type_2 201 type104 testdata/ecs/info-type-4.json + ecs_api_edp_put_type_2 201 type105 testdata/ecs/info-type-5.json + + ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 type101 + + ecs_api_edp_put_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2 type101 type102 + + ecs_api_edp_put_producer_2 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3 type101 type102 type103 + + ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5 type104 type105 + fi fi ecs_equal json:ei-producer/v1/eiproducers 4 @@ -166,6 +224,10 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type101 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 1 ]; then ecs_api_a1_put_job 201 job$i type2 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json @@ -174,6 +236,10 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type102 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 2 ]; then ecs_api_a1_put_job 201 job$i type3 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json @@ -182,6 +248,10 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type103 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 3 ]; then ecs_api_a1_put_job 201 job$i type4 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json @@ -190,6 +260,10 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type104 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 4 ]; then ecs_api_a1_put_job 201 job$i type5 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json @@ -198,6 +272,10 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type105 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi done @@ -209,10 +287,17 @@ if [ -z "$FLAT_A1_EI" ]; then ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5)) else ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type2 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type3 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type4 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type5 $(($NUM_JOBS/5)) +fi +if [ $use_info_jobs ]; then + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type101 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type102 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type103 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type104 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type105 $(($NUM_JOBS/5)) fi stop_ecs @@ -227,19 +312,37 @@ do prodstub_delete_jobdata 204 prod-a job$i prodstub_delete_jobdata 204 prod-b job$i prodstub_delete_jobdata 204 prod-c job$i + if [ $use_info_jobs ]; then + prodstub_delete_jobdata 204 prod-a job$(($i+$NUM_JOBS)) + prodstub_delete_jobdata 204 prod-b job$(($i+$NUM_JOBS)) + prodstub_delete_jobdata 204 prod-c job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 1 ]; then prodstub_delete_jobdata 204 prod-b job$i prodstub_delete_jobdata 204 prod-c job$i + if [ $use_info_jobs ]; then + prodstub_delete_jobdata 204 prod-b job$(($i+$NUM_JOBS)) + prodstub_delete_jobdata 204 prod-c job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 2 ]; then prodstub_delete_jobdata 204 prod-c job$i + if [ $use_info_jobs ]; then + prodstub_delete_jobdata 204 prod-c job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 3 ]; then prodstub_delete_jobdata 204 prod-d job$i + if [ $use_info_jobs ]; then + prodstub_delete_jobdata 204 prod-d job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 4 ]; then prodstub_delete_jobdata 204 prod-d job$i + if [ $use_info_jobs ]; then + prodstub_delete_jobdata 204 prod-d job$(($i+$NUM_JOBS)) + fi fi done @@ -256,6 +359,9 @@ do else ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120 + fi fi if [ $(($i%5)) -eq 1 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -263,6 +369,9 @@ do else ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120 + fi fi if [ $(($i%5)) -eq 2 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -270,6 +379,9 @@ do else ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120 + fi fi if [ $(($i%5)) -eq 3 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -277,6 +389,9 @@ do else ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120 + fi fi if [ $(($i%5)) -eq 4 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -284,6 +399,9 @@ do else ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120 + fi fi done @@ -298,13 +416,23 @@ if [ $ECS_VERSION == "V1-1" ]; then ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json else - ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + if [ $use_info_jobs ]; then + ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 type101 - ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2 + ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2 type101 type102 - ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3 + ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3 type101 type102 type103 - ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5 + ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5 type104 type105 + else + ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + + ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2 + + ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3 + + ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5 + fi fi @@ -323,6 +451,9 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 1 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -330,6 +461,9 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 2 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -337,6 +471,9 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 3 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -344,6 +481,9 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi if [ $(($i%5)) -eq 4 ]; then if [ -z "$FLAT_A1_EI" ]; then @@ -351,6 +491,9 @@ do else ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi + if [ $use_info_jobs ]; then + ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120 + fi fi done @@ -363,10 +506,18 @@ if [ -z "$FLAT_A1_EI" ]; then ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5)) else ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type2 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type3 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type4 $(($NUM_JOBS/5)) + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type5 $(($NUM_JOBS/5)) +fi + +if [ $use_info_jobs ]; then + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type101 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type102 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type103 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type104 $(($NUM_JOBS/5)) + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type105 $(($NUM_JOBS/5)) fi for ((i=1; i<=$NUM_JOBS; i++)) @@ -381,6 +532,11 @@ do prodstub_check_jobdata_2 200 prod-b job$i type1 $TARGET ric1 testdata/ecs/job-template.json prodstub_check_jobdata_2 200 prod-c job$i type1 $TARGET ric1 testdata/ecs/job-template.json fi + if [ $use_info_jobs ]; then + prodstub_check_jobdata_2 200 prod-a job$(($i+$NUM_JOBS)) type101 $TARGET info-owner testdata/ecs/job-template.json + prodstub_check_jobdata_2 200 prod-b job$(($i+$NUM_JOBS)) type101 $TARGET info-owner testdata/ecs/job-template.json + prodstub_check_jobdata_2 200 prod-c job$(($i+$NUM_JOBS)) type101 $TARGET info-owner testdata/ecs/job-template.json + fi fi if [ $(($i%5)) -eq 1 ]; then @@ -391,6 +547,10 @@ do prodstub_check_jobdata_2 200 prod-b job$i type2 $TARGET ric1 testdata/ecs/job-template.json prodstub_check_jobdata_2 200 prod-c job$i type2 $TARGET ric1 testdata/ecs/job-template.json fi + if [ $use_info_jobs ]; then + prodstub_check_jobdata_2 200 prod-b job$(($i+$NUM_JOBS)) type102 $TARGET info-owner testdata/ecs/job-template.json + prodstub_check_jobdata_2 200 prod-c job$(($i+$NUM_JOBS)) type102 $TARGET info-owner testdata/ecs/job-template.json + fi fi if [ $(($i%5)) -eq 2 ]; then if [ $ECS_VERSION == "V1-1" ]; then @@ -398,6 +558,9 @@ do else prodstub_check_jobdata_2 200 prod-c job$i type3 $TARGET ric1 testdata/ecs/job-template.json fi + if [ $use_info_jobs ]; then + prodstub_check_jobdata_2 200 prod-c job$(($i+$NUM_JOBS)) type103 $TARGET info-owner testdata/ecs/job-template.json + fi fi if [ $(($i%5)) -eq 3 ]; then if [ $ECS_VERSION == "V1-1" ]; then @@ -405,6 +568,9 @@ do else prodstub_check_jobdata_2 200 prod-d job$i type4 $TARGET ric1 testdata/ecs/job-template.json fi + if [ $use_info_jobs ]; then + prodstub_check_jobdata_2 200 prod-d job$(($i+$NUM_JOBS)) type104 $TARGET info-owner testdata/ecs/job-template.json + fi fi if [ $(($i%5)) -eq 4 ]; then if [ $ECS_VERSION == "V1-1" ]; then @@ -412,6 +578,9 @@ do else prodstub_check_jobdata_2 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json fi + if [ $use_info_jobs ]; then + prodstub_check_jobdata_2 200 prod-d job$(($i+$NUM_JOBS)) type105 $TARGET info-owner testdata/ecs/job-template.json + fi fi done @@ -420,18 +589,33 @@ for ((i=1; i<=$NUM_JOBS; i++)) do if [ $(($i%5)) -eq 0 ]; then ecs_api_a1_delete_job 204 job$i + if [ $use_info_jobs ]; then + ecs_api_idc_delete_job 204 job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 1 ]; then ecs_api_a1_delete_job 204 job$i + if [ $use_info_jobs ]; then + ecs_api_idc_delete_job 204 job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 2 ]; then ecs_api_a1_delete_job 204 job$i + if [ $use_info_jobs ]; then + ecs_api_idc_delete_job 204 job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 3 ]; then ecs_api_a1_delete_job 204 job$i + if [ $use_info_jobs ]; then + ecs_api_idc_delete_job 204 job$(($i+$NUM_JOBS)) + fi fi if [ $(($i%5)) -eq 4 ]; then ecs_api_a1_delete_job 204 job$i + if [ $use_info_jobs ]; then + ecs_api_idc_delete_job 204 job$(($i+$NUM_JOBS)) + fi fi done @@ -450,10 +634,18 @@ if [ -z "$FLAT_A1_EI" ]; then ecs_equal json:A1-EI/v1/eitypes/type5/eijobs 0 else ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 - ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type2 0 + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type3 0 + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type4 0 + ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type5 0 +fi + +if [ $use_info_jobs ]; then + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type101 0 + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type102 0 + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type103 0 + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type104 0 + ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type105 0 fi check_ecs_logs @@ -465,4 +657,4 @@ store_logs END print_result -auto_clean_environment +auto_clean_environment \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-1.json b/test/auto-test/testdata/ecs/info-type-1.json new file mode 100644 index 00000000..14103dd2 --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-1.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType1_1.0.0", + "description": "Info-Type 1", + "type": "object" +} \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-2.json b/test/auto-test/testdata/ecs/info-type-2.json new file mode 100644 index 00000000..88a57f99 --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-2.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType2_1.0.0", + "description": "Info-Type 2", + "type": "object" +} \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-3.json b/test/auto-test/testdata/ecs/info-type-3.json new file mode 100644 index 00000000..a794266f --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-3.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType3_1.0.0", + "description": "Info-Type 3", + "type": "object" +} \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-4.json b/test/auto-test/testdata/ecs/info-type-4.json new file mode 100644 index 00000000..2ea9e0e5 --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-4.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType4_1.0.0", + "description": "Info-Type 4", + "type": "object" +} \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-5.json b/test/auto-test/testdata/ecs/info-type-5.json new file mode 100644 index 00000000..6b925601 --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-5.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType5_1.0.0", + "description": "Info-Type 5", + "type": "object" +} \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-50.json b/test/auto-test/testdata/ecs/info-type-50.json new file mode 100644 index 00000000..8f635b8c --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-50.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType50_1.0.0", + "description": "Info-Type 50", + "type": "object" +} \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-6.json b/test/auto-test/testdata/ecs/info-type-6.json new file mode 100644 index 00000000..7e13a32e --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-6.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType6_1.0.0", + "description": "Info-Type 6", + "type": "object" +} \ No newline at end of file diff --git a/test/auto-test/testdata/ecs/info-type-60.json b/test/auto-test/testdata/ecs/info-type-60.json new file mode 100644 index 00000000..50f3aff4 --- /dev/null +++ b/test/auto-test/testdata/ecs/info-type-60.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_InfoType60_1.0.0", + "description": "Info-Type 60", + "type": "object" +} \ No newline at end of file diff --git a/test/common/README.md b/test/common/README.md index dd64c429..bdb2f0dc 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -1308,6 +1308,121 @@ Test of GET '/status'. | --------- | ----------- | | `` | Expected http response code | +## Function: ecs_api_idc_get_type_ids() ## +Test of GET '/data-consumer/v1/info-types' and an optional check of the returned list of type ids. +To test the response code only, provide the response code. +To also test the response payload add list of expected type ids (or EMPTY if the list is expected to be empty). + +| arg list | +|--| +| ` [ EMPTY | +]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the Info type | +| `EMPTY` | The expected list of type ids shall be empty | + +## Function: ecs_api_idc_get_job_ids() ## +Test of GET '/data-consumer/v1/info-jobs' and optional check of the array of returned job ids. +To test the response code only, provide the response code parameter as well as a type id and an owner id. +To also test the response payload add the 'EMPTY' for an expected empty array or repeat the last parameter for each expected job id. + +| arg list | +|--| +| ` |NOOWNER [ EMPTY | + ]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the Info type | +| `` | Id of the job owner | +| `NOOWNER` | No owner is given | +| `` | Id of the expected job | +| `EMPTY` | The expected list of job id shall be empty | + +## Function: ecs_api_idc_get_job() ## +Test of GET '/data-consumer/v1/info-jobs/{infoJobId}' and optional check of the returned job. +To test the response code only, provide the response code, type id and job id. +To also test the response payload add the remaining parameters. + +| arg list | +|--| +| ` [ ]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the Info type | +| `` | Id of the job | +| `` | Expected target url for the job | +| `` | Expected owner for the job | +| `` | Path to a job template for job parameters of the job | + +## Function: ecs_api_idc_put_job() ## +Test of PUT '​/data-consumer/v1/info-jobs/{infoJobId}'. +To test, provide all the specified parameters. + +| arg list | +|--| +| ` [VALIDATE]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the Info type | +| `` | Id of the job | +| `` | Target url for the job | +| `` | Owner of the job | +| `` | Path to a job template for job parameters of the job | +| `VALIIDATE` | Indicator to preform type validation at creation | + +## Function: ecs_api_idc_delete_job() ## +Test of DELETE '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}'. +To test, provide all the specified parameters. + +| arg list | +|--| +| ` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the EI type | +| `` | Id of the job | + +## Function: ecs_api_idc_get_type() ## +Test of GET '/data-consumer/v1/info-types/{infoTypeId} and optional check of the returned schema. +To test the response code only, provide the response code parameter as well as the type-id. +To also test the response payload add a path to the expected schema file. + +| arg list | +|--| +| ` []` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the Info type | +| `` | Path to a schema file to compare with the returned schema | + +## Function: ecs_api_idc_get_job_status() ## +Test of GET '/data-consumer/v1/info-jobs/{infoJobId}/status' and optional check of the returned status. +To test the response code only, provide the response code, type id and job id. +To also test the response payload add the expected status. + +| arg list | +|--| +| ` []` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the Info type | +| `` | Id of the job | +| `` | Expected status | + + ## Function: ecs_api_admin_reset() ## Test of GET '/status'. diff --git a/test/common/agent_api_functions.sh b/test/common/agent_api_functions.sh index 82dde443..2a2f8a71 100644 --- a/test/common/agent_api_functions.sh +++ b/test/common/agent_api_functions.sh @@ -2124,7 +2124,7 @@ api_put_configuration() { return 1 fi if [ ! -f $2 ]; then - _log_test_fail_general "Config file "$2", does not exist" + __log_test_fail_general "Config file "$2", does not exist" return 1 fi inputJson=$(< $2) @@ -2160,7 +2160,7 @@ api_get_configuration() { return 1 fi if [ ! -f $2 ]; then - _log_test_fail_general "Config file "$2" for comparison, does not exist" + __log_test_fail_general "Config file "$2" for comparison, does not exist" return 1 fi diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh index cf5f580f..56167b60 100644 --- a/test/common/ecs_api_functions.sh +++ b/test/common/ecs_api_functions.sh @@ -806,7 +806,7 @@ ecs_api_a1_get_job() { jobfile=$(cat $6) jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g") else - _log_test_fail_general "Job template file "$6", does not exist" + __log_test_fail_general "Job template file "$6", does not exist" return 1 fi targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}" @@ -826,7 +826,7 @@ ecs_api_a1_get_job() { jobfile=$(cat $7) jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g") else - _log_test_fail_general "Job template file "$6", does not exist" + __log_test_fail_general "Job template file "$6", does not exist" return 1 fi targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}" @@ -894,7 +894,7 @@ ecs_api_a1_put_job() { jobfile=$(cat $6) jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g") else - _log_test_fail_general "Job template file "$6", does not exist" + __log_test_fail_general "Job template file "$6", does not exist" return 1 fi @@ -913,7 +913,7 @@ ecs_api_a1_put_job() { jobfile=$(cat $7) jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g") else - _log_test_fail_general "Job template file "$7", does not exist" + __log_test_fail_general "Job template file "$7", does not exist" return 1 fi @@ -1357,7 +1357,7 @@ ecs_api_edp_get_producer() { if [ -f ${arr[$i+1]} ]; then schema=$(cat ${arr[$i+1]}) else - _log_test_fail_general "Schema file "${arr[$i+1]}", does not exist" + __log_test_fail_general "Schema file "${arr[$i+1]}", does not exist" return 1 fi @@ -1494,7 +1494,7 @@ ecs_api_edp_put_producer() { if [ -f ${arr[$i+1]} ]; then schema=$(cat ${arr[$i+1]}) else - _log_test_fail_general "Schema file "${arr[$i+1]}", does not exist" + __log_test_fail_general "Schema file "${arr[$i+1]}", does not exist" return 1 fi inputJson=$inputJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}" @@ -1613,7 +1613,7 @@ ecs_api_edp_get_producer_jobs() { jobfile=$(cat ${arr[$i+4]}) jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g") else - _log_test_fail_general "Job template file "${arr[$i+4]}", 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]}\",\"owner\":\"${arr[$i+3]}\",\"ei_job_data\":$jobfile}" @@ -1677,7 +1677,7 @@ ecs_api_edp_get_producer_jobs_2() { jobfile=$(cat ${arr[$i+4]}) jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g") else - _log_test_fail_general "Job template file "${arr[$i+4]}", 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]}\",\"owner\":\"${arr[$i+3]}\",\"ei_job_data\":$jobfile, \"last_updated\":\"????\"}" @@ -1710,7 +1710,7 @@ ecs_api_service_status() { __log_test_start $@ if [ $# -lt 1 ]; then - __print_err " []*|NOID" $@ + __print_err "" $@ return 1 fi res="$(__do_curl_to_api ECS GET /status)" @@ -1723,6 +1723,332 @@ ecs_api_service_status() { return 0 } +########################################### +######### Info data consumer API ########## +########################################### +#Function prefix: ecs_api_idc + + +# API Test function: GET /data-consumer/v1/info-types +# args: [ (EMPTY | []+) ] +# (Function for test scripts) +ecs_api_idc_get_type_ids() { + __log_test_start $@ + + if [ $# -lt 1 ]; then + __print_err " [ (EMPTY | []+) ]" $@ + return 1 + fi + + query="/data-consumer/v1/info-types" + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + if [ $# -gt 1 ]; then + body=${res:0:${#res}-3} + targetJson="[" + if [ $2 != "EMPTY" ]; then + for pid in ${@:2} ; do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + targetJson=$targetJson"\"$pid\"" + done + fi + targetJson=$targetJson"]" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + +# API Test function: GET /data-consumer/v1/info-jobs +# args: |NOTYPE |NOOWNER [ EMPTY | + ] +# (Function for test scripts) +ecs_api_idc_get_job_ids() { + __log_test_start $@ + + # Valid number of parameters 4,5,6 etc + if [ $# -lt 3 ]; then + __print_err " |NOTYPE |NOOWNER [ EMPTY | + ]" $@ + return 1 + fi + search="" + if [ $3 != "NOWNER" ]; then + search="?owner="$3 + fi + + if [ $2 != "NOTYPE" ]; then + if [ -z "$search" ]; then + search="?infoTypeId="$2 + else + search=$search"&infoTypeId="$2 + fi + fi + query="/data-consumer/v1/info-jobs$search" + + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -gt 3 ]; then + body=${res:0:${#res}-3} + targetJson="[" + + for pid in ${@:4} ; do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + if [ $pid != "EMPTY" ]; then + targetJson=$targetJson"\"$pid\"" + fi + done + + targetJson=$targetJson"]" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + +# API Test function: GET /data-consumer/v1/info-jobs/{infoJobId} +# args: [ ] +# (Function for test scripts) +ecs_api_idc_get_job() { + __log_test_start $@ + + if [ $# -ne 2 ] && [ $# -ne 7 ]; then + __print_err " [ ]" $@ + return 1 + fi + query="/data-consumer/v1/info-jobs/$2" + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -eq 7 ]; then + body=${res:0:${#res}-3} + + if [ -f $7 ]; then + jobfile=$(cat $7) + jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g") + else + __log_test_fail_general "Job template file "$6", does not exist" + return 1 + fi + targetJson="{\"infoTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + + +# API Test function: PUT ​/data-consumer/v1/info-jobs/{infoJobId} +# args: [ VALIDATE ] +# (Function for test scripts) +ecs_api_idc_put_job() { + __log_test_start $@ + + if [ $# -lt 7 ] || [ $# -gt 8 ]; then + __print_err " [ VALIDATE ]" $@ + return 1 + fi + if [ -f $7 ]; then + jobfile=$(cat $7) + jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g") + else + __log_test_fail_general "Job template file "$7", does not exist" + return 1 + fi + + inputJson="{\"infoTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}" + file="./tmp/.p.json" + echo "$inputJson" > $file + + query="/data-consumer/v1/info-jobs/$2" + + if [ $# -eq 8 ]; then + if [ $8 == "VALIDATE" ]; then + query=$query"?typeCheck=true" + fi + fi + + res="$(__do_curl_to_api ECS PUT $query $file)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} + +# API Test function: DELETE ​/data-consumer/v1/info-jobs/{infoJobId} +# args: +# (Function for test scripts) +ecs_api_idc_delete_job() { + __log_test_start $@ + + if [ $# -ne 2 ]; then + __print_err " " $@ + return 1 + fi + query="/data-consumer/v1/info-jobs/$2" + res="$(__do_curl_to_api ECS DELETE $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} + +# API Test function: GET ​/data-consumer/v1/info-types/{infoTypeId} +# args: [] +# (Function for test scripts) +ecs_api_idc_get_type() { + __log_test_start $@ + + if [ $# -lt 2 ] || [ $# -gt 3 ]; then + __print_err " []" $@ + return 1 + fi + + query="/data-consumer/v1/info-types/$2" + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -eq 3 ]; then + body=${res:0:${#res}-3} + if [ -f $3 ]; then + schema=$(cat $3) + else + __log_test_fail_general "Schema file "$3", does not exist" + return 1 + fi + targetJson="{\"consumer_job_data_schema\":$schema}" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + +# API Test function: GET /data-consumer/v1/info-jobs/{infoJobId}/status +# args: [ []] +# (Function for test scripts) +ecs_api_idc_get_job_status() { + __log_test_start $@ + + if [ $# -lt 2 ] && [ $# -gt 4 ]; then + __print_err " [ []]" $@ + return 1 + fi + + query="/data-consumer/v1/info-jobs/$2/status" + + start=$SECONDS + for (( ; ; )); do + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $# -eq 4 ]; then + duration=$((SECONDS-start)) + echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}" + if [ $duration -gt $4 ]; then + echo "" + duration=-1 #Last iteration + fi + else + duration=-1 #single test, no wait + fi + + if [ $status -ne $1 ]; then + if [ $duration -eq -1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + fi + if [ $# -ge 3 ] && [ $status -eq $1 ]; then + body=${res:0:${#res}-3} + targetJson="{\"eiJobStatus\": \"$3\"}" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + if [ $duration -eq -1 ]; then + __log_test_fail_body + return 1 + fi + else + duration=-1 #Goto pass + fi + fi + if [ $duration -eq -1 ]; then + if [ $# -eq 4 ]; then + echo "" + fi + __log_test_pass + return 0 + else + sleep 1 + fi + done + + __log_test_pass + return 0 +} + ########################################## #### Reset jobs #### diff --git a/test/common/prodstub_api_functions.sh b/test/common/prodstub_api_functions.sh index 8aae95a2..6b7a3d88 100644 --- a/test/common/prodstub_api_functions.sh +++ b/test/common/prodstub_api_functions.sh @@ -418,7 +418,7 @@ prodstub_check_jobdata() { jobfile=$(cat $7) jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g") else - _log_test_fail_general "Template file "$7" 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\",\"owner\":\"$6\", \"ei_job_data\":$jobfile}" @@ -444,7 +444,7 @@ prodstub_check_jobdata_2() { jobfile=$(cat $7) jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g") else - _log_test_fail_general "Template file "$7" 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\",\"owner\":\"$6\", \"ei_job_data\":$jobfile,\"last_updated\":\"????\"}" diff --git a/test/common/test_env-onap-honolulu.sh b/test/common/test_env-onap-honolulu.sh index 84076628..07979123 100755 --- a/test/common/test_env-onap-honolulu.sh +++ b/test/common/test_env-onap-honolulu.sh @@ -89,7 +89,7 @@ SDNC_DB_IMAGE_TAG_REMOTE_PROXY="10.5" # ECS image and tag - uses cherry release ECS_IMAGE_BASE="o-ran-sc/nonrtric-enrichment-coordinator-service" ECS_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.0.1" - +#Note: Update var ECS_FEATURE_LEVEL if image version is changed # Control Panel image and tag - uses cherry release CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel" @@ -224,6 +224,7 @@ ECS_COMPOSE_DIR="ecs" # Dir in simulator_grou ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name ECS_VERSION="V1-2" # Version where the types are added in the producer registration +ECS_FEATURE_LEVEL="" # Space separated list of features MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub diff --git a/test/common/test_env-onap-istanbul.sh b/test/common/test_env-onap-istanbul.sh index ea7c3e06..4711dfbe 100644 --- a/test/common/test_env-onap-istanbul.sh +++ b/test/common/test_env-onap-istanbul.sh @@ -89,7 +89,7 @@ SDNC_DB_IMAGE_TAG_REMOTE_PROXY="10.5" # ECS image and tag - uses cherry release ECS_IMAGE_BASE="o-ran-sc/nonrtric-enrichment-coordinator-service" ECS_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.0.1" - +#Note: Update var ECS_FEATURE_LEVEL if image version is changed # Control Panel image and tag - uses cherry release CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel" @@ -224,6 +224,7 @@ ECS_COMPOSE_DIR="ecs" # Dir in simulator_grou ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name ECS_VERSION="V1-2" # Version where the types are added in the producer registration +ECS_FEATURE_LEVEL="" # Space separated list of features MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub diff --git a/test/common/test_env-oran-cherry.sh b/test/common/test_env-oran-cherry.sh index c82a5d32..91b153ab 100755 --- a/test/common/test_env-oran-cherry.sh +++ b/test/common/test_env-oran-cherry.sh @@ -227,6 +227,7 @@ ECS_COMPOSE_DIR="ecs" # Dir in simulator_grou ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name ECS_VERSION="V1-2" # Version where the types are added in the producer registration +ECS_FEATURE_LEVEL="" # Space separated list of features MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub diff --git a/test/common/test_env-oran-d-release.sh b/test/common/test_env-oran-d-release.sh index 08925a43..bc29ac94 100755 --- a/test/common/test_env-oran-d-release.sh +++ b/test/common/test_env-oran-d-release.sh @@ -71,7 +71,7 @@ ECS_IMAGE_TAG_LOCAL="1.1.0-SNAPSHOT" ECS_IMAGE_TAG_REMOTE_SNAPSHOT="1.1.0-SNAPSHOT" ECS_IMAGE_TAG_REMOTE="1.1.0" ECS_IMAGE_TAG_REMOTE_RELEASE="1.1.0" - +#Note: Update var ECS_FEATURE_LEVEL if image version is changed #Control Panel image and tags CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel" @@ -247,6 +247,7 @@ ECS_COMPOSE_DIR="ecs" # Dir in simulator_grou ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name ECS_VERSION="V1-2" # Version where the types are decoupled from the producer registration +ECS_FEATURE_LEVEL="INFO-TYPES" # Space separated list of features MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub -- 2.16.6