Files
my-rook-config/pkg/daemon/ceph/rgw/init_test.go
T
Sébastien Han 03587352d5 rgw: change default frontend on nautilus
As per: https://github.com/ceph/ceph/pull/26599, Beast is now the
default fronted for rados gateway.
Newly created cluster as of Nautilus will use it by default.

Resolves: https://github.com/rook/rook/issues/2707
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-02-24 17:22:32 +01:00

68 lines
1.8 KiB
Go

/*
Copyright 2016 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package rgw
import (
"testing"
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
"github.com/stretchr/testify/assert"
)
func TestPortString(t *testing.T) {
// No port or secure port
cfg := &Config{}
result := portString(cfg)
assert.Equal(t, "", result)
// Insecure port
cfg = &Config{Port: 80}
result = portString(cfg)
assert.Equal(t, "80", result)
// Secure port
cfg = &Config{SecurePort: 443, CertificatePath: "/etc/rgw/cert.pem"}
result = portString(cfg)
assert.Equal(t, "443s ssl_certificate=/etc/rgw/cert.pem", result)
// Both ports
cfg = &Config{Port: 80, SecurePort: 443, CertificatePath: "/etc/rgw/cert.pem"}
result = portString(cfg)
assert.Equal(t, "80+443s ssl_certificate=/etc/rgw/cert.pem", result)
// Secure port requires the cert
cfg = &Config{SecurePort: 443}
result = portString(cfg)
assert.Equal(t, "", result)
}
func TestFrontend(t *testing.T) {
cfg := &Config{}
cfg.ClusterInfo = &cephconfig.ClusterInfo{CephVersionName: "mimic"}
result := rgwFrontend(cfg)
assert.Equal(t, "civetweb", result)
cfg.ClusterInfo.CephVersionName = "nautilus"
result = rgwFrontend(cfg)
assert.Equal(t, "beast", result)
cfg.ClusterInfo.CephVersionName = "octopus"
result = rgwFrontend(cfg)
assert.Equal(t, "beast", result)
}