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

[build] Test example configs during build #543

Merged
merged 4 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ jobs:
go test github.com/cloudprober/cloudprober/probes/ping -c
sudo PING_HOSTS_V4=${{ env.PING_HOSTS_V4 }} PING_HOSTS_V6=${{ env.PING_HOSTS_V6 }} ./ping.test -test.v -test.run ^TestRunProbeRealICMP$

- name: Example config tests
if: matrix.os == 'ubuntu-latest'
run: tools/test_config.sh

- name: Upload test and coverage reports
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion examples/additional_label/cloudprober.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ probe {
type: HTTP

targets {
k8s_targets {
k8s {
namespace: "prod"
ingresses: ".*"
labelSelector: "role=ingress-proxy"
Expand Down
14 changes: 14 additions & 0 deletions tools/test_config.sh
manugarg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail

# This script is used to test the example configurations found
# in the examples/ directory. If any examples fail to parse
# or are invalid, this script will fail by returning a non-zero
# exit code.
# It is used by the CI system to ensure that the examples are
# valid and up-to-date.

for example in examples/**/*.cfg; do
echo "Testing ${example}"
go run cmd/cloudprober.go -configtest -config_file "${example}"
done