Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Signed-off-by: John Collier <[email protected]>
  • Loading branch information
johnmcollier committed Aug 25, 2023
1 parent 9699b41 commit 3a8d5f1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions controllers/application_controller_finalizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
appstudiov1alpha1 "github.com/redhat-appstudio/application-api/api/v1alpha1"
cdqanalysis "github.com/redhat-appstudio/application-service/cdq-analysis/pkg"
"github.com/redhat-appstudio/application-service/pkg/metrics"
Expand Down Expand Up @@ -57,6 +58,9 @@ var _ = Describe("Application controller finalizer counter tests", func() {

Context("Delete Application CR fields with invalid devfile", func() {
It("Should delete successfully even when finalizer fails after 5 times", func() {
beforeDeleteTotalReqs := testutil.ToFloat64(metrics.ApplicationDeletionTotalReqs)
beforeDeleteSucceedReqs := testutil.ToFloat64(metrics.ApplicationDeletionSucceeded)
beforeDeleteFailedReqs := testutil.ToFloat64(metrics.ApplicationDeletionFailed)
// Create a simple Application CR and get its devfile
fetchedApp := createAndFetchSimpleApp(AppName, AppNamespace, DisplayName, Description)
devfileSrc := cdqanalysis.DevfileSrc{
Expand Down Expand Up @@ -95,9 +99,9 @@ var _ = Describe("Application controller finalizer counter tests", func() {
return k8sClient.Get(context.Background(), hasAppLookupKey, f)
}, timeout, interval).ShouldNot(Succeed())

Expect(metrics.ApplicationDeletionTotalReqs).To(Equal(1))
Expect(metrics.ApplicationDeletionSucceeded).To(Equal(1))
Expect(metrics.ApplicationDeletionFailed).To(Equal(0))
Expect(testutil.ToFloat64(metrics.ApplicationDeletionTotalReqs) > beforeDeleteTotalReqs).To(BeTrue())
Expect(testutil.ToFloat64(metrics.ApplicationDeletionSucceeded) > beforeDeleteSucceedReqs).To(BeTrue())
Expect(testutil.ToFloat64(metrics.ApplicationDeletionFailed) > beforeDeleteFailedReqs).To(BeTrue())
})
})

Expand Down

0 comments on commit 3a8d5f1

Please sign in to comment.