Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
*: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
csuzhangxc committed Nov 19, 2019
1 parent 091e053 commit aa3d4e7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
5 changes: 1 addition & 4 deletions syncer/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,7 @@ func (s *testDBSuite) TestTimezone(c *C) {
continue
}

rowid, ok := ev.Rows[0][0].(int32)
if !ok { // events generated by other cases
continue
}
rowid := ev.Rows[0][0].(int32)
var ts sql.NullInt64
err2 := s.db.QueryRow(queryTs, rowid).Scan(&ts)
c.Assert(err2, IsNil)
Expand Down
27 changes: 27 additions & 0 deletions tests/_utils/check_http_alive
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# parameter 1: url, only GET method supported now
# parameter 2: text needs to be contained
# parameter 3: retry count, if check failed we will wait 1s before next retry, until retry time exceeds retry count

set -eu

url=$1
contain=$2
retry_count=$3

shift 3

counter=0
while [ $counter -lt $retry_count ]; do
got=$(curl -s $url | grep "$contain" | wc -l)
if [[ $got -gt 0 ]]; then
echo "HTTP $url is alive"
exit 0
fi
((counter+=1))
echo "wait for HTTP alive for $counter-th time"
sleep 1
done

echo "HTTP $url is not alive"
exit 1
4 changes: 3 additions & 1 deletion tests/http_apis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function run() {
task_data=`cat $WORK_DIR/task.yaml.bak`
rm $WORK_DIR/task.yaml.bak
echo $task_data
sleep 2 # wait for embed HTTP service avaible

check_http_alive 127.0.0.1:$MASTER_PORT/apis/${API_VERSION}/status/test-task "task test-task has no workers or not exist" 3

curl -X POST 127.0.0.1:$MASTER_PORT/apis/${API_VERSION}/tasks -d '{"task": "'"$task_data"'"}' > $WORK_DIR/start-task.log
check_log_contains $WORK_DIR/start-task.log "\"result\":true" 1

Expand Down

0 comments on commit aa3d4e7

Please sign in to comment.