Skip to content

Commit 6bdf024

Browse files
authored
integration-server-test: Avoid assert panic and add cleanup-on-failure (elastic#17222)
* Avoid panic when number of indices mismatch * Add cleanup-on-failure
1 parent 25c0a52 commit 6bdf024

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,28 +364,28 @@ endif
364364
ifndef SCENARIO
365365
$(error SCENARIO is not set)
366366
endif
367-
@cd integrationservertest && go test -run=TestUpgrade.*/.*/$(SCENARIO) -v -timeout=60m -cleanup-on-failure=false -target="pro" -upgrade-path="$(UPGRADE_PATH)" ./
367+
@cd integrationservertest && go test -run=TestUpgrade.*/.*/$(SCENARIO) -v -timeout=60m -cleanup-on-failure=true -target="pro" -upgrade-path="$(UPGRADE_PATH)" ./
368368

369369
# Run integration server upgrade test on all scenarios
370370
.PHONY: integration-server-upgrade-test-all
371371
integration-server-upgrade-test-all:
372372
ifndef UPGRADE_PATH
373373
$(error UPGRADE_PATH is not set)
374374
endif
375-
@cd integrationservertest && go test -run=TestUpgrade_UpgradePath -v -timeout=60m -cleanup-on-failure=false -target="pro" -upgrade-path="$(UPGRADE_PATH)" ./
375+
@cd integrationservertest && go test -run=TestUpgrade_UpgradePath -v -timeout=60m -cleanup-on-failure=true -target="pro" -upgrade-path="$(UPGRADE_PATH)" ./
376376

377377
# Run integration server standalone test on one scenario - Managed7 / Managed8 / Managed9
378378
.PHONY: integration-server-standalone-test
379379
integration-server-standalone-test:
380380
ifndef SCENARIO
381381
$(error SCENARIO is not set)
382382
endif
383-
@cd integrationservertest && go test -run=TestStandaloneManaged.*/$(SCENARIO) -v -timeout=60m -cleanup-on-failure=false -target="pro" ./
383+
@cd integrationservertest && go test -run=TestStandaloneManaged.*/$(SCENARIO) -v -timeout=60m -cleanup-on-failure=true -target="pro" ./
384384

385385
# Run integration server standalone test on all scenarios
386386
.PHONY: integration-server-standalone-test-all
387387
integration-server-standalone-test-all:
388-
@cd integrationservertest && go test -run=TestStandaloneManaged -v -timeout=60m -cleanup-on-failure=false -target="pro" ./
388+
@cd integrationservertest && go test -run=TestStandaloneManaged -v -timeout=60m -cleanup-on-failure=true -target="pro" ./
389389

390390
##############################################################################
391391
# Generating and linting API documentation

integrationservertest/internal/asserts/data_streams.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package asserts
1919

2020
import (
21+
"fmt"
2122
"testing"
2223

2324
"github.com/stretchr/testify/assert"
@@ -81,6 +82,10 @@ func checkSingleDataStream(t *testing.T, expected DataStreamExpectation, actual
8182
"data stream %s should have %d indices", actual.Name, len(expected.IndicesManagedBy),
8283
)
8384
for i, index := range actual.Indices {
85+
if i >= len(expected.IndicesManagedBy) {
86+
assert.Fail(t, fmt.Sprintf("index %s not in expectation", index.IndexName))
87+
continue
88+
}
8489
assert.Equal(t, expected.IndicesManagedBy[i], index.ManagedBy.Name,
8590
`index %s should be managed by "%s"`, index.IndexName,
8691
expected.IndicesManagedBy[i],

0 commit comments

Comments
 (0)