Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cupnes committed Mar 5, 2024
1 parent 6b99d46 commit 2f1d4f3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (
"fmt"
"os"
"os/exec"
"regexp"
"testing"
"time"

"k8s.io/apimachinery/pkg/api/errors"

"github.com/cybozu-go/rbd-backup-system/internal/controller"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -28,6 +27,8 @@ var (

//go:embed testdata/rbdpvcbackup-template.yaml
dummyRBDPVCBackupTemplate string

kubectlIsNotFoundRegexp = regexp.MustCompile("^Error from server (NotFound): .+$")
)

const (
Expand Down Expand Up @@ -428,10 +429,10 @@ var _ = Describe("rbd backup system", func() {
By("Confirming RBDPVCBackup resource deletion")
Eventually(func() error {
stdout, stderr, err := kubectl("-n", namespace, "get", "rbdpvcbackup", rbdPVCBackupName)
if errors.IsNotFound(err) {
return nil
}
if err != nil {
if kubectlIsNotFoundRegexp.MatchString(string(stderr)) {
return nil
}
return fmt.Errorf("get rbdpvcbackup %s failed. stderr: %s, err: %w", rbdPVCBackupName, string(stderr), err)
}
return fmt.Errorf("RBDPVCBackup resource %s still exists. stdout: %s", rbdPVCBackupName, stdout)
Expand Down

0 comments on commit 2f1d4f3

Please sign in to comment.