forked from rook/rook
The rook types used across the storage providers moved from the v1alpha2 package to the v1 package. This commit points the packages at their new location. Implementation is expected to remain unchanged. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
80 lines
2.5 KiB
Go
80 lines
2.5 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 rbd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
|
|
rookv1 "github.com/rook/rook/pkg/apis/rook.io/v1"
|
|
"github.com/rook/rook/pkg/clusterd"
|
|
cephconfig "github.com/rook/rook/pkg/daemon/ceph/config"
|
|
"github.com/rook/rook/pkg/operator/ceph/config"
|
|
cephtest "github.com/rook/rook/pkg/operator/ceph/test"
|
|
optest "github.com/rook/rook/pkg/operator/test"
|
|
"github.com/stretchr/testify/assert"
|
|
v1 "k8s.io/api/core/v1"
|
|
"k8s.io/apimachinery/pkg/api/resource"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
func TestPodSpec(t *testing.T) {
|
|
clientset := optest.New(t, 1)
|
|
c := New(
|
|
&cephconfig.ClusterInfo{FSID: "myfsid"},
|
|
&clusterd.Context{Clientset: clientset},
|
|
"ns",
|
|
"rook/rook:myversion",
|
|
cephv1.CephVersionSpec{Image: "ceph/ceph:myceph"},
|
|
rookv1.Placement{},
|
|
rookv1.Annotations{},
|
|
cephv1.NetworkSpec{},
|
|
cephv1.RBDMirroringSpec{Workers: 2},
|
|
v1.ResourceRequirements{
|
|
Limits: v1.ResourceList{
|
|
v1.ResourceCPU: *resource.NewQuantity(200.0, resource.BinarySI),
|
|
v1.ResourceMemory: *resource.NewQuantity(600.0, resource.BinarySI),
|
|
},
|
|
Requests: v1.ResourceList{
|
|
v1.ResourceCPU: *resource.NewQuantity(100.0, resource.BinarySI),
|
|
v1.ResourceMemory: *resource.NewQuantity(300.0, resource.BinarySI),
|
|
},
|
|
},
|
|
"my-priority-class",
|
|
metav1.OwnerReference{},
|
|
"/var/lib/rook/",
|
|
false,
|
|
)
|
|
daemonConf := daemonConfig{
|
|
DaemonID: "a",
|
|
ResourceName: "rook-ceph-rbd-mirror-a",
|
|
DataPathMap: config.NewDatalessDaemonDataPathMap("rook-ceph", "/var/lib/rook"),
|
|
}
|
|
|
|
d := c.makeDeployment(&daemonConf)
|
|
assert.Equal(t, "rook-ceph-rbd-mirror-a", d.Name)
|
|
|
|
// Deployment should have Ceph labels
|
|
cephtest.AssertLabelsContainCephRequirements(t, d.ObjectMeta.Labels,
|
|
config.RbdMirrorType, "a", AppName, "ns")
|
|
|
|
podTemplate := cephtest.NewPodTemplateSpecTester(t, &d.Spec.Template)
|
|
podTemplate.RunFullSuite(config.RbdMirrorType, "a", AppName, "ns", "ceph/ceph:myceph",
|
|
"200", "100", "600", "300", /* resources */
|
|
"my-priority-class")
|
|
}
|