Files
my-rook-config/tests/integration/ceph_base_nfs_test.go
T
Rakshith R f32531ef34 ci: enable and fixes for nfs ci
This commit anabled nfs csi ci and
add fixes/improvements to it like the
following:
- verify deletion of cephnfs and .nfs pool before proceeding
- verify pv deletion
- do not enable rook module
- reduce activeCount to 1 to save resources
- run cephnfs ci before cephfs ci since it cephfs
  ci is more resource intensive.

Signed-off-by: Rakshith R <rar@redhat.com>
(cherry picked from commit be10dac98c)
2022-10-06 18:03:44 +00:00

59 lines
2.4 KiB
Go

/*
Copyright 2022 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 integration
import (
"github.com/rook/rook/tests/framework/clients"
"github.com/rook/rook/tests/framework/installer"
"github.com/rook/rook/tests/framework/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
// Smoke Test for File System Storage for CephNFS - Test check the following operations on Filesystem Storage in order
// Create,Mount,Write,Read,Unmount and Delete.
func runNFSFileE2ETest(helper *clients.TestClient, k8sh *utils.K8sHelper, s *suite.Suite, settings *installer.TestCephSettings, filesystemName string) {
defer fileTestDataCleanUp(helper, k8sh, s, filePodName, settings.Namespace, filesystemName)
logger.Infof("Running on Rook Cluster %s", settings.Namespace)
logger.Infof("File Storage End To End Integration Test for CephNFS- create, mount, write to, read from, and unmount")
activeCount := 1
createFilesystem(helper, k8sh, s, settings, filesystemName, activeCount)
nfsClusterName := "my-nfs"
err := helper.NFSClient.Create(settings.Namespace, nfsClusterName, 1)
require.Nil(s.T(), err)
if settings.TestNFSCSI {
storageClassName := "nfs-storageclass"
err = helper.NFSClient.CreateStorageClass(filesystemName, nfsClusterName, settings.OperatorNamespace, settings.Namespace, storageClassName)
assert.NoError(s.T(), err)
createFilesystemConsumerPod(helper, k8sh, s, settings, filesystemName, storageClassName)
// Test reading and writing to the first pod
err = writeAndReadToFilesystem(helper, k8sh, s, settings.Namespace, filePodName, "test_file")
assert.NoError(s.T(), err)
cleanupFilesystemConsumer(helper, k8sh, s, settings.Namespace, filePodName)
assert.NoError(s.T(), err)
}
err = helper.NFSClient.Delete(settings.Namespace, nfsClusterName)
assert.Nil(s.T(), err)
cleanupFilesystem(helper, k8sh, s, settings.Namespace, filesystemName)
}