Skip to content

Commit 08d2782

Browse files
authored
Fix metrics test and fix faulty CI (#420)
Just before releasing 1.0.0, I was looking at the running CI integration tests action. Suddenly, I saw a test failing. **Yet then the CI run succeeded**! We discovered that the make recipe for running integration tests, which is used by the CI, keeps running even if some earlier subcommand in that recipe, including the main part of integration tests run under valgrind, fails with a nonzero code. The culprit was found to be `.ONESHELL` directive on top of the Makefile, combined with lack of the `-e` option set in the run shells. Adding `-e` option to `.SHELLFLAGS` fixed the issue. The test (from MetricsTest) was failing due to recent change in Rust Driver. Adjusting it was trivial. ## Pre-review checklist <!-- Make sure you took care of the issues on the list. Put 'x' into those boxes which apply. You can also create the PR now and click on all relevant checkboxes. --> - [x] I have split my patch into logically separate commits. - [x] All commit messages clearly explain what they change and why. - [x] PR description sums up the changes and reasons why they should be introduced. - ~~[ ] I have implemented Rust unit tests for the features/changes introduced.~~ - ~~[ ] I have enabled appropriate tests in `Makefile` in `{SCYLLA,CASSANDRA}_(NO_VALGRIND_)TEST_FILTER`.~~ - ~~[ ] I added appropriate `Fixes:` annotations to PR description.~~
2 parents 4274e5b + 24a4975 commit 08d2782

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ SPACE := ${EMPTY} ${EMPTY}
33
.ONESHELL:
44

55
SHELL := bash
6+
.SHELLFLAGS := -ec
67
ifeq ($(OS),Windows_NT)
78
SHELL := pwsh.exe
8-
.SHELLFLAGS := -NoProfile -Command
9+
.SHELLFLAGS := -NoProfile -Command $$ErrorActionPreference = 'Stop';
910
endif
1011

1112
UNAME_S := $(shell uname -s)

tests/src/integration/tests/test_metrics.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,16 @@ CASSANDRA_INTEGRATION_TEST_F(MetricsTests, StatsConnections) {
4747
.with_constant_reconnect(10)
4848
.connect(); // low reconnect for faster node restart
4949

50-
// All expected values are greater by 1 than in cpp-driver.
51-
// This is caused by Rust Driver including Control Connection in the metrics.
5250
CassMetrics metrics = session.metrics();
53-
EXPECT_EQ(3u, metrics.stats.total_connections);
51+
EXPECT_EQ(2u, metrics.stats.total_connections);
5452

5553
stop_node(1);
5654
metrics = session.metrics();
57-
EXPECT_EQ(2u, metrics.stats.total_connections);
55+
EXPECT_EQ(1u, metrics.stats.total_connections);
5856

5957
start_node(1);
6058
metrics = session.metrics();
61-
EXPECT_EQ(3u, metrics.stats.total_connections);
59+
EXPECT_EQ(2u, metrics.stats.total_connections);
6260
}
6361

6462
/**

0 commit comments

Comments
 (0)