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(qa): fixes with Nenad #841

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions qa/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set -eu

## Get TC parameters (Example: "delay 100ms 10ms")
if [ -z "${TC_PARAMS:-}" ]; then
TC_PARAMS="$( (grep "^tc_params=" /config/config/config.toml | cut -d= -f2 | tr -d \") || echo "")"
if [ -z "${TC_PARAMS:-}" ] && [ -f "/config/config.toml" ]; then
TC_PARAMS="$( (grep "^tc_params=" /config/config.toml | cut -d= -f2 | tr -d \") || echo "")"
fi

# Add delay using TC. Make sure the image is running with --privileged or --cap-add=NET_ADMIN.
Expand Down
18 changes: 12 additions & 6 deletions qa/terraform/templates/commands.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ export IS_CC="0"

# More global variables and aliases that can be derived from previously available data.
alias ssh-cc="ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null root@$${CANDC}"
alias ssh_cc="ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null root@$${CANDC}"
export PSSH_P="$${D_N}"
export PSSH_T=120
export PSSH_V="-v"

# ssh_cc runs commands on the CC server.
ssh_cc() {
ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null root@$${CANDC} "$@"
}

# Translate node ID numbers to IP addresses. 0 -> 1.2.3.4
get_ip() {
case "$1" in
Expand Down Expand Up @@ -136,7 +140,7 @@ setup_config() {
_change_config all
_create_hostname_links
else
ssh-cc "source /etc/profile.d/commands.sh && setup_config"
ssh_cc "source /etc/profile.d/commands.sh && setup_config"
fi
}

Expand All @@ -145,7 +149,7 @@ d_pull() {
}

d_run() {
PSSH_H="$(_parse_multiple_hosts "$@")" xssh docker run -d -p 27000:27000/udp -p 28000:28000/udp -p 9000:9000/tcp --name node --cap-add=NET_ADMIN --dns $CANDC --mount type=bind,source=/data,target=/data --mount type=bind,source=/config,target=/config -e RUST_LOG $CANDC/node --home /config start
PSSH_H="$(_parse_multiple_hosts "$@")" xssh docker run -d -p 27000:27000/udp -p 28000:28000/udp -p 9000:9000/tcp --name node --cap-add=NET_ADMIN --dns $CANDC --mount type=bind,source=/data,target=/data --mount type=bind,source=/config,target=/root/config -e RUST_LOG $CANDC/node --home /root start
}

d_log() {
Expand Down Expand Up @@ -192,7 +196,7 @@ get_prometheus_data() {
docker stop prometheus && tar -cvzf prometheus.tgz -C /var/lib/docker/volumes/docker_prometheus/_data .
docker start prometheus
else
ssh-cc "rm -f prometheus.tgz; docker stop prometheus && tar -cvzf prometheus.tgz -C /var/lib/docker/volumes/docker_prometheus/_data . ; docker start prometheus"
ssh_cc "rm -f prometheus.tgz; docker stop prometheus && tar -cvzf prometheus.tgz -C /var/lib/docker/volumes/docker_prometheus/_data . ; docker start prometheus"
scp -r "root@$CANDC:prometheus.tgz" .
fi
}
Expand All @@ -203,7 +207,7 @@ _reset_prometheus_db() {
rm -rf /var/lib/docker/volumes/docker_prometheus/_data/*
docker start prometheus
else
ssh-cc "docker stop prometheus && rm -rf /var/lib/docker/volumes/docker_prometheus/_data/*; docker start prometheus"
ssh_cc "docker stop prometheus && rm -rf /var/lib/docker/volumes/docker_prometheus/_data/*; docker start prometheus"
fi
}

Expand Down Expand Up @@ -233,7 +237,7 @@ _reset_elastic_db() {
rm -rf /var/lib/docker/volumes/docker-elk_elasticsearch/_data/*
docker start docker-elk-elasticsearch-1
else
ssh-cc "docker stop docker-elk-elasticsearch-1 && rm -rf /var/lib/docker/volumes/docker-elk_elasticsearch/_data/*; docker start docker-elk-elasticsearch-1"
ssh_cc "docker stop docker-elk-elasticsearch-1 && rm -rf /var/lib/docker/volumes/docker-elk_elasticsearch/_data/*; docker start docker-elk-elasticsearch-1"
fi
}

Expand All @@ -256,6 +260,8 @@ _is_cc() {
}

_keyscan_cc() {
mkdir -p "$HOME/.ssh"
touch "$HOME/.ssh/known_hosts"
ssh-keygen -R "$CANDC" > /dev/null
ssh-keyscan -t ed25519 "$CANDC" >> "$HOME/.ssh/known_hosts"
}
Expand Down
2 changes: 1 addition & 1 deletion qa/terraform/user-data/user-data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ runcmd:
# Fix journald not logging entries
- systemctl restart systemd-journald
# Set up config directory
- ln -s /data/${id} /config
- ln -s /data/${id}/config /config
# Set up NFS share, (Mounting will happen post-install)
- mkdir /data
- chown nobody:nogroup /data
Expand Down
Loading