Merge pull request #494 from thockin/master
Set repoReady even when there wasn't a 1st clone (v4 branch)
This commit is contained in:
commit
7768c58e93
|
|
@ -614,17 +614,20 @@ func main() {
|
||||||
cancel()
|
cancel()
|
||||||
time.Sleep(*flPeriod)
|
time.Sleep(*flPeriod)
|
||||||
continue
|
continue
|
||||||
} else if changed {
|
|
||||||
if webhookRunner != nil {
|
|
||||||
webhookRunner.Send(hash)
|
|
||||||
}
|
|
||||||
if exechookRunner != nil {
|
|
||||||
exechookRunner.Send(hash)
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSyncMetrics(metricKeySuccess, start)
|
|
||||||
} else {
|
} else {
|
||||||
updateSyncMetrics(metricKeyNoOp, start)
|
// this might have been called before, but also might not have
|
||||||
|
setRepoReady()
|
||||||
|
if changed {
|
||||||
|
if webhookRunner != nil {
|
||||||
|
webhookRunner.Send(hash)
|
||||||
|
}
|
||||||
|
if exechookRunner != nil {
|
||||||
|
exechookRunner.Send(hash)
|
||||||
|
}
|
||||||
|
updateSyncMetrics(metricKeySuccess, start)
|
||||||
|
} else {
|
||||||
|
updateSyncMetrics(metricKeyNoOp, start)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if initialSync {
|
if initialSync {
|
||||||
|
|
|
||||||
50
test_e2e.sh
50
test_e2e.sh
|
|
@ -1431,6 +1431,56 @@ function e2e::http() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##############################################
|
||||||
|
# Test http handler after restart
|
||||||
|
##############################################
|
||||||
|
function e2e::http_after_restart() {
|
||||||
|
BINDPORT=8888
|
||||||
|
|
||||||
|
echo "$FUNCNAME" > "$REPO"/file
|
||||||
|
git -C "$REPO" commit -qam "$FUNCNAME 1"
|
||||||
|
|
||||||
|
# Sync once to set up the repo
|
||||||
|
GIT_SYNC \
|
||||||
|
--one-time \
|
||||||
|
--repo="file://$REPO" \
|
||||||
|
--branch="$MAIN_BRANCH" \
|
||||||
|
--root="$ROOT" \
|
||||||
|
--link="link" \
|
||||||
|
>> "$1" 2>&1
|
||||||
|
assert_link_exists "$ROOT"/link
|
||||||
|
assert_file_exists "$ROOT"/link/file
|
||||||
|
assert_file_eq "$ROOT"/link/file "$FUNCNAME"
|
||||||
|
|
||||||
|
# Sync again and prove readiness.
|
||||||
|
GIT_SYNC \
|
||||||
|
--repo="file://$REPO" \
|
||||||
|
--branch="$MAIN_BRANCH" \
|
||||||
|
--root="$ROOT" \
|
||||||
|
--http-bind=":$BINDPORT" \
|
||||||
|
--link="link" \
|
||||||
|
>> "$1" 2>&1 &
|
||||||
|
# do nothing, just wait for the HTTP to come up
|
||||||
|
for i in $(seq 1 5); do
|
||||||
|
sleep 1
|
||||||
|
if curl --silent --output /dev/null http://localhost:$BINDPORT; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [[ "$i" == 5 ]]; then
|
||||||
|
fail "HTTP server failed to start"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
# check that health endpoint is alive
|
||||||
|
if [[ $(curl --write-out %{http_code} --silent --output /dev/null http://localhost:$BINDPORT) -ne 200 ]] ; then
|
||||||
|
fail "health endpoint failed"
|
||||||
|
fi
|
||||||
|
assert_link_exists "$ROOT"/link
|
||||||
|
assert_file_exists "$ROOT"/link/file
|
||||||
|
assert_file_eq "$ROOT"/link/file "$FUNCNAME"
|
||||||
|
}
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
# Test submodule sync
|
# Test submodule sync
|
||||||
##############################################
|
##############################################
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue