Skip to content

Add integration tests for Cassandra INSERT .. IF NOT EXISTS queries #1927

Description

@rukai

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;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions