Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyass committed Sep 18, 2024
1 parent 4379519 commit 04f4a32
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,26 @@ echo "drop database if exists test_view" | $BENDSQL_CLIENT_CONNECT
echo "CREATE DATABASE test_view" | $BENDSQL_CLIENT_CONNECT
echo "create table test_view.t(a int, b int)" | $BENDSQL_CLIENT_CONNECT

drop_view() {
create_view() {
for i in {1..20}; do
echo "DROP VIEW IF EXISTS test_view.v" | $BENDSQL_CLIENT_CONNECT
echo "CREATE OR REPLACE VIEW test_view.v as SELECT a, b FROM test_view.t" | $BENDSQL_CLIENT_CONNECT
done
}

create_view() {
drop_view() {
for i in {1..20}; do
echo "CREATE OR REPLACE VIEW test_view.v as SELECT a, b FROM test_view.t" | $BENDSQL_CLIENT_CONNECT
echo "DROP VIEW IF EXISTS test_view.v" | $BENDSQL_CLIENT_CONNECT
done
}

# Start the write and consume operations in parallel
drop_view &
drop_pid=$!
# Start the create and drop operations in parallel
create_view &
create_pid=$!
drop_view &
drop_pid=$!

# Wait for the data writing into the base table to complete
wait $drop_pid
# Wait for the final consume operation to complete
wait $create_pid
wait $drop_pid

echo "DROP VIEW IF EXISTS test_view.v" | $BENDSQL_CLIENT_CONNECT
echo "drop table test_view.t all" | $BENDSQL_CLIENT_CONNECT
Expand Down

0 comments on commit 04f4a32

Please sign in to comment.