Skip to content

Conversation

@hamistao
Copy link
Contributor

@hamistao hamistao commented Nov 21, 2025

This adds the first automated Longhorn interoperability tests, namely:

  • Longhorn Installation with Custom Configuration
  • Fresh Longhorn Installation via Rancher App Catalog
  • Create Longhorn volume through Rancher Workloads

@hamistao hamistao force-pushed the longhorn_installation_tests branch from c8c01b3 to 0cda9b4 Compare November 26, 2025 22:42
Comment on lines +116 to +128
// If Longhorn was installed by a previous test on this same session, uninstall it to install it again with custom configuration.
// If Longhorn was installed previously to this test run, leave it be and skip this test. This way we allow for running the
// next tests on top of a manually installed Longhorn and avoid accidentally uninstalling something important.
if chart.IsAlreadyInstalled {
if l.installedLonghorn {
l.T().Log("Uninstalling Longhorn that was intalled on the previous test.")
err = charts.UninstallLonghornChart(l.client, longhornNamespace, l.cluster.ID, l.payloadOpts.Host)
require.NoError(l.T(), err)
} else {
l.T().Skip("Skipping installation test because Longhorn is already installed")
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This decision was tricky and had some discussion surrounding it. From the outcome of the discussions I believe this is the way to go. This way we achieve

1- Running all tests at once with the suite;
2- Running some tests with a custom installation of longhorn;
3- Keep the cleanup logic neatly isolated;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @rancher/qa-pit-crew

Comment on lines +176 to +181
// Even though the Longhorn default for number of replicas is 2, Rancher enforces its own default of 3.
volumeName := nginxSpec.Template.Spec.Volumes[0].Name
checkReplicasCommand := []string{"kubectl", "-n", longhornNamespace, "get", "volumes.longhorn.io", volumeName, `-o=jsonpath="{.spec.numberOfReplicas}"`}
settingValue, err := kubectl.Command(l.client, nil, l.cluster.ID, checkReplicasCommand, "")
require.NoError(l.T(), err)
require.Equal(l.T(), "\"3\"\n", settingValue)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior is very strange to me and I did not find anything explicitly stating that this is expected, but I assume it is the intended behavior and tested it as such. If you know of a better way to proceed here please let me know.

@rancher/qa-pit-crew

@hamistao hamistao marked this pull request as ready for review November 26, 2025 22:48
@hamistao hamistao requested a review from a team November 26, 2025 22:49
This is not required for the Longhorn tests.

Signed-off-by: hamistao <[email protected]>
Signed-off-by: hamistao <[email protected]>
Signed-off-by: hamistao <[email protected]>
@hamistao hamistao force-pushed the longhorn_installation_tests branch from 0cda9b4 to 264b9a2 Compare November 27, 2025 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants