From 23c293b7840ee72a297035e7197e38cd826709b8 Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-boundary <82989682+hc-github-team-secure-boundary@users.noreply.github.com> Date: Fri, 22 May 2026 00:40:00 +0530 Subject: [PATCH] test(e2e): Fix cassandra e2e test (#2548) (#6739) (#6740) * chore(e2e): Parallelize installation steps * chore(e2e): Install missing dependencies * test(e2e): Improve resiliency of assertions * CR (cherry picked from commit e19c5472f904e1a0a9c26121a6ded983698ce508) # Conflicts: # .github/workflows/enos-run.yml Co-authored-by: Michael Li --- enos/modules/test_e2e_docker/test.sh | 20 +++++-------------- .../base/target_tcp_connect_cassandra_test.go | 7 +++++-- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/enos/modules/test_e2e_docker/test.sh b/enos/modules/test_e2e_docker/test.sh index ed60bad5b7..8391560b79 100755 --- a/enos/modules/test_e2e_docker/test.sh +++ b/enos/modules/test_e2e_docker/test.sh @@ -22,21 +22,11 @@ apt install unzip pass lsb-release postgresql-client default-mysql-client wget a # Function to install Cassandra install_cassandra() { - # Add Cassandra repository key - wget -O cassandra.keys https://www.apache.org/dist/cassandra/KEYS - - # Convert key to gpg format - gpg --no-default-keyring --keyring ./temp-keyring.gpg --import cassandra.keys - gpg --no-default-keyring --keyring ./temp-keyring.gpg --export --output cassandra.gpg - rm ./temp-keyring.gpg cassandra.keys - mv cassandra.gpg /etc/apt/keyrings/cassandra.gpg - - # Add Cassandra repository - echo "deb [signed-by=/etc/apt/keyrings/cassandra.gpg] https://debian.cassandra.apache.org 41x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list - - # Update package list and install Cassandra - apt update - apt install cassandra -y + apt install -y python3-venv + python3 -m venv "$HOME/cqlsh-venv" + "$HOME/cqlsh-venv/bin/pip" install --upgrade pip + "$HOME/cqlsh-venv/bin/pip" install cqlsh + export PATH="$HOME/cqlsh-venv/bin:$PATH" } # Install Cassandra diff --git a/testing/internal/e2e/tests/base/target_tcp_connect_cassandra_test.go b/testing/internal/e2e/tests/base/target_tcp_connect_cassandra_test.go index 49b9997245..1f8326dd3b 100644 --- a/testing/internal/e2e/tests/base/target_tcp_connect_cassandra_test.go +++ b/testing/internal/e2e/tests/base/target_tcp_connect_cassandra_test.go @@ -120,8 +120,11 @@ func TestCliTcpTargetConnectCassandra(t *testing.T) { output := buf.String() t.Logf("Cassandra session output: %s", output) - require.Contains(t, output, "keyspace_name") - require.Contains(t, output, keyspace) + // Note: Additional assertions can be tricky due to output containing \r\n + // and \b characters. The following assertions should be sufficient to prove + // that commands were executed successfully + require.Contains(t, output, "system_schema") // output of DESCRIBE KEYSPACES + require.Contains(t, output, "(1 rows)") // output of SELECT query t.Log("Successfully connected to Cassandra target") }