Skip to content

Commit 28ecc25

Browse files
Merge pull request #2744 from Nordix/lentzi90/e2e-upgrade-logs
🌱 E2E: Improve logs and artifacts in upgrade tests
2 parents 2650327 + 05b6535 commit 28ecc25

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

test/e2e/upgrade_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package e2e
66
import (
77
"context"
88
"fmt"
9-
"path"
109
"path/filepath"
1110
"strings"
1211

@@ -180,7 +179,7 @@ const hardwareDetailsRelease04 = `
180179
// - If the BMH is successfully provisioned, it means the upgraded BMO/Ironic recognized that BMH, hence the upgrade succeeded.
181180
//
182181
// The function returns the namespace object, with its cancelFunc. These can be used to clean up the created resources.
183-
func RunUpgradeTest(ctx context.Context, input *BMOIronicUpgradeInput, upgradeClusterProxy framework.ClusterProxy) (*corev1.Namespace, context.CancelFunc) {
182+
func RunUpgradeTest(ctx context.Context, input *BMOIronicUpgradeInput, upgradeClusterProxy framework.ClusterProxy) (*corev1.Namespace, context.CancelFunc, string) {
184183
bmoIronicNamespace := "baremetal-operator-system"
185184
initBMOKustomization := input.InitBMOKustomization
186185
initIronicKustomization := input.InitIronicKustomization
@@ -255,7 +254,7 @@ func RunUpgradeTest(ctx context.Context, input *BMOIronicUpgradeInput, upgradeCl
255254
By("Creating a BMH with inspection disabled and hardware details added")
256255
bmh := metal3api.BareMetalHost{
257256
ObjectMeta: metav1.ObjectMeta{
258-
Name: "upgrade",
257+
Name: testCaseName,
259258
Namespace: namespace.Name,
260259
Annotations: map[string]string{
261260
metal3api.InspectAnnotationPrefix: "disabled",
@@ -337,7 +336,7 @@ func RunUpgradeTest(ctx context.Context, input *BMOIronicUpgradeInput, upgradeCl
337336
Bmh: bmh,
338337
State: metal3api.StateProvisioned,
339338
}, e2eConfig.GetIntervals(specName, "wait-provisioned")...)
340-
return namespace, cancelWatches
339+
return namespace, cancelWatches, testCaseArtifactFolder
341340
}
342341

343342
var _ = Describe("Upgrade", Label("optional", "upgrade"), func() {
@@ -348,7 +347,7 @@ var _ = Describe("Upgrade", Label("optional", "upgrade"), func() {
348347
entries []TableEntry
349348
namespace *corev1.Namespace
350349
cancelWatches context.CancelFunc
351-
specName = "upgrade"
350+
testArtifactFolder string
352351
)
353352

354353
for i := range e2eConfig.BMOIronicUpgradeSpecs {
@@ -407,7 +406,7 @@ var _ = Describe("Upgrade", Label("optional", "upgrade"), func() {
407406
DescribeTable("",
408407
// Test function that runs for each table entry
409408
func(ctx context.Context, input *BMOIronicUpgradeInput) {
410-
namespace, cancelWatches = RunUpgradeTest(ctx, input, upgradeClusterProxy)
409+
namespace, cancelWatches, testArtifactFolder = RunUpgradeTest(ctx, input, upgradeClusterProxy)
411410
},
412411
// Description function that generates test descriptions
413412
func(ctx context.Context, input *BMOIronicUpgradeInput) string {
@@ -425,7 +424,7 @@ var _ = Describe("Upgrade", Label("optional", "upgrade"), func() {
425424
)
426425

427426
AfterEach(func() {
428-
DumpResources(ctx, e2eConfig, clusterProxy, path.Join(artifactFolder, specName))
427+
DumpResources(ctx, e2eConfig, upgradeClusterProxy, testArtifactFolder)
429428
if !skipCleanup {
430429
cleanup(ctx, upgradeClusterProxy, namespace, cancelWatches, e2eConfig.GetIntervals("default", "wait-namespace-deleted")...)
431430
if e2eConfig.GetBoolVariable("UPGRADE_USE_EXISTING_CLUSTER") {

0 commit comments

Comments
 (0)