Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
xxhZs committed Jun 28, 2024
1 parent 1981e4d commit e4143c8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ci/scripts/e2e-cassandra-sink-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ export CQLSH_PORT=9042
./cqlsh --request-timeout=20 -e "CREATE KEYSPACE demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};use demo;
CREATE table demo_bhv_table(v1 int primary key,v2 smallint,v3 bigint,v4 float,v5 double,v6 text,v7 date,v8 timestamp,v9 boolean);"

./cqlsh --request-timeout=20 -e "CREATE table test_uppercase(\"TEST_V1\" int primary key, \"TEST_V2\" int,\"TEST_V3\" int);"

echo "--- testing sinks"
cd ../../
sqllogictest -p 4566 -d dev './e2e_test/sink/cassandra_sink.slt'
sleep 1
cd apache-cassandra-4.1.3/bin
./cqlsh --request-timeout=20 -e "COPY demo.demo_bhv_table TO './query_result.csv' WITH HEADER = false AND ENCODING = 'UTF-8';"
./cqlsh --request-timeout=20 -e "COPY demo.test_uppercase TO './query_result2.csv' WITH HEADER = false AND ENCODING = 'UTF-8';"

if cat ./query_result.csv | awk -F "," '{
exit !($1 == 1 && $2 == 1 && $3 == 1 && $4 == 1.1 && $5 == 1.2 && $6 == "test" && $7 == "2013-01-01" && $8 == "2013-01-01 01:01:01.000+0000" && $9 == "False\r"); }'; then
Expand All @@ -68,6 +71,16 @@ else
exit 1
fi

if cat ./query_result2.csv | awk -F "," '{
exit !($1 == 1 && $2 == 1 && $3 == 1); }'; then
echo "Cassandra sink check passed"
else
echo "The output is not as expected."
echo "output:"
cat ./query_result.csv
exit 1
fi

echo "--- Kill cluster"
cd ../../
risedev ci-kill
30 changes: 29 additions & 1 deletion e2e_test/sink/cassandra_sink.slt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,39 @@ INSERT INTO t6 VALUES (1, 1, 1, 1.1, 1.2, 'test', '2013-01-01', '2013-01-01 01:0
statement ok
FLUSH;

statement ok
CREATE TABLE t7 ("TEST_V1" int primary key, "TEST_V1" int, "TEST_V1" int);

statement ok
CREATE SINK s7
FROM
test_uppercase WITH (
connector = 'cassandra',
type = 'append-only',
force_append_only='true',
cassandra.url = 'cassandra-server:9042',
cassandra.keyspace = 'demo',
cassandra.table = 'test_uppercase',
cassandra.datacenter = 'datacenter1',
);

statement ok
INSERT INTO t7 VALUES (1, 1, 1);

statement ok
FLUSH;

statement ok
DROP SINK s6;

statement ok
DROP MATERIALIZED VIEW mv6;

statement ok
DROP TABLE t6;
DROP TABLE t6;

statement ok
DROP SINK s7;

statement ok
DROP TABLE t7;

0 comments on commit e4143c8

Please sign in to comment.