From 69311bf8082471be45574c9a99b23e31e606669c Mon Sep 17 00:00:00 2001 From: maximesson Date: Fri, 30 Aug 2019 14:05:15 +0000 Subject: Updated README files and adaptation of consul/cbs config Change-Id: I81494f56978a3d0ff06ec0d66968f33f08114103 Issue-ID: DCAEGEN2-1719 Signed-off-by: maximesson --- .../common/testcase_common.sh | 40 +++++++--------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'test/mocks/datafilecollector-testharness/common/testcase_common.sh') diff --git a/test/mocks/datafilecollector-testharness/common/testcase_common.sh b/test/mocks/datafilecollector-testharness/common/testcase_common.sh index deed26dfd..a1e092157 100755 --- a/test/mocks/datafilecollector-testharness/common/testcase_common.sh +++ b/test/mocks/datafilecollector-testharness/common/testcase_common.sh @@ -557,35 +557,28 @@ start_dfc() { fi } -# Configure consul with dfc config, args +# Configure consul with dfc config, args # Not intended to be called directly by test scripts. __consul_config() { - if [ $# != 3 ]; then - __print_err "need three args, " + if [ $# != 2 ]; then + __print_err "need two args, " exit 1 fi - if [ $2 -lt 0 ] || [ $2 -gt $DFC_MAX_IDX ]; then + if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then __print_err "dfc-instance-id should be 0.."$DFC_MAX_IDX exit 1 fi - if ! [ -f $3 ]; then - __print_err "json file does not extis: "$3 + if ! [ -f $2 ]; then + __print_err "json file does not extis: "$2 exit 1 fi - if [ $1 == "app" ]; then - appname=$DFC_APP_BASE$2 - elif [ $1 == "dmaap" ]; then - appname=$DFC_APP_BASE$2":dmaap" - else - __print_err "config type should be 'app' or 'dmaap'" - exit 1 - fi + appname=$DFC_APP_BASE$1 - echo "Configuring consul for " $appname " from " $3 - curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$3 >/dev/null + echo "Configuring consul for " $appname " from " $2 + curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$2 >/dev/null } # Configure consul with dfc app config, args @@ -593,20 +586,11 @@ consul_config_app() { if [ $START_ARG == "manual-app" ]; then echo "Replacing 'mrsim' with 'localhost' in json app config for consul" sed 's/mrsim/localhost/g' $2 > .tmp_app.json - __consul_config app $1 .tmp_app.json - else - __consul_config app $1 $2 - fi -} - -# Configure consul with dfc dmaap config, args -consul_config_dmaap() { - if [ $START_ARG == "manual-app" ]; then echo "Replacing 'drsim' with 'localhost' in json dmaap config for consul" - sed 's/drsim/localhost/g' $2 > .tmp_dmaap.json - __consul_config dmaap $1 .tmp_dmaap.json + sed 's/drsim/localhost/g' .tmp_app.json > .app.json + __consul_config $1 .app.json else - __consul_config dmaap $1 $2 + __consul_config $1 $2 fi } -- cgit 1.2.3-korg