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

CLOUD-789-2 - converting variables in a function to local and changing TEMP_DIR to tmp_dir #1346

Merged
merged 8 commits into from
Oct 17, 2023
17 changes: 11 additions & 6 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,10 @@ function generate_vs_json() {
}

check_passwords_leak() {
local secrets
local passwords
local pods

secrets=$(kubectl_bin get secrets -o json | jq -r '.items[].data | to_entries | .[] | select(.key | (contains("_PASSWORD"))) | .value')
echo secrets=$secrets

Expand All @@ -1290,9 +1294,10 @@ check_passwords_leak() {
pods=$(kubectl_bin get pods -o name | awk -F "/" '{print $2}')
echo pods=$pods

TEMP_DIR=$(mktemp -d)

collect_logs() {
local containers
local count

NS=$1
for p in $pods; do
containers=$(kubectl_bin -n "$NS" get pod $p -o jsonpath='{.spec.containers[*].name}')
Expand All @@ -1301,12 +1306,12 @@ check_passwords_leak() {
if [[ ${c} =~ "pmm" ]]; then
continue
fi
kubectl_bin -n "$NS" logs $p -c $c >${TEMP_DIR}/logs_output-$p-$c.txt
echo logs saved in: ${TEMP_DIR}/logs_output-$p-$c.txt
kubectl_bin -n "$NS" logs $p -c $c >${tmp_dir}/logs_output-$p-$c.txt
echo logs saved in: ${tmp_dir}/logs_output-$p-$c.txt
for pass in $passwords; do
count=$(grep -c --fixed-strings -- "$pass" ${TEMP_DIR}/logs_output-$p-$c.txt || :)
count=$(grep -c --fixed-strings -- "$pass" ${tmp_dir}/logs_output-$p-$c.txt || :)
if [[ $count != 0 ]]; then
echo leaked passwords are found in log ${TEMP_DIR}/logs_output-$p-$c.txt
echo leaked passwords are found in log ${tmp_dir}/logs_output-$p-$c.txt
false
fi
done
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/init-deploy/compare/backup-50.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@
},
"actions": [
"appendOplogNote",
"checkFreeMonitoringStatus",
"connPoolStats",
"forceUUID",
"getDefaultRWConcern",
Expand Down
2 changes: 0 additions & 2 deletions e2e-tests/init-deploy/compare/clusterAdmin-50.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@
"appendOplogNote",
"applicationMessage",
"auditConfigure",
"checkFreeMonitoringStatus",
"cleanupOrphaned",
"connPoolStats",
"connPoolSync",
Expand Down Expand Up @@ -256,7 +255,6 @@
"serverStatus",
"setDefaultRWConcern",
"setFeatureCompatibilityVersion",
"setFreeMonitoring",
"setParameter",
"shardingState",
"shutdown",
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/init-deploy/compare/clusterMonitor-50.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@
"cluster": true
},
"actions": [
"checkFreeMonitoringStatus",
"connPoolStats",
"getDefaultRWConcern",
"getCmdLineOpts",
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/monitoring-2-0/run
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ else
retry 10 60 helm install monitoring --set imageTag=$IMAGE_PMM_SERVER_TAG --set imageRepo=$IMAGE_PMM_SERVER_REPO --set platform=$platform https://percona-charts.storage.googleapis.com/pmm-server-${PMM_SERVER_VER}.tgz
fi
sleep 20
SERVICE="postgres"
until kubectl_bin exec monitoring-0 -- bash -c "pgrep -x $SERVICE >/dev/null"; do
until kubectl_bin exec monitoring-0 -- bash -c "ls -l /proc/*/exe 2>/dev/null| grep postgres >/dev/null"; do
echo "Retry $retry"
sleep 5
let retry+=1
Expand Down
Loading