@@ -14,8 +14,6 @@ TOKEN_DISPENSER_DIR="$DIR/../../token-dispenser";
14
14
TOKEN_DISPENSER_PID=Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
15
15
TOKEN_DISPENSER_SO=" $TOKEN_DISPENSER_DIR /target/deploy/token_dispenser.so"
16
16
17
- VALIDATOR_PID=
18
-
19
17
usage () {
20
18
cat << EOF
21
19
Usage: $0 -d[--dev]|-t[--test] -v[--verbose] --no-postgres -h[--help]
@@ -109,38 +107,21 @@ function populate() {
109
107
npm run populate;
110
108
}
111
109
110
+ function build_program() {
111
+ cd " $TOKEN_DISPENSER_DIR " ;
112
+ anchor run export ;
113
+ }
114
+
112
115
function run_integration_tests() {
113
116
cd " $DIR " ;
114
117
npm run test ;
115
118
}
116
119
117
-
118
- function start_test_validator() {
119
- cd " $TOKEN_DISPENSER_DIR " ;
120
- anchor run export ;
121
- solana-test-validator -r \
122
- --bpf-program " $TOKEN_DISPENSER_PID " " $TOKEN_DISPENSER_SO " \
123
- --quiet \
124
- &
125
- VALIDATOR_PID=$!
126
- sleep 5
127
- }
128
-
129
120
function start_anchor_localnet() {
130
121
cd " $TOKEN_DISPENSER_DIR " ;
131
- anchor run export ;
132
122
anchor localnet;
133
123
}
134
124
135
-
136
- function stop_test_validator() {
137
- set +e
138
- [ -z $VALIDATOR_PID ] || (
139
- kill $VALIDATOR_PID
140
- )
141
- return 0
142
- }
143
-
144
125
function stop_anchor_localnet() {
145
126
solana_pid=$( pgrep -f ' [s]olana-test-validator' || true)
146
127
if [ -n " $solana_pid " ]; then
@@ -162,23 +143,23 @@ function cleanup() {
162
143
echo " shutting down solana-test-validator if running"
163
144
fi
164
145
stop_anchor_localnet;
165
- stop_test_validator;
166
-
167
146
}
168
147
169
148
function main() {
170
149
# run clean up in case of failures from previous run
171
150
cleanup;
172
151
# setup postgres docker
173
152
setup_postgres_docker;
153
+ # start solana-test-validator
154
+ build_program;
155
+ start_anchor_localnet &
156
+ sleep 5
174
157
if [ " $dev " -eq 1 ]; then
175
158
if [ " $verbose " -eq 1 ]; then
176
159
echo " dev mode"
177
- echo " populate db and deploy solana-test-validator using anchor localnet "
160
+ echo " populate db and deploy and initialize program "
178
161
fi
179
162
printf " \n\n**Running solana-test-validator until CTRL+C detected**\n\n"
180
- start_anchor_localnet &
181
- sleep 5
182
163
populate;
183
164
# wait for ctrl-c
184
165
( trap exit SIGINT ; read -r -d ' ' _ < /dev/tty )
@@ -187,8 +168,6 @@ function main() {
187
168
echo " test mode"
188
169
echo " running frontend tests"
189
170
fi
190
- start_test_validator
191
- sleep 5
192
171
run_integration_tests;
193
172
else
194
173
echo " no mode selected"
0 commit comments