aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests
diff options
context:
space:
mode:
authorMandeep Khinda <Mandeep.Khinda@amdocs.com>2017-06-24 11:49:37 -0400
committerMandeep Khinda <Mandeep.Khinda@amdocs.com>2017-06-24 11:49:37 -0400
commitd6ea987caed84a9f36030a5a1516df7c6186362d (patch)
tree265dda9cfb43a78542e4b2ccac382a8a5583bc56 /kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests
parent43d96ac929c93d0aa2a55d860e0425a39118f7b4 (diff)
onap on kubernetes source files
Change-Id: I4de34baf90979651223a28323010deb7aef21946 Signed-off-by: Mandeep Khinda <Mandeep.Khinda@amdocs.com>
Diffstat (limited to 'kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests')
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.2.json1
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.5.json1
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.1.txt1
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.3.json1
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/key.req1
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/1.1.out5
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.1.out8
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.2.out13
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.3.out6
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.4.out13
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.5.out4
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.6.out1
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.1.out4
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.2.out1
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.3.out4
-rw-r--r--kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.4.out1
-rwxr-xr-xkubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/regress.sh113
-rwxr-xr-xkubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/test.sh50
18 files changed, 228 insertions, 0 deletions
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.2.json b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.2.json
new file mode 100644
index 0000000000..c1bcdfdaa9
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.2.json
@@ -0,0 +1 @@
+{ "topicName": "Topic-28592-2", "topicDescription": "topic for test 2.2", "partitionCount": "1", "replicationCount": "1", "transactionEnabled": "true" }
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.5.json b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.5.json
new file mode 100644
index 0000000000..75bade16fb
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.2.5.json
@@ -0,0 +1 @@
+{ "datestamp": "Thu Dec 15 19:50:28 UTC 2016", "appkey": "x100", "appval": "some value" }
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.1.txt b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.1.txt
new file mode 100644
index 0000000000..c6a738ab57
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.1.txt
@@ -0,0 +1 @@
+datestamp: Thu Dec 15 19:50:38 UTC 2016, key: 3.1, value: this is a test
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.3.json b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.3.json
new file mode 100644
index 0000000000..9866789873
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/data.3.3.json
@@ -0,0 +1 @@
+{ "datestamp": "Thu Dec 15 19:50:40 UTC 2016", "key": "3.3", "value": "this is a test" }
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/key.req b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/key.req
new file mode 100644
index 0000000000..a7e409288f
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/key.req
@@ -0,0 +1 @@
+{ "email": "no.email", "description": "request for direct response KEY" }
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/1.1.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/1.1.out
new file mode 100644
index 0000000000..a9488d8ae1
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/1.1.out
@@ -0,0 +1,5 @@
+{"topics": [
+ "msgrtr.apinode.metrics.dmaap",
+ "28537.3",
+ "Topic-28537-2"
+]} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.1.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.1.out
new file mode 100644
index 0000000000..ef4eada557
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.1.out
@@ -0,0 +1,8 @@
+{
+ "aux": {
+ "description": "request for direct response KEY",
+ "email": "no.email"
+ },
+ "secret": "5V6YSDm8R6v6TArrLLtJUx4L",
+ "key": "HnJm7b9Zr16hgpU5"
+} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.2.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.2.out
new file mode 100644
index 0000000000..d682023fe2
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.2.out
@@ -0,0 +1,13 @@
+{
+ "owner": "HnJm7b9Zr16hgpU5",
+ "readerAcl": {
+ "enabled": true,
+ "users": []
+ },
+ "name": "Topic-28592-2",
+ "description": "topic for test 2.2",
+ "writerAcl": {
+ "enabled": true,
+ "users": []
+ }
+} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.3.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.3.out
new file mode 100644
index 0000000000..d62034e4a2
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.3.out
@@ -0,0 +1,6 @@
+{"topics": [
+ "Topic-28592-2",
+ "msgrtr.apinode.metrics.dmaap",
+ "28537.3",
+ "Topic-28537-2"
+]} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.4.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.4.out
new file mode 100644
index 0000000000..d682023fe2
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.4.out
@@ -0,0 +1,13 @@
+{
+ "owner": "HnJm7b9Zr16hgpU5",
+ "readerAcl": {
+ "enabled": true,
+ "users": []
+ },
+ "name": "Topic-28592-2",
+ "description": "topic for test 2.2",
+ "writerAcl": {
+ "enabled": true,
+ "users": []
+ }
+} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.5.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.5.out
new file mode 100644
index 0000000000..670bf46cb5
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.5.out
@@ -0,0 +1,4 @@
+{
+ "serverTimeMs": 9,
+ "count": 1
+} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.6.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.6.out
new file mode 100644
index 0000000000..0637a088a0
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/2.6.out
@@ -0,0 +1 @@
+[] \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.1.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.1.out
new file mode 100644
index 0000000000..d2a9b4e820
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.1.out
@@ -0,0 +1,4 @@
+{
+ "serverTimeMs": 175,
+ "count": 1
+} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.2.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.2.out
new file mode 100644
index 0000000000..0637a088a0
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.2.out
@@ -0,0 +1 @@
+[] \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.3.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.3.out
new file mode 100644
index 0000000000..b823f1cd2e
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.3.out
@@ -0,0 +1,4 @@
+{
+ "serverTimeMs": 2,
+ "count": 1
+} \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.4.out b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.4.out
new file mode 100644
index 0000000000..9930076939
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/out/3.4.out
@@ -0,0 +1 @@
+["{\"datestamp\":\"Thu Dec 15 19:50:40 UTC 2016\",\"value\":\"this is a test\",\"key\":\"3.3\"}"] \ No newline at end of file
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/regress.sh b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/regress.sh
new file mode 100755
index 0000000000..758dd7cad5
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/regress.sh
@@ -0,0 +1,113 @@
+#!/bin/ksh
+#
+# depends on jq - https://stedolan.github.io/jq/
+
+PROTOCOL=http
+FQDN=127.0.0.1
+#vm1-message-router
+#FQDN=10.208.128.229
+PORT=3904
+URL=$PROTOCOL://$FQDN:$PORT
+
+rm -f out/*
+mkdir -p out
+
+results() {
+# echo "[debug] compare $1 to $2"
+ if [ $1 == $2 ]
+ then
+ echo -n "SUCCESS "
+ else
+ echo -n "FAIL ($1) "
+ fi
+ echo " :TEST $3 ($4)"
+}
+SUITE=0
+SUITE=$((SUITE + 1))
+echo "SUITE $SUITE: List topics"
+TN=0
+TN=$((TN + 1))
+TC=$SUITE.$TN
+expect=200
+rc=`curl -s -w "%{http_code}" -o out/$TC.out $URL/topics`
+results $rc $expect $TC "list"
+StartTopicCount=`cat out/$TC.out | wc -l`
+
+
+SUITE=$((SUITE + 1))
+echo
+echo "SUITE $SUITE: APIKEY authenticated topic"
+TOPIC=Topic-$$-$SUITE
+TN=0
+TN=$((TN + 1))
+TC=$SUITE.$TN
+OUT=out/$TC.out
+echo '{ "email": "no.email", "description": "request for direct response KEY" }' > key.req
+rc=`curl -s -w "%{http_code}" -o out/$TC.out -X POST -H "Content-Type: application/json" -d @key.req $URL/apiKeys/create`
+results $rc $expect $SUITE.$TN "gen apikey "
+TN=$((TN + 1))
+TC=$SUITE.$TN
+SECRET=$(jq ".secret" $OUT | cut -f 2 -d \")
+KEY=$(jq ".key" $OUT | cut -f 2 -d \")
+TIME=`date --iso-8601=seconds`
+SIG=$(echo -n "$TIME" | openssl sha1 -hmac $SECRET -binary | openssl base64)
+xAUTH=$KEY:$SIG
+#echo "[debug] $SECRET $KEY $TIME $SIG $xAUTH"
+DATA=data.$TC.json
+echo "{ \"topicName\": \"$TOPIC\", \"topicDescription\": \"topic for test $TC\", \"partitionCount\": \"1\", \"replicationCount\": \"1\", \"transactionEnabled\": \"true\" }" > $DATA
+rc=`curl -s -w "%{http_code}" -o out/$TC.out -X POST -H "Content-Type: application/json" -H "X-CambriaAuth: $xAUTH" -H "X-CambriaDate: $TIME" -d @$DATA $URL/topics/create`
+results $rc $expect $SUITE.$TN "create topic"
+TN=$((TN + 1))
+TC=$SUITE.$TN
+expect=200
+rc=`curl -s -w "%{http_code}" -o out/$TC.out $URL/topics`
+results $rc $expect $TC "list "
+TopicCnt=`cat out/$TC.out | wc -l`
+results $TopicCnt $((StartTopicCount + 1)) $TC "topic count"
+TN=$((TN + 1))
+TC=$SUITE.$TN
+expect=200
+rc=`curl -s -w "%{http_code}" -o out/$TC.out $URL/topics/$TOPIC`
+results $rc $expect $TC "list $TOPIC"
+TN=$((TN + 1))
+TC=$SUITE.$TN
+DATA=data.$TC.json
+echo "{ \"datestamp\": \"`date`\", \"appkey\": \"x100\", \"appval\": \"some value\" }" > $DATA
+rc=`curl -s -w "%{http_code}" -o out/$TC.out -X POST -H "Content-Type: application/json" -H "X-CambriaAuth: $xAUTH" -H "X-CambriaDate: $TIME" -d @$DATA $URL/events/$TOPIC`
+results $rc $expect $SUITE.$TN "pub APIKEY topic"
+TN=$((TN + 1))
+TC=$SUITE.$TN
+rc=`curl -s -w "%{http_code}" -o out/$TC.out -X GET -H "Content-Type: application/json" -H "X-CambriaAuth: $xAUTH" -H "X-CambriaDate: $TIME" $URL/events/$TOPIC/g0/u1`
+results $rc $expect $SUITE.$TN "sub APIKEY topic"
+
+
+SUITE=$((SUITE + 1))
+echo
+echo "SUITE $SUITE: anonymous topic"
+TOPIC=$$.$SUITE
+TN=0
+TN=$((TN + 1))
+TC=$SUITE.$TN
+DATA=data.$TC.txt
+echo "datestamp: `date`, key: $TC, value: this is a test " > $DATA
+expect=200
+rc=`curl -s -w "%{http_code}" -o out/$TC.out -X POST -H "Content-Type: text/plain" -d @$DATA $URL/events/$TOPIC`
+results $rc $expect $SUITE.$TN "pub text/plain"
+TN=$((TN + 1))
+TC=$SUITE.$TN
+expect=200
+rc=`curl -s -w "%{http_code}" -o out/$TC.out $URL/events/$TOPIC/group1/u$$?timeout=1000`
+results $rc $expect $SUITE.$TN "sub text/plain"
+TN=$((TN + 1))
+TC=$SUITE.$TN
+DATA=data.$TC.json
+echo "{ \"datestamp\": \"`date`\", \"key\": \"$TC\", \"value\": \"this is a test\" }" > $DATA
+expect=200
+rc=`curl -s -w "%{http_code}" -o out/$TC.out -X POST -H "Content-Type: application/json" -d @$DATA $URL/events/$TOPIC`
+results $rc $expect $SUITE.$TN "pub json"
+TN=$((TN + 1))
+TC=$SUITE.$TN
+expect=200
+rc=`curl -s -w "%{http_code}" -o out/$TC.out $URL/events/$TOPIC/group1/u$$?timeout=1000`
+results $rc $expect $SUITE.$TN "sub json"
+
diff --git a/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/test.sh b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/test.sh
new file mode 100755
index 0000000000..0e06d5a5cd
--- /dev/null
+++ b/kubernetes/config/docker/init/src/config/message-router/dcae-startup-vm-message-router/docker_files/tests/test.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+# lji: this is basically what Dom has in his regtest. re-do it in bash instead of ksh
+
+HOSTPORT="127.0.0.1:3904"
+ANONTOPIC="anon-topic-$RANDOM"
+APITOPIC="api-topic-$RANDOM"
+APIKEYFILE="/tmp/key"
+
+echo "blah" > /tmp/sample.txt
+
+if [ ! -e /usr/bin/jq ]; then
+ apt-get update && apt-get -y install jq
+fi
+
+
+# list topics
+curl http://${HOSTPORT}/topics
+
+# publish to an anonymous topic (first publish creats the topic)
+curl -H "Content-Type:text/plain" -X POST -d @/tmp/sample.txt http://${HOSTPORT}/events/$ANONTOPIC
+
+# subscribe to an anonymous topic
+curl -H "Content-Type:text/plain" -X GET http://${HOSTPORT}/events/$ANONTOPIC/group1/C1?timeout=5000 &
+curl -H "Content-Type:text/plain" -X POST -d @/tmp/sample.txt http://${HOSTPORT}/events/$ANONTOPIC
+
+
+
+
+# create api key
+echo '{"email":"no email","description":"API key and secret both in reponse"}' > /tmp/input.txt
+curl -s -o ${APIKEYFILE} -H "Content-Type:application/json" -X POST -d @/tmp/input.txt http://${HOSTPORT}/apiKeys/create
+UEBAPIKEYSECRET=`cat ${APIKEYFILE} |jq -r ".secret"`
+UEBAPIKEYKEY=`cat ${APIKEYFILE} |jq -r ".key"`
+
+# create an api key secured topic
+# pay attendtion to replication count
+echo '{"topicName":"'${APITOPIC}'","topicDescription":"This is an API key securedTopic","partitionCount":"1","replicationCount":"1","transactionEnabled":"true"}' > /tmp/topicname.txt
+time=`date --iso-8601=seconds`
+signature=$(echo -n "$time" | openssl sha1 -hmac $UEBAPIKEYSECRET -binary | openssl base64)
+xAuth=$UEBAPIKEYKEY:$signature
+xDate="$time"
+curl -i -H "Content-Type: application/json" -H "X-CambriaAuth:$xAuth" -H "X-CambriaDate:$xDate" -X POST -d @/tmp/topicname.txt http://${HOSTPORT}/topics/create
+
+# first subscribe and run it in bg. then publish.
+time=`date --iso-8601=seconds`
+signature=$(echo -n "$time" | openssl sha1 -hmac $UEBAPIKEYSECRET -binary | openssl base64)
+xAuth=$UEBAPIKEYKEY:$signature
+xDate="$time"
+curl -H "X-CambriaAuth:$xAuth" -H "X-CambriaDate:$xDate" -X GET http://${HOSTPORT}/events/${APITOPIC}/g0/u1 &
+curl -H "Content-Type:text/plain" -H "X-CambriaAuth:$xAuth" -H "X-CambriaDate:$xDate" -X POST -d @/tmp/sample.txt http://${HOSTPORT}/events/${APITOPIC}