mirror of https://github.com/ceph/go-ceph
rgw/admin: fix tests for quincy
Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
parent
68ebb0520a
commit
005aa73667
|
@ -0,0 +1,37 @@
|
|||
package util
|
||||
|
||||
import "os"
|
||||
|
||||
// CephVersion type
|
||||
type CephVersion int
|
||||
|
||||
// Enum of known CephVersions
|
||||
const (
|
||||
CephNautilus CephVersion = 14 + iota
|
||||
CephOctopus
|
||||
CephPacific
|
||||
CephQuincy
|
||||
CephUnknown
|
||||
)
|
||||
|
||||
// CurrentCephVersion is the current Ceph version
|
||||
func CurrentCephVersion() CephVersion {
|
||||
vname := os.Getenv("CEPH_VERSION")
|
||||
return CephVersionOfString(vname)
|
||||
}
|
||||
|
||||
// CephVersionOfString converts a string to CephVersion
|
||||
func CephVersionOfString(vname string) CephVersion {
|
||||
switch vname {
|
||||
case "nautilus":
|
||||
return CephNautilus
|
||||
case "octopus":
|
||||
return CephOctopus
|
||||
case "pacific":
|
||||
return CephPacific
|
||||
case "quincy":
|
||||
return CephQuincy
|
||||
default:
|
||||
return CephUnknown
|
||||
}
|
||||
}
|
|
@ -4,21 +4,13 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/ceph/go-ceph/internal/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func skipIfQuincy(t *testing.T) {
|
||||
vname := os.Getenv("CEPH_VERSION")
|
||||
if vname == "quincy" {
|
||||
t.Skipf("disabled on ceph %s", vname)
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *RadosGWTestSuite) TestBucket() {
|
||||
skipIfQuincy(suite.T())
|
||||
suite.SetupConnection()
|
||||
co, err := New(suite.endpoint, suite.accessKey, suite.secretKey, newDebugHTTPClient(http.DefaultClient))
|
||||
assert.NoError(suite.T(), err)
|
||||
|
@ -60,7 +52,10 @@ func (suite *RadosGWTestSuite) TestBucket() {
|
|||
suite.T().Run("remove non-existing bucket", func(t *testing.T) {
|
||||
err := co.RemoveBucket(context.Background(), Bucket{Bucket: "foo"})
|
||||
assert.Error(suite.T(), err)
|
||||
// TODO: report to rgw team, this should return NoSuchBucket?
|
||||
if util.CurrentCephVersion() <= util.CephOctopus {
|
||||
assert.True(suite.T(), errors.Is(err, ErrNoSuchKey))
|
||||
} else {
|
||||
assert.True(suite.T(), errors.Is(err, ErrNoSuchBucket))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue