Skip to content

Commit

Permalink
reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Mar 8, 2024
1 parent 890f076 commit 09cd707
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 32 deletions.
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-03-06T00:07:00Z"
createdAt: "2024-03-07T15:43:22Z"
description: JVM monitoring and profiling tool
operatorframework.io/initialization-resource: |-
{
Expand Down
8 changes: 4 additions & 4 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:2.5.0-20240306000550
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307153901
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:2.5.0-20240306000550
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307153901
labels:
suite: cryostat
test: cryostat-cr
Expand All @@ -90,7 +90,7 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240306000550
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307153901
labels:
suite: cryostat
test: cryostat-recording
Expand All @@ -100,7 +100,7 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-config-change
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240306000550
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307153901
labels:
suite: cryostat
test: cryostat-config-change
Expand Down
8 changes: 4 additions & 4 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:2.5.0-20240306000550"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307154322"
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:2.5.0-20240306000550"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307154322"
labels:
suite: cryostat
test: cryostat-cr
Expand All @@ -28,7 +28,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240306000550"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307154322"
labels:
suite: cryostat
test: cryostat-recording
Expand All @@ -38,7 +38,7 @@
entrypoint:
- cryostat-scorecard-tests
- cryostat-config-change
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240306000550"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240307154322"
labels:
suite: cryostat
test: cryostat-config-change
2 changes: 1 addition & 1 deletion hack/custom.config.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
labels:
suite: cryostat
test: cryostat-recording
- op:add
- op: add
path: /stages/1/tests/-
value:
entrypoint:
Expand Down
19 changes: 1 addition & 18 deletions internal/test/scorecard/common_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func updateAndWaitTillCryostatAvailable(cr *operatorv1beta1.Cryostat, resources
return false, nil
}
if deploy.Status.Replicas > deploy.Status.UpdatedReplicas {
r.Log += fmt.Sprintf("Waiting for deployment %s rollout to finish: %d old replicas are pending termination.. \n", deploy.Name, deploy.Status.Replicas-deploy.Status.UpdatedReplicas)
r.Log += fmt.Sprintf("Waiting for deployment %s rollout to finish: %d old replicas are pending termination... \n", deploy.Name, deploy.Status.Replicas-deploy.Status.UpdatedReplicas)
return false, nil
}
if deploy.Status.AvailableReplicas < deploy.Status.UpdatedReplicas {
Expand All @@ -445,23 +445,6 @@ func updateAndWaitTillCryostatAvailable(cr *operatorv1beta1.Cryostat, resources
if err != nil {
return fmt.Errorf("failed to look up deployment errors: %s", err.Error())
}

err = wait.PollImmediateUntilWithContext(ctx, time.Second, func(ctx context.Context) (done bool, err error) {
cr, err = client.OperatorCRDs().Cryostats(cr.Namespace).Get(ctx, cr.Name)
if err != nil {
return false, fmt.Errorf("failed to get Cryostat CR: %s", err.Error())
}
if len(cr.Status.ApplicationURL) > 0 {
return true, nil
}
r.Log += "application URL is not yet available\n"
return false, nil
})
if err != nil {
return fmt.Errorf("application URL not found in CR: %s", err.Error())
}
r.Log += fmt.Sprintf("application is available at %s\n", cr.Status.ApplicationURL)

return err
}

Expand Down
17 changes: 13 additions & 4 deletions internal/test/scorecard/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ func CryostatConfigChangeTest(bundle *apimanifests.Bundle, namespace string, ope

_, err = createAndWaitTillCryostatAvailable(cr, tr)
if err != nil {
return fail(*r, fmt.Sprintf("%s test failed: %s", CryostatConfigChangeTestName, err.Error()))
return fail(*r, fmt.Sprintf("failed to determine application URL: %s", err.Error()))
}
defer cleanupCryostat(r, tr.Client, CryostatRecordingTestName, namespace)

// Switch Cryostat CR to PVC for redeployment
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
Expand Down Expand Up @@ -125,8 +126,17 @@ func CryostatConfigChangeTest(bundle *apimanifests.Bundle, namespace string, ope
if err != nil {
return fail(*r, fmt.Sprintf("Cryostat redeployment did not become available: %s", err.Error()))
}
r.Log += "Cryostat deployment has successfully updated to pvc"
defer cleanupCryostat(r, tr.Client, CryostatConfigChangeTestName, namespace)
r.Log += "Cryostat deployment has successfully updated with new spec template"

base, err := url.Parse(cr.Status.ApplicationURL)
if err != nil {
return fail(*r, fmt.Sprintf("application URL is invalid: %s", err.Error()))
}

err = waitTillCryostatReady(base, tr)
if err != nil {
return fail(*r, fmt.Sprintf("failed to reach the application: %s", err.Error()))
}

return *r
}
Expand Down Expand Up @@ -183,7 +193,6 @@ func CryostatRecordingTest(bundle *apimanifests.Bundle, namespace string, openSh
Password: string(secret.Data["CRYOSTAT_RJMX_PASS"]),
MatchExpression: fmt.Sprintf("target.alias==\"%s\"", target.Alias),
}
defer cleanupCryostat(r, tr.Client, CryostatCRTestName, namespace)

err = apiClient.CredentialClient.Create(context.Background(), credential)
if err != nil {
Expand Down

0 comments on commit 09cd707

Please sign in to comment.