Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upload xline logs if validation failed #573

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ jobs:
cp ../xline-test-utils/{private,public}.pem .
docker build . -t ghcr.io/xline-kv/xline:latest
docker pull gcr.io/etcd-development/etcd:v3.5.5
bash ./validation_test.sh
bash ./validation_test.sh
- name: upload logs
if: failure()
uses: actions/upload-artifact@v1
with:
name: Xline logs
path: scripts/logs
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 22 additions & 11 deletions scripts/quick_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ run_container() {
size=${1}
image="ghcr.io/xline-kv/xline:latest"
for ((i = 1; i <= ${size}; i++)); do
docker run \
-e RUST_LOG=debug -e HOSTNAME=node${i} -e MEMBERS=${MEMBERS} -e INIT_LEADER=node1\
-e AUTH_PUBLIC_KEY=/mnt/public.pem -e AUTH_PRIVATE_KEY=/mnt/private.pem \
-d -it --rm --name=node${i} \
--net=xline_net --ip=${SERVERS[$i]} --cap-add=NET_ADMIN \
--cpu-shares=1024 -m=512M -v ${DIR}:/mnt ${image} &
command_str="docker run -e RUST_LOG=debug -e HOSTNAME=node${i} -e MEMBERS=${MEMBERS} -e INIT_LEADER=node1"
command_str="${command_str} -e AUTH_PUBLIC_KEY=/mnt/public.pem -e AUTH_PRIVATE_KEY=/mnt/private.pem"
if [ -n "$LOG_PATH" ]; then
command_str="${command_str} -e LOG_FILE=${LOG_PATH}/node${i}"
fi
command_str="${command_str} -d -it --rm --name=node${i}"
command_str="${command_str} --net=xline_net --ip=${SERVERS[$i]} --cap-add=NET_ADMIN"
command_str="${command_str} --cpu-shares=1024 -m=512M -v ${DIR}:/mnt ${image}"
eval ${command_str}
done
docker run -d -it --rm --name=client \
--net=xline_net --ip=${SERVERS[0]} --cap-add=NET_ADMIN \
Expand All @@ -41,8 +44,16 @@ run_container() {
echo container started
}

stop_all
docker network create --subnet=172.20.0.0/24 xline_net >/dev/null 2>&1
echo "A Docker network named 'xline_net' is created for communication among various xline nodes. You can use the command 'docker network rm xline_net' to remove it after use."

run_container 3
if [ -z "$1" ]; then
iGxnon marked this conversation as resolved.
Show resolved Hide resolved
stop_all
docker network create --subnet=172.20.0.0/24 xline_net >/dev/null 2>&1
echo "A Docker network named 'xline_net' is created for communication among various xline nodes. You can use the command 'docker network rm xline_net' to remove it after use."
run_container 3
exit 0
elif [ "$1" == "stop" ]; then
stop_all
exit 0
else
echo "Unexpected argument: $1"
exit 1
fi
7 changes: 7 additions & 0 deletions scripts/start_xline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@ if [ "$HOSTNAME" = "$INIT_LEADER" ]; then
cmd="${cmd} --is-leader"
fi

if [ -n "$LOG_FILE"]; then
cmd="${cmd} \
--log-file $LOG_FILE \
--log-level $RUST_LOG \
"
fi

RUST_LOG=$RUST_LOG ${cmd}
4 changes: 3 additions & 1 deletion scripts/validation_test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
DIR="$(dirname $0)"
QUICK_START="${DIR}/quick_start.sh"
bash ${QUICK_START}
LOG_PATH=/mnt/logs bash ${QUICK_START}
ETCDCTL="docker exec -i client etcdctl --endpoints=http://172.20.0.3:2379,http://172.20.0.4:2380"
LOCK_CLIENT="docker exec -i client /mnt/validation_lock_client --endpoints=http://172.20.0.3:2379"

Expand All @@ -21,6 +21,7 @@ run_with_expect() {
echo "command: ${cmd}"
echo "expect: ${expect}"
echo "result: ${res}"
bash ${QUICK_START} stop
exit 1
fi
}
Expand All @@ -40,6 +41,7 @@ run_with_match() {
echo "command: ${cmd}"
echo "expect: ${expect}"
echo "result: ${res}"
bash ${QUICK_START} stop
exit 1
fi
}
Expand Down
2 changes: 0 additions & 2 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ publish = false
bytes = { version = "1" }
clap = { version = "4", features = ["derive", "string"] }
clap_builder = { version = "4", default-features = false, features = ["color", "help", "std", "string", "suggestions", "usage"] }
crypto-common = { version = "0.1", default-features = false, features = ["std"] }
digest = { version = "0.10", features = ["mac", "std"] }
either = { version = "1" }
futures-channel = { version = "0.3", features = ["sink"] }
Expand All @@ -38,7 +37,6 @@ opentelemetry-jaeger = { version = "0.17", features = ["rt-tokio"] }
opentelemetry_sdk = { version = "0.18", features = ["metrics", "rt-tokio"] }
rand = { version = "0.8", features = ["small_rng"] }
serde = { version = "1", features = ["derive", "rc"] }
sha2 = { version = "0.10" }
time = { version = "0.3", features = ["formatting", "macros", "parsing"] }
tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync", "time"] }
tokio-util = { version = "0.7", features = ["codec", "io"] }
Expand Down
Loading