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 tests for recording management #698

Merged
merged 39 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0e26739
test(scorecard): scorecard tests for recording management
tthvo Dec 9, 2023
5003566
fixup(scorecard): fix cr cleanup func
tthvo Dec 9, 2023
e9b932e
test(scorecard): registry recording test to suite
tthvo Dec 9, 2023
6cfefe1
chore(scorecard): reorganize client def
tthvo Dec 9, 2023
86e977f
chore(scorecard): clean up common setup func
tthvo Dec 9, 2023
543b614
chore(bundle): regenerate bundle with scorecard tag
tthvo Dec 11, 2023
59994ad
chore(bundle): correct image tag in bundle
tthvo Dec 11, 2023
5b38b8c
fix(bundle): add missing scorecard test config patch
tthvo Dec 11, 2023
f53e268
feat(scorecard): scaffold cryostat API client
tthvo Dec 12, 2023
09061f7
chore(scorecard): clean up API client
tthvo Dec 12, 2023
29268e2
test(scorecard): implement recording scorecard test
tthvo Dec 12, 2023
f794fbd
fixup(scorecard): correctly add scorecard test via hack templates
tthvo Dec 12, 2023
65cdb96
fix(client): ignore unverified tls certs and base64 oauth token
tthvo Dec 13, 2023
4cce99e
chore(bundle): split cryostat tests to separate stage
tthvo Dec 14, 2023
843fc07
fix(scorecard): extend default transport instead of overwriting
tthvo Dec 14, 2023
9d42c0b
chore(scorecard): refactor client to support multi-part
tthvo Dec 14, 2023
29f38d2
fixup(client): fix request verb
tthvo Dec 14, 2023
62c2899
fix(client): fix recording create form format
tthvo Dec 14, 2023
7a128e7
fix(scorecard): create stored credentials for target JVM
tthvo Dec 15, 2023
3fb6a35
fix(scorecard): fix 502 status error
tthvo Dec 15, 2023
1ba7781
chore(scorecard): simplify client def
tthvo Dec 16, 2023
2ee2ec4
chore(scorecard): fetch recordings to ensure action is correctly perf…
tthvo Dec 21, 2023
8a80ba7
test(scorecard): test generating report for a recording
tthvo Dec 22, 2023
ab116be
chore(scorecard): clean up
tthvo Dec 22, 2023
4e3c531
test(scorecard): list archives in tests
tthvo Dec 22, 2023
63e8824
ci(scorecard): reconfigure ingress for kind
tthvo Dec 22, 2023
d1e3f42
ci(k8s): correct cluster name
tthvo Dec 24, 2023
eddc69f
test(scorecard): use role instead of clusterrole for oauth rules
tthvo Dec 24, 2023
8b7c29f
test(scorecard): parse health response for additional checks
tthvo Jan 15, 2024
4a99137
chore(scorecard): add missing newline in logs
tthvo Jan 15, 2024
c2f4f53
chore(scorecard): check status code before parsing body in health check
tthvo Jan 31, 2024
b7cca98
test(scorecard): add custom target discovery to recording scorecard test
mwangggg Feb 29, 2024
097aa86
add EOF wait and resp headers
mwangggg Feb 29, 2024
a047f62
add resp headers
mwangggg Feb 29, 2024
170aabf
chore(client): configure all clients to send safe requests
tthvo Feb 29, 2024
f8f5c9c
fix(clients): add missing content-type header
tthvo Feb 29, 2024
71a5719
fix(scorecard): add missing test name in help message
tthvo Mar 5, 2024
fa5a676
chore(client): create new http requests when retrying
tthvo Mar 5, 2024
b81422d
chore(bundle): update scorecard image tags
tthvo Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/workflows/test-ci-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,29 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Kind cluster
uses: helm/kind-action@v1.8.0
with:
config: .github/kind-config.yaml
cluster_name: ci-${{ github.run_id }}
wait: 1m
ignore_failed_clean: true
- name: Set up Ingress Controller
run: |
kind create cluster --config=".github/kind-config.yaml" -n ci-${{ github.run_id }}
# Enabling Ingress
# Install nginx ingress controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
kubectl rollout status -w deployment/ingress-nginx-controller -n ingress-nginx --timeout 5m
kubectl rollout status -w \
deployment/ingress-nginx-controller \
-n ingress-nginx --timeout 5m

# Lower the number of worker processes
kubectl patch cm/ingress-nginx-controller \
--type merge \
-p '{"data":{"worker-processes":"1"}}' \
-n ingress-nginx

# Modify /etc/hosts to resolve hostnames
ip_address=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ci-${{ github.run_id }}-control-plane)
echo "$ip_address testing.cryostat" | sudo tee -a /etc/hosts
- name: Install Operator Lifecycle Manager
run: curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.24.0/install.sh | bash -s v0.24.0
- name: Install Cert Manager
Expand All @@ -140,8 +158,6 @@ jobs:
SCORECARD_REGISTRY_PASSWORD="${{ secrets.GITHUB_TOKEN }}" \
BUNDLE_IMG="${{ steps.push-bundle-to-ghcr.outputs.registry-path }}" \
make test-scorecard
- name: Clean up Kind cluster
run: kind delete cluster -n ci-${{ github.run_id }}
- name: Set latest commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ metadata:
capabilities: Seamless Upgrades
categories: Monitoring, Developer Tools
containerImage: quay.io/cryostat/cryostat-operator:2.5.0-dev
createdAt: "2024-02-04T06:09:16Z"
createdAt: "2024-03-05T02:05:10Z"
description: JVM monitoring and profiling tool
operatorframework.io/initialization-resource: |-
{
Expand Down
15 changes: 13 additions & 2 deletions bundle/tests/scorecard/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ stages:
storage:
spec:
mountPath: {}
- tests:
- entrypoint:
- cryostat-scorecard-tests
- operator-install
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416
labels:
suite: cryostat
test: operator-install
Expand All @@ -79,13 +80,23 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-cr
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416
labels:
suite: cryostat
test: cryostat-cr
storage:
spec:
mountPath: {}
- entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416
labels:
suite: cryostat
test: cryostat-recording
storage:
spec:
mountPath: {}
storage:
spec:
mountPath: {}
1 change: 0 additions & 1 deletion config/rbac/oauth_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: oauth-client
rules:
- apiGroups:
Expand Down
4 changes: 3 additions & 1 deletion config/scorecard/bases/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ kind: Configuration
metadata:
name: config
stages:
- parallel: true
- parallel: true # Build-in Tests
tests: []
- parallel: false # Cryostat Custom Tests
tests: []
18 changes: 14 additions & 4 deletions config/scorecard/patches/custom.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,32 @@
path: /serviceaccount
value: cryostat-scorecard
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- operator-install
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416"
labels:
suite: cryostat
test: operator-install
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-cr
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416"
labels:
suite: cryostat
test: cryostat-cr
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416"
labels:
suite: cryostat
test: cryostat-recording
14 changes: 12 additions & 2 deletions hack/custom.config.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
path: /serviceaccount
value: cryostat-scorecard
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
Expand All @@ -12,7 +12,7 @@
suite: cryostat
test: operator-install
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
Expand All @@ -21,3 +21,13 @@
labels:
suite: cryostat
test: cryostat-cr
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: "${CUSTOM_SCORECARD_IMG}"
labels:
suite: cryostat
test: cryostat-recording
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 @@ -79,6 +79,7 @@ func printValidTests() []scapiv1alpha3.TestResult {
str := fmt.Sprintf("valid tests for this image include: %s", strings.Join([]string{
tests.OperatorInstallTestName,
tests.CryostatCRTestName,
tests.CryostatRecordingTestName,
}, ","))
result.Errors = append(result.Errors, str)

Expand All @@ -90,6 +91,7 @@ func validateTests(testNames []string) bool {
switch testName {
case tests.OperatorInstallTestName:
case tests.CryostatCRTestName:
case tests.CryostatRecordingTestName:
default:
return false
}
Expand All @@ -108,6 +110,8 @@ func runTests(testNames []string, bundle *apimanifests.Bundle, namespace string,
results = append(results, tests.OperatorInstallTest(bundle, namespace))
case tests.CryostatCRTestName:
results = append(results, tests.CryostatCRTest(bundle, namespace, openShiftCertManager))
case tests.CryostatRecordingTestName:
results = append(results, tests.CryostatRecordingTest(bundle, namespace, openShiftCertManager))
default:
log.Fatalf("unknown test found: %s", testName)
}
Expand Down
49 changes: 49 additions & 0 deletions internal/images/custom-scorecard-tests/rbac/scorecard_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,55 @@ rules:
- cryostats/status
verbs:
- get
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
# Permissions for default OAuth configurations
- apiGroups:
- operator.cryostat.io
resources:
- cryostats
verbs:
- create
- patch
- delete
- get
- apiGroups:
- ""
resources:
- pods
- pods/exec
- services
verbs:
- create
- patch
- delete
- get
- apiGroups:
- ""
resources:
- replicationcontrollers
- endpoints
verbs:
- get
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- get
- apiGroups:
- apps
resources:
- daemonsets
- replicasets
- statefulsets
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
Loading
Loading