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 e19c5472f9)

# Conflicts:
#	.github/workflows/enos-run.yml

Co-authored-by: Michael Li <michael.li@hashicorp.com>
pull/6742/head
hc-github-team-secure-boundary 3 weeks ago committed by GitHub
parent 41a6768aa4
commit 23c293b784
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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

@ -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")
}

Loading…
Cancel
Save