-
Notifications
You must be signed in to change notification settings - Fork 2
/
nav-hinting-integration-test.sh
executable file
·118 lines (85 loc) · 3.77 KB
/
nav-hinting-integration-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
echo
echo "Usage: urhn-integration-test.sh"
echo "run from the harness/rest-server/examples or from the integration-test.sh"
echo "export HARNESS_CLIENT_USER_ID and HARNESS_CLIENT_USER_SECRET before running against"
echo "Harness with TLS and Auth"
echo
# several flags are passed in via export from the integration test, otherwise they are undefined
# so this script will execute the defaults
# point to the harness host, use https://... for SSL and set the credentials if using Auth
# export "HARNESS_CLIENT_USER_ID"=xyz
# export "HARNESS_CLIENT_USER_SECRET"=abc
host=localhost
engine=test_nh
test_queries=data/nh-queries-urls.json
user1_events=data/nh-pferrel-events-urls.json
user2_events=data/nh-joe-events-urls.json
user1_conversion=data/nh-pferrel-conversion-urls.json
user2_conversion=data/nh-joe-conversion-urls.json
sleep_seconds=2
cd example
# initialize these in case not running from integrated test script
skip_restarts=${skip_restarts:-false}
clean_test_artifacts=${clean_test_artifacts:-false}
echo
echo "----------------------------------------------------------------------------------------------------------------"
echo "NAVIGATION HINTING ENGINE"
ECHO "TESTING ONE, AND THEN 2 USERS JOURNEYS AND CONVERSIONS WITH QUERIES"
echo "----------------------------------------------------------------------------------------------------------------"
harness delete ${engine}
sleep $sleep_seconds
harness add data/${engine}.json
sleep $sleep_seconds
harness status
echo
echo "Sending navigation events for user pferrel"
echo
mvn exec:java -Dexec.mainClass="EventsClientExample" -Dexec.args="$host $engine $user1_events" -Dexec.cleanupDaemonThreads=false
echo
echo "Sending hinting queries, no conversions yet so no hints"
echo
mvn exec:java -Dexec.mainClass="QueriesClientExample" -Dexec.args="$host $engine $test_queries" -Dexec.cleanupDaemonThreads=false > nh-hinting-results.txt
echo
echo "Sending conversion for user pferrel"
echo
mvn exec:java -Dexec.mainClass="EventsClientExample" -Dexec.args="$host $engine $user1_conversion" -Dexec.cleanupDaemonThreads=false
echo
echo "Sending hinting queries, should have hints now."
echo
mvn exec:java -Dexec.mainClass="QueriesClientExample" -Dexec.args="$host $engine $test_queries" -Dexec.cleanupDaemonThreads=false >> nh-hinting-results.txt
echo
echo "Sending navigation events for user joe"
echo
mvn exec:java -Dexec.mainClass="EventsClientExample" -Dexec.args="$host $engine $user2_events" -Dexec.cleanupDaemonThreads=false
echo
echo "Sending conversion for user joe"
echo
mvn exec:java -Dexec.mainClass="EventsClientExample" -Dexec.args="$host $engine $user2_conversion" -Dexec.cleanupDaemonThreads=false
echo
echo
echo "Sending queries after 2 conversion"
echo
mvn exec:java -Dexec.mainClass="QueriesClientExample" -Dexec.args="$host $engine $test_queries" -Dexec.cleanupDaemonThreads=false >> nh-hinting-results.txt
echo
echo "----------------------------------------------------------------------------------------------------------------"
echo "TESTING NAV-HINTING MODEL PERSISTENCE BY RESTARTING HARNESS AND MAKING QUERIES"
echo "----------------------------------------------------------------------------------------------------------------"
echo
if [ "$skip_restarts" == false ]; then
harness stop
sleep 10
harness start -f
sleep 10
fi
echo
echo "Sending queries after 2 conversion"
echo
mvn exec:java -Dexec.mainClass="QueriesClientExample" -Dexec.args="$host $engine $test_queries" -Dexec.cleanupDaemonThreads=false >> nh-hinting-results.txt
echo "---------------------- profile query differences should only be timing ----------------------------"
diff nh-hinting-results.txt data/expected-nh-hinting-results-urls.txt | grep Results
echo
if [ "$clean_test_artifacts" == true ]; then
harness delete ${engine}
fi
cd ..