Skip to content

Commit b44322b

Browse files
committed
add timeout to script
1 parent 859c765 commit b44322b

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ init: ## Install linters
7171
cd tools && go generate -x -tags=tools
7272

7373
build: ## Compile using plain go build
74-
env CGO_ENABLED=1 go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/mongodb_exporter -tags gssapi
74+
CGO_ENABLED=1 go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/mongodb_exporter -tags gssapi
7575

7676
release: ## Build the binaries using goreleaser
7777
docker run --rm --privileged \

exporter/exporter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func TestGSSAPIAuth(t *testing.T) {
280280
"mongodb_up",
281281
}
282282
err = testutil.CollectAndCompare(gc, expected, filter...)
283-
assert.NoError(t, err, "mongodb_up metric should be 1")
283+
require.NoError(t, err, "mongodb_up metric should be 1")
284284

285285
res := r.Unregister(gc)
286286
assert.True(t, res)

test-setup/scripts/setup-krb5-mongo.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
username=${MONGO_INITDB_ROOT_USERNAME}
44
password=${MONGO_INITDB_ROOT_PASSWORD}
55

6-
echo "Waiting for startup.."
6+
echo "Waiting for startup..."
7+
max_attempts=20
8+
attempts=0
79
until mongosh --host 127.0.0.1:27017 -u ${username} -p ${password} --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' &>/dev/null; do
10+
if [ $attempts -eq $max_attempts ]; then
11+
echo "Failed to check MongoDB status after $max_attempts attempts"
12+
exit 1
13+
fi
814
printf '.'
915
sleep 1
16+
attempts=$((attempts+1))
1017
done
1118

1219
echo "Started.."

0 commit comments

Comments
 (0)