2017-01-17 13:23:03 -08:00
|
|
|
/*
|
|
|
|
|
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.
|
|
|
|
|
*/
|
2018-08-31 13:39:02 -06:00
|
|
|
|
2017-01-17 13:23:03 -08:00
|
|
|
package operator
|
|
|
|
|
|
2017-03-09 15:24:33 -08:00
|
|
|
import (
|
2017-07-24 07:43:11 -07:00
|
|
|
"fmt"
|
2017-03-09 15:24:33 -08:00
|
|
|
"testing"
|
2017-01-17 13:23:03 -08:00
|
|
|
|
2017-06-02 13:44:54 -07:00
|
|
|
"github.com/rook/rook/pkg/clusterd"
|
2020-04-17 18:40:54 +02:00
|
|
|
opcontroller "github.com/rook/rook/pkg/operator/ceph/controller"
|
2017-03-09 15:24:33 -08:00
|
|
|
"github.com/rook/rook/pkg/operator/test"
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
2017-07-24 07:43:11 -07:00
|
|
|
func TestOperator(t *testing.T) {
|
2020-01-07 18:51:19 +05:30
|
|
|
clientset := test.New(t, 3)
|
2017-07-24 07:43:11 -07:00
|
|
|
context := &clusterd.Context{Clientset: clientset}
|
2021-09-22 16:39:09 -06:00
|
|
|
o := New(context, "", "")
|
2017-03-09 15:24:33 -08:00
|
|
|
|
2017-07-24 07:43:11 -07:00
|
|
|
assert.NotNil(t, o)
|
|
|
|
|
assert.NotNil(t, o.clusterController)
|
|
|
|
|
assert.NotNil(t, o.resources)
|
|
|
|
|
assert.Equal(t, context, o.context)
|
2021-09-22 16:39:09 -06:00
|
|
|
assert.Equal(t, 1, len(o.resources))
|
2017-07-24 07:43:11 -07:00
|
|
|
for _, r := range o.resources {
|
2021-09-22 16:39:09 -06:00
|
|
|
if r.Name != opcontroller.ClusterResource.Name {
|
2017-09-11 14:56:10 -07:00
|
|
|
assert.Fail(t, fmt.Sprintf("Resource %s is not valid", r.Name))
|
2017-07-24 07:43:11 -07:00
|
|
|
}
|
|
|
|
|
}
|
2017-01-17 13:23:03 -08:00
|
|
|
}
|