From 937f020ece869af0bc4529322b59e32034ba2652 Mon Sep 17 00:00:00 2001 From: nateMJ Date: Mon, 3 Jun 2019 17:13:29 +0300 Subject: [PATCH 1/2] Check if all expected containers are started --- reporting/Tests/nifi-test.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 reporting/Tests/nifi-test.sh diff --git a/reporting/Tests/nifi-test.sh b/reporting/Tests/nifi-test.sh new file mode 100644 index 00000000..3e3caf5f --- /dev/null +++ b/reporting/Tests/nifi-test.sh @@ -0,0 +1,14 @@ +testContainersState() { + container_count=$(docker ps | wc -l) + running_status_containers=$(docker ps --filter status=running | wc -l) + running_containers_list=($(docker ps --filter status=running --format {{.Names}} | sort | tr '\n' ' ')) + expected_containers_list=(reporting_consul_1 reporting_db_1 reporting_kafka_1 reporting_log_1 reporting_nginx_1 reporting_nifi_1 reporting_superset_1 reporting_zookeeper_1) + + if [ ${container_count} "==" ${running_status_containers} ] && [ "${running_containers_list[*]}" "==" "${expected_containers_list[*]}" ]; + then + echo "All containers started successfully" + else + echo "The following containers are not started: \n" + echo ${A1[@]} ${B1[@]} |tr ' ' '\n' | sort | uniq -u + fi +} \ No newline at end of file From 69cfba15d20e8d6b4847ed9bb7703c6f269d3644 Mon Sep 17 00:00:00 2001 From: nateMJ Date: Tue, 4 Jun 2019 14:30:17 +0300 Subject: [PATCH 2/2] Check if all process groups have been loaded --- reporting/Tests/nifi-test.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/reporting/Tests/nifi-test.sh b/reporting/Tests/nifi-test.sh index 3e3caf5f..ff874e3a 100644 --- a/reporting/Tests/nifi-test.sh +++ b/reporting/Tests/nifi-test.sh @@ -4,11 +4,31 @@ testContainersState() { running_containers_list=($(docker ps --filter status=running --format {{.Names}} | sort | tr '\n' ' ')) expected_containers_list=(reporting_consul_1 reporting_db_1 reporting_kafka_1 reporting_log_1 reporting_nginx_1 reporting_nifi_1 reporting_superset_1 reporting_zookeeper_1) - if [ ${container_count} "==" ${running_status_containers} ] && [ "${running_containers_list[*]}" "==" "${expected_containers_list[*]}" ]; + if [ ${container_count} == ${running_status_containers} ] && [ "${running_containers_list[*]}" == "${expected_containers_list[*]}" ]; then echo "All containers started successfully" else echo "The following containers are not started: \n" - echo ${A1[@]} ${B1[@]} |tr ' ' '\n' | sort | uniq -u + echo ${running_containers_list[@]} ${expected_containers_list[@]} |tr ' ' '\n' | sort | uniq -u + fi +} + +testTemplatesLoaded() { + processGroups=$(curl -u "admin:changeme" -s -X GET $NIFI_BASE_URL/nifi-api/process-groups/root/process-groups | jq -r ".[]") + loadedProcessGroups=() + for i in "${processGroups[@]}"; + do + loadedProcessGroups+=("$(echo $i | jq -r ".[].component.name")") + done + + expectedProcessGroups=(Generate MeasureReports Generate Measures Materialized Views Reference Data Connector Requsitions connector Superset Permissions) + sortedloadedProcessGroups=$(echo ${loadedProcessGroups[*]} | sort | tr '\n' ' ') + + if [ "${sortedloadedProcessGroups[*]}" == "${expectedProcessGroups[*]}" ]; + then + echo "All process groups have been loaded successfully" + else + echo "The following process groups are not loaded: \n" + echo ${sortedloadedProcessGroups[@]} ${expectedProcessGroups[@]} |tr ' ' '\n' | sort | uniq -u fi } \ No newline at end of file