These queries rely on LWTs and also return the existing data in the response, which is different to regular INSERTs which return nothing.
As such, they are a potential edge case where bugs could exist.
We should add integration tests to cover `IF NOT EXISTS when used directly on native types as well as when used on lists, sets and maps.
I suggest implementing a new function insert_if_not_exists in each of the following files and call that files insert_if_not_exists after the insert function, here:
|
insert(session).await; |
|
select(session).await; |
|
run_query(session, "DROP KEYSPACE test_native_types_keyspace").await; |
|
pub async fn test(connection: &CassandraConnection, driver: CassandraDriver) { |
|
create(connection).await; |
|
insert(connection).await; |
|
select(connection, driver).await; |
|
} |
|
pub async fn test(connection: &CassandraConnection, driver: CassandraDriver) { |
|
create(connection).await; |
|
insert(connection).await; |
|
select(connection, driver).await; |
|
} |
|
pub async fn test(connection: &CassandraConnection) { |
|
create(connection).await; |
|
insert(connection).await; |
|
select(connection).await; |
|
} |
|
pub async fn test(connection: &CassandraConnection, driver: CassandraDriver) { |
|
create(connection).await; |
|
insert(connection).await; |
|
select(connection, driver).await; |
|
} |
These queries rely on LWTs and also return the existing data in the response, which is different to regular
INSERTs which return nothing.As such, they are a potential edge case where bugs could exist.
We should add integration tests to cover `IF NOT EXISTS when used directly on native types as well as when used on lists, sets and maps.
I suggest implementing a new function
insert_if_not_existsin each of the following files and call that filesinsert_if_not_existsafter theinsertfunction, here:shotover-proxy/shotover-proxy/tests/cassandra_int_tests/native_types.rs
Lines 119 to 121 in d316e8b
shotover-proxy/shotover-proxy/tests/cassandra_int_tests/collections/list.rs
Lines 94 to 98 in d316e8b
shotover-proxy/shotover-proxy/tests/cassandra_int_tests/collections/set.rs
Lines 78 to 82 in d316e8b
shotover-proxy/shotover-proxy/tests/cassandra_int_tests/collections/vector.rs
Lines 43 to 47 in d316e8b
shotover-proxy/shotover-proxy/tests/cassandra_int_tests/collections/map.rs
Lines 118 to 122 in d316e8b