Skip to content

Commit

Permalink
Test /metrics with basic-auth and mTLS
Browse files Browse the repository at this point in the history
  • Loading branch information
mostynb committed Aug 9, 2023
1 parent 61e993c commit aa29c18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .bazelci/basic-auth-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ echo 'topsecretusername:$apr1$Ke2kcK4W$EyueqiHyoqhwXcpiEGNyJ1' \
echo "Starting bazel-remote, allowing unauthenticated reads..."
./bazel-remote --dir "$tmpdir/cache" --max_size 1 --http_address "0.0.0.0:$HTTP_PORT" \
--htpasswd_file "$tmpdir/htpasswd" \
--enable_endpoint_metrics \
--allow_unauthenticated_reads > "$tmpdir/bazel-remote.log" 2>&1 &
server_pid=$!

Expand Down Expand Up @@ -57,6 +58,11 @@ then
exit 1
fi

# Check that metrics are working (requires authentication).
wget --inet4-only -d -O - \
--http-user "$USER" --http-password "$PASS" \
http://localhost:$HTTP_PORT/metrics

# Authenticated read.
wget --inet4-only -d -O - \
--http-user "$USER" --http-password "$PASS" \
Expand Down
8 changes: 8 additions & 0 deletions .bazelci/tls-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ echo "Starting bazel-remote, allowing unauthenticated reads..."
--tls_cert_file "$tmpdir/server.crt" \
--tls_key_file "$tmpdir/server.key" \
--tls_ca_file "$tmpdir/ca.crt" \
--enable_endpoint_metrics \
--allow_unauthenticated_reads > "$tmpdir/bazel-remote.log" 2>&1 &
server_pid=$!

Expand Down Expand Up @@ -114,6 +115,13 @@ then
exit 1
fi

# Check that metrics are working (requires authentication).
wget --inet4-only -d -O - --ca-certificate=$tmpdir/server.crt \
--certificate=$tmpdir/client.crt \
--private-key=$tmpdir/client.pem \
--timeout=2 \
"https://localhost:$HTTP_PORT/metrics"

# Authenticated read.
wget --inet4-only -d -O - --ca-certificate=$tmpdir/server.crt \
--certificate=$tmpdir/client.crt \
Expand Down

0 comments on commit aa29c18

Please sign in to comment.