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

test(scorecard): scorecard test to verify Grafana data #900

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ function cleanup { \
set +e; \
$(OPERATOR_SDK) cleanup -n $(SCORECARD_NAMESPACE) $(OPERATOR_NAME); \
$(KUSTOMIZE) build internal/images/custom-scorecard-tests/rbac/ | $(CLUSTER_CLIENT) delete --ignore-not-found=$(ignore-not-found) -f -; \
$(CLUSTER_CLIENT) delete --ignore-not-found=$(ignore-not-found) -n $(SCORECARD_NAMESPACE) secret registry-key; \
$(CLUSTER_CLIENT) delete --ignore-not-found=$(ignore-not-found) namespace $(SCORECARD_NAMESPACE); \
)\
}
Expand All @@ -244,7 +243,10 @@ endef
define scorecard-local
for test in $${SCORECARD_TEST_SELECTION//,/ }; do \
echo "Running scorecard test \"$${test}\""; \
SCORECARD_NAMESPACE=$(SCORECARD_NAMESPACE) BUNDLE_DIR=./bundle go run internal/images/custom-scorecard-tests/main.go $${test} | sed 's/\\n/\n/g'; \
SCORECARD_NAMESPACE=$(SCORECARD_NAMESPACE) \
BUNDLE_DIR=./bundle \
TESTDATA_DIR=./internal/test/scorecard/testdata \
go run internal/images/custom-scorecard-tests/main.go $${test} | sed 's/\\n/\n/g'; \
done
endef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ metadata:
capabilities: Seamless Upgrades
categories: Monitoring, Developer Tools
containerImage: quay.io/cryostat/cryostat-operator:4.0.0-dev
createdAt: "2024-09-11T17:33:08Z"
createdAt: "2024-09-12T23:20:42Z"
description: JVM monitoring and profiling tool
operatorframework.io/initialization-resource: |-
{
Expand Down
22 changes: 16 additions & 6 deletions bundle/tests/scorecard/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- operator-install
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617
labels:
suite: cryostat
test: operator-install
Expand All @@ -80,7 +80,7 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-cr
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617
labels:
suite: cryostat
test: cryostat-cr
Expand All @@ -90,7 +90,7 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-multi-namespace
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617
labels:
suite: cryostat
test: cryostat-multi-namespace
Expand All @@ -100,7 +100,7 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617
labels:
suite: cryostat
test: cryostat-recording
Expand All @@ -110,7 +110,7 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-config-change
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617
labels:
suite: cryostat
test: cryostat-config-change
Expand All @@ -120,13 +120,23 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-report
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617
labels:
suite: cryostat
test: cryostat-report
storage:
spec:
mountPath: {}
- entrypoint:
- cryostat-scorecard-tests
- cryostat-grafana
image: quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617
labels:
suite: cryostat
test: cryostat-grafana
storage:
spec:
mountPath: {}
storage:
spec:
mountPath: {}
22 changes: 16 additions & 6 deletions config/scorecard/patches/custom.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
entrypoint:
- cryostat-scorecard-tests
- operator-install
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313"
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617"
labels:
suite: cryostat
test: operator-install
Expand All @@ -18,7 +18,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-cr
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313"
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617"
labels:
suite: cryostat
test: cryostat-cr
Expand All @@ -28,7 +28,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-multi-namespace
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313"
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617"
labels:
suite: cryostat
test: cryostat-multi-namespace
Expand All @@ -38,7 +38,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313"
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617"
labels:
suite: cryostat
test: cryostat-recording
Expand All @@ -48,7 +48,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-config-change
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313"
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617"
labels:
suite: cryostat
test: cryostat-config-change
Expand All @@ -58,7 +58,17 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-report
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240911172313"
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617"
labels:
suite: cryostat
test: cryostat-report
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-grafana
image: "quay.io/cryostat/cryostat-operator-scorecard:4.0.0-20240912231617"
labels:
suite: cryostat
test: cryostat-grafana
10 changes: 10 additions & 0 deletions hack/custom.config.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@
labels:
suite: cryostat
test: cryostat-report
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-grafana
image: "${CUSTOM_SCORECARD_IMG}"
labels:
suite: cryostat
test: cryostat-grafana
4 changes: 4 additions & 0 deletions internal/images/custom-scorecard-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func printValidTests() []scapiv1alpha3.TestResult {
tests.CryostatRecordingTestName,
tests.CryostatConfigChangeTestName,
tests.CryostatReportTestName,
tests.CryostatGrafanaTestName,
}, ","))
result.Errors = append(result.Errors, str)

Expand All @@ -105,6 +106,7 @@ func validateTests(testNames []string) bool {
case tests.CryostatRecordingTestName:
case tests.CryostatConfigChangeTestName:
case tests.CryostatReportTestName:
case tests.CryostatGrafanaTestName:
default:
return false
}
Expand All @@ -131,6 +133,8 @@ func runTests(testNames []string, bundle *apimanifests.Bundle, namespace string,
results = append(results, *tests.CryostatConfigChangeTest(bundle, namespace, openShiftCertManager))
case tests.CryostatReportTestName:
results = append(results, *tests.CryostatReportTest(bundle, namespace, openShiftCertManager))
case tests.CryostatGrafanaTestName:
results = append(results, *tests.CryostatGrafanaTest(bundle, namespace, openShiftCertManager))
default:
log.Fatalf("unknown test found: %s", testName)
}
Expand Down
Loading
Loading