Skip to content

Commit

Permalink
test: generate long node name depending on test suite
Browse files Browse the repository at this point in the history
The generation of a long node name in the integration tests was
being done based on the k8s version. In the past, older K8s versions
did not support the changing name. Now it's more maintainable if
we generate the long name depending on the test suite.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
  • Loading branch information
travisn committed Dec 6, 2021
1 parent ee83ca7 commit 9d2aa1f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/operator/k8sutil/k8sutil.go
Expand Up @@ -112,7 +112,7 @@ func TruncateNodeName(format, nodeName string) string {
func truncateNodeName(format, nodeName string, maxLength int) string {
if len(nodeName)+len(fmt.Sprintf(format, "")) > maxLength {
hashed := Hash(nodeName)
logger.Infof("format and nodeName longer than %d chars, nodeName %s will be %s", validation.DNS1035LabelMaxLength, nodeName, hashed)
logger.Infof("format and nodeName longer than %d chars, nodeName %s will be %s", maxLength, nodeName, hashed)
nodeName = hashed
}
return fmt.Sprintf(format, nodeName)
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/installer/ceph_installer.go
Expand Up @@ -920,7 +920,7 @@ func NewCephInstaller(t func() *testing.T, clientset *kubernetes.Clientset, sett
k8shelper: k8shelp,
helmHelper: utils.NewHelmHelper(testHelmPath()),
k8sVersion: version.String(),
changeHostnames: k8shelp.VersionAtLeast("v1.18.0"),
changeHostnames: settings.ChangeHostName,
T: t,
}
flag.Parse()
Expand Down
1 change: 1 addition & 0 deletions tests/framework/installer/ceph_settings.go
Expand Up @@ -45,6 +45,7 @@ type TestCephSettings struct {
SkipCleanupPolicy bool
DirectMountToolbox bool
EnableVolumeReplication bool
ChangeHostName bool
RookVersion string
CephVersion cephv1.CephVersionSpec
}
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/ceph_helm_test.go
Expand Up @@ -72,6 +72,7 @@ func (h *HelmSuite) SetupSuite() {
SkipOSDCreation: false,
EnableAdmissionController: false,
EnableDiscovery: true,
ChangeHostName: true,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.OctopusVersion,
}
Expand All @@ -91,7 +92,7 @@ func (h *HelmSuite) AfterTest(suiteName, testName string) {
// Test to make sure all rook components are installed and Running
func (h *HelmSuite) TestARookInstallViaHelm() {
checkIfRookClusterIsInstalled(h.Suite, h.k8shelper, h.settings.Namespace, h.settings.Namespace, 1)
checkIfRookClusterHasHealthyIngress(h.Suite, h.k8shelper, h.settings.Namespace)
checkIfRookClusterHasHealthyIngress(h.Suite, h.k8shelper, h.settings.Namespace)
}

// Test BlockCreation on Rook that was installed via Helm
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ceph_smoke_test.go
Expand Up @@ -94,6 +94,7 @@ func (s *SmokeSuite) SetupSuite() {
EnableAdmissionController: true,
UseCrashPruner: true,
EnableVolumeReplication: true,
ChangeHostName: true,
RookVersion: installer.LocalBuildTag,
CephVersion: installer.ReturnCephVersion(),
}
Expand Down

0 comments on commit 9d2aa1f

Please sign in to comment.