Skip to content

Commit

Permalink
Testing fixes joseph (#289)
Browse files Browse the repository at this point in the history
* Moved some files for clarity

* Looking for the reason why tests sometimes do not generate any output

* Renamed a file for consistency

* Divided the 'trial' test into 'trial_start' and 'trial_stop' tests

* fixed a concurrency issue with mqtt_test

* Finished trial start test

* Finished the trial stop test

* Test script now returns 0 always

* Fixed Makefile for single test case

* Removed generic test

* Finished the ASR test

* Finished the Minecraft Chat test

* Fixed makefile targets
  • Loading branch information
jastier authored Apr 23, 2022
1 parent 80e9028 commit fe54d6b
Show file tree
Hide file tree
Showing 31 changed files with 253 additions and 311 deletions.
42 changes: 20 additions & 22 deletions scripts/mqtt_agent_testing/Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
# test message bus telemetry

test:
make single_pass -s
make single_pass -s

single_pass:
# Test everything a few times to test moving across trial boundaries.
test: FORCE
make test_everything -s
make test_everything -s
make test_everything -s

# A complete tour of every subscribed topic tested
test_everything: FORCE
make test_asr -s
make test_chat -s
make test_trial -s
make test_trial_start -s
make test_trial_stop -s

test_asr: FORCE
cd asr; make test -s

test_chat: FORCE
cd chat; make test -s

test_trial: FORCE
cd trial; make test -s

test_trial_start: FORCE
cd trial_start; make test -s

# remove intermediate test result files
test_trial_stop: FORCE
cd trial_stop; make test -s

clean:
make clean_asr -s
make clean_chat -s
make clean_trial -s

clean_asr:
# remove intermediate test result files
clean: FORCE
cd asr; make clean -s

clean_chat:
cd chat; make clean -s
cd trial_start; make clean -s
cd trial_stop; make clean -s

clean_trial:
cd trial; make clean -s
show_received_files: FORCE
find -name "*received*.*";

# show intermediate files that would be cleaned
show_dirt:
find -name "*received*.*"

FORCE: ;
2 changes: 1 addition & 1 deletion scripts/mqtt_agent_testing/asr/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# test message bus telemetry

test: FORCE
./test_dialog_agent
./test_asr


# remove intermediate test result files
Expand Down
1 change: 0 additions & 1 deletion scripts/mqtt_agent_testing/asr/mqtt_test

This file was deleted.

48 changes: 48 additions & 0 deletions scripts/mqtt_agent_testing/asr/test_asr
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Author: Joseph Astier


# Publish an ASR message and inspect MQTT Dialog Agent message

# published to message bus
publication_metadata="Testathon_3_24_2022_asr.metadata"

# pretty-format JSON that should resemble what is read from the message bus
expected_json="dialog_agent_message_expected.json"

# compact JSON read from the Message Bus
received_metadata="dialog_agent_message_received.metadata"

# pretty-format JSON converted from received_metadata
received_json="dialog_agent_message_received.json"

echo ""
echo ""
echo "TESTING: ASR message"

# delete prior generated files
rm -f *received*.*

# subscribe to the Dialog Agent topic:
mosquitto_sub -t agent/dialog > $received_metadata &
mosquitto_pid="$!"

./elkless_replayer $publication_metadata > /dev/null

# Wait a few seconds for a response
sleep 2

# kill mosquitto
kill $mosquitto_pid

# pretty-print the last line of the temp file
tail -1 $received_metadata | jq > $received_json

echo ""

# Only the timestamps should differ
echo "Diffing expected and received files:"
diff $expected_json $received_json

exit 0
21 changes: 0 additions & 21 deletions scripts/mqtt_agent_testing/asr/test_dialog_agent

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/mqtt_agent_testing/chat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# test message bus telemetry

test: FORCE
./test_dialog_agent
./test_chat


# remove intermediate test result files
Expand Down
1 change: 0 additions & 1 deletion scripts/mqtt_agent_testing/chat/mqtt_test

This file was deleted.

48 changes: 48 additions & 0 deletions scripts/mqtt_agent_testing/chat/test_chat
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Author: Joseph Astier


# Publish a Minecraft Chat message and inspect MQTT Dialog Agent message

# published to message bus
publication_metadata="Testathon_3_24_2022_chat.metadata"

# pretty-format JSON that should resemble what is read from the message bus
expected_json="dialog_agent_message_expected.json"

# compact JSON read from the Message Bus
received_metadata="dialog_agent_message_received.metadata"

# pretty-format JSON converted from received_metadata
received_json="dialog_agent_message_received.json"

echo ""
echo ""
echo "TESTING: Minecraft Chat message"

# delete prior generated files
rm -f *received*.*

# subscribe to the Dialog Agent topic:
mosquitto_sub -t agent/dialog > $received_metadata &
mosquitto_pid="$!"

./elkless_replayer $publication_metadata > /dev/null

# Wait a few seconds for a response
sleep 2

# kill mosquitto
kill $mosquitto_pid

# pretty-print the last line of the temp file
tail -1 $received_metadata | jq > $received_json

echo ""

# Only the timestamps should differ
echo "Diffing expected and received files:"
diff $expected_json $received_json

exit 0
21 changes: 0 additions & 21 deletions scripts/mqtt_agent_testing/chat/test_dialog_agent

This file was deleted.

89 changes: 0 additions & 89 deletions scripts/mqtt_agent_testing/mqtt_test

This file was deleted.

5 changes: 5 additions & 0 deletions scripts/mqtt_agent_testing/testall
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# Author: Joseph Astier

make test -s
17 changes: 0 additions & 17 deletions scripts/mqtt_agent_testing/trial/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion scripts/mqtt_agent_testing/trial/mqtt_test

This file was deleted.

22 changes: 0 additions & 22 deletions scripts/mqtt_agent_testing/trial/test_heartbeat_trial_start

This file was deleted.

22 changes: 0 additions & 22 deletions scripts/mqtt_agent_testing/trial/test_heartbeat_trial_stop

This file was deleted.

Loading

0 comments on commit fe54d6b

Please sign in to comment.