config-global: don't remove init data; receive community pull (#1644)

This commit is contained in:
mmetc 2022-07-07 16:11:27 +02:00 committed by GitHub
parent 920f3d2a7d
commit 607b7d4b6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 4 deletions

View file

@ -59,7 +59,14 @@ repositories).
- `git submodule init; git submodule update`
- `daemonize (linux) or daemon (freebsd), bash, python3, openbsd-netcat`
- `yq` from https://github.com/mikefarah/yq
- `go install github.com/cloudflare/cfssl/cmd/cfssl@latest`
- `go install github.com/cloudflare/cfssl/cmd/cfssljson@latest`
- `go install github.com/mikefarah/yq/v4@latest`
- `base64`
- `curl`
- `jq`
- `nc`
- `python3`
## Running all tests

View file

@ -19,6 +19,12 @@ check_bats_core() {
fi
}
check_curl() {
if ! command -v curl >/dev/null; then
die "missing required program 'curl'"
fi
}
check_python3() {
if ! command -v python3 >/dev/null; then
die "missing required program 'python3'"
@ -97,6 +103,7 @@ check_gocovmerge() {
}
check_bats_core
check_curl
check_daemonizer
check_cfssl
check_cfssljson

View file

@ -57,8 +57,16 @@ make_init_data() {
[[ "${DB_BACKEND}" == "sqlite" ]] || ${CSCLI} machines add --auto
"${TEST_DIR}/instance-crowdsec" start
"${CSCLI}" lapi status
[[ -z "${PACKAGE_TESTING}" ]] && "${CSCLI}" decisions delete --all
"${CSCLI}" decisions delete --all
loop_max=15
for ((i = 0; i <= loop_max; i++)); do
sleep 2
[[ $("${CSCLI}" alerts list -o json) != "null" ]] && break
done
[[ $("${CSCLI}" alerts list -o json) != "null" ]] || die "could not get community data"
"${TEST_DIR}/instance-crowdsec" stop
mkdir -p "${LOCAL_INIT_DIR}"
@ -75,7 +83,6 @@ make_init_data() {
--file "${LOCAL_INIT_DIR}/init-config-data.tar" "${REL_CONFIG_DIR}" "${REL_DATA_DIR}"
./instance-db setup
remove_init_data
}
load_init_data() {