2017-12-29 00:33:36 -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.
|
|
|
|
|
*/
|
2017-09-19 01:10:50 -07:00
|
|
|
package integration
|
2017-08-24 14:55:01 -07:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/rook/rook/tests/framework/clients"
|
2018-08-21 15:24:52 -06:00
|
|
|
"github.com/rook/rook/tests/framework/installer"
|
2017-08-24 14:55:01 -07:00
|
|
|
"github.com/rook/rook/tests/framework/utils"
|
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
|
)
|
|
|
|
|
|
2017-10-26 17:49:18 -07:00
|
|
|
// ***************************************************
|
|
|
|
|
// *** Major scenarios tested by the TestHelmSuite ***
|
|
|
|
|
// Setup
|
|
|
|
|
// - A cluster created via the Helm chart
|
|
|
|
|
// Monitors
|
|
|
|
|
// - One mon
|
|
|
|
|
// OSDs
|
2020-05-06 00:44:31 +09:00
|
|
|
// - Bluestore running on a raw block device
|
2017-10-26 17:49:18 -07:00
|
|
|
// Block
|
2020-05-06 00:44:31 +09:00
|
|
|
// - Create a pool in the cluster
|
2017-10-26 17:49:18 -07:00
|
|
|
// - Mount/unmount a block device through the dynamic provisioner
|
|
|
|
|
// File system
|
2018-03-16 08:31:34 -07:00
|
|
|
// - Create a file system via the CRD
|
2017-10-26 17:49:18 -07:00
|
|
|
// Object
|
|
|
|
|
// - Create the object store via the CRD
|
|
|
|
|
// ***************************************************
|
2019-07-17 23:23:01 -06:00
|
|
|
func TestCephHelmSuite(t *testing.T) {
|
2017-11-10 12:03:43 -08:00
|
|
|
s := new(HelmSuite)
|
|
|
|
|
defer func(s *HelmSuite) {
|
2021-03-09 22:52:21 -07:00
|
|
|
HandlePanics(recover(), s.TearDownSuite, s.T)
|
2017-11-10 12:03:43 -08:00
|
|
|
}(s)
|
|
|
|
|
suite.Run(t, s)
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|
|
|
|
|
|
2017-09-19 01:10:50 -07:00
|
|
|
type HelmSuite struct {
|
2017-08-24 14:55:01 -07:00
|
|
|
suite.Suite
|
2020-09-17 22:53:24 +05:30
|
|
|
helper *clients.TestClient
|
2021-03-09 22:52:21 -07:00
|
|
|
installer *installer.CephInstaller
|
|
|
|
|
settings *installer.TestCephSettings
|
|
|
|
|
k8shelper *utils.K8sHelper
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|
|
|
|
|
|
2021-03-09 22:52:21 -07:00
|
|
|
func (h *HelmSuite) SetupSuite() {
|
|
|
|
|
namespace := "helm-ns"
|
|
|
|
|
h.settings = &installer.TestCephSettings{
|
2023-11-24 12:05:24 +05:30
|
|
|
Namespace: namespace,
|
|
|
|
|
OperatorNamespace: namespace,
|
|
|
|
|
StorageClassName: "",
|
|
|
|
|
UseHelm: true,
|
|
|
|
|
UsePVC: false,
|
|
|
|
|
Mons: 1,
|
|
|
|
|
SkipOSDCreation: false,
|
|
|
|
|
EnableDiscovery: true,
|
|
|
|
|
ChangeHostName: true,
|
|
|
|
|
ConnectionsEncrypted: true,
|
|
|
|
|
RookVersion: installer.LocalBuildTag,
|
|
|
|
|
CephVersion: installer.QuincyVersion,
|
2020-04-16 11:54:05 +02:00
|
|
|
}
|
2021-03-15 20:47:38 -06:00
|
|
|
h.settings.ApplyEnvVars()
|
2021-09-16 17:48:29 -06:00
|
|
|
h.installer, h.k8shelper = StartTestCluster(h.T, h.settings)
|
2021-03-09 22:52:21 -07:00
|
|
|
h.helper = clients.CreateTestClient(h.k8shelper, h.installer.Manifests)
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|
|
|
|
|
|
2021-03-09 22:52:21 -07:00
|
|
|
func (h *HelmSuite) TearDownSuite() {
|
|
|
|
|
h.installer.UninstallRook()
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|
|
|
|
|
|
2021-03-09 22:52:21 -07:00
|
|
|
func (h *HelmSuite) AfterTest(suiteName, testName string) {
|
|
|
|
|
h.installer.CollectOperatorLog(suiteName, testName)
|
2019-08-11 07:39:18 -06:00
|
|
|
}
|
|
|
|
|
|
2018-10-14 12:10:08 +02:00
|
|
|
// Test to make sure all rook components are installed and Running
|
2021-03-09 22:52:21 -07:00
|
|
|
func (h *HelmSuite) TestARookInstallViaHelm() {
|
2022-07-26 15:05:39 -06:00
|
|
|
checkIfRookClusterIsInstalled(&h.Suite, h.k8shelper, h.settings.Namespace, h.settings.Namespace, 1)
|
|
|
|
|
checkIfRookClusterHasHealthyIngress(&h.Suite, h.k8shelper, h.settings.Namespace)
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|
|
|
|
|
|
2018-10-14 12:10:08 +02:00
|
|
|
// Test BlockCreation on Rook that was installed via Helm
|
2021-03-09 22:52:21 -07:00
|
|
|
func (h *HelmSuite) TestBlockStoreOnRookInstalledViaHelm() {
|
2022-07-26 15:05:39 -06:00
|
|
|
runBlockCSITestLite(h.helper, h.k8shelper, &h.Suite, h.settings)
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|
|
|
|
|
|
2018-10-14 12:10:08 +02:00
|
|
|
// Test File System Creation on Rook that was installed via helm
|
2021-03-09 22:52:21 -07:00
|
|
|
func (h *HelmSuite) TestFileStoreOnRookInstalledViaHelm() {
|
2022-07-26 15:05:39 -06:00
|
|
|
runFileE2ETestLite(h.helper, h.k8shelper, &h.Suite, h.settings, "testfs")
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|
|
|
|
|
|
2018-10-14 12:10:08 +02:00
|
|
|
// Test Object StoreCreation on Rook that was installed via helm
|
2021-03-09 22:52:21 -07:00
|
|
|
func (h *HelmSuite) TestObjectStoreOnRookInstalledViaHelm() {
|
2021-09-23 14:19:31 -06:00
|
|
|
deleteStore := true
|
|
|
|
|
tls := false
|
2022-04-22 14:41:38 +02:00
|
|
|
runObjectE2ETestLite(h.T(), h.helper, h.k8shelper, h.installer, h.settings.Namespace, "default", 3, deleteStore, tls)
|
2017-08-24 14:55:01 -07:00
|
|
|
}
|