limitations under the License.
*/
+/*
+ * This source code is part of the near-RT RIC (RAN Intelligent Controller)
+ * platform project (RICP).
+*/
+
#include <gtest/gtest.h>
#include "private/error.hpp"
#include "private/redis/asyncredisstorage.hpp"
expectSetIfNotExistsAsync("key1", { 0x0a, 0x0b, 0x0c });
expectPollWait();
expectModifyIfAck(std::error_code(), true);
- EXPECT_EQ(true, syncStorage->setIfNotExists(ns, "key1", { 0x0a, 0x0b, 0x0c }));
+ EXPECT_TRUE(syncStorage->setIfNotExists(ns, "key1", { 0x0a, 0x0b, 0x0c }));
}
TEST_F(SyncStorageImplTest, SetIfNotExistsReturnsFalseIfKeyAlreadyExists)
expectSetIfNotExistsAsync("key1", { 0x0a, 0x0b, 0x0c });
expectPollWait();
expectModifyIfAck(std::error_code(), false);
- EXPECT_EQ(false, syncStorage->setIfNotExists(ns, "key1", { 0x0a, 0x0b, 0x0c }));
+ EXPECT_FALSE(syncStorage->setIfNotExists(ns, "key1", { 0x0a, 0x0b, 0x0c }));
}
TEST_F(SyncStorageImplTest, SetIfNotExistsCanThrowBackendError)
expectRemoveIfAsync("key1", { 0x0a, 0x0b, 0x0c });
expectPollWait();
expectModifyIfAck(std::error_code(), true);
- EXPECT_EQ(true, syncStorage->removeIf(ns, "key1", { 0x0a, 0x0b, 0x0c }));
+ EXPECT_TRUE(syncStorage->removeIf(ns, "key1", { 0x0a, 0x0b, 0x0c }));
}
TEST_F(SyncStorageImplTest, RemoveIfReturnsFalseIfKeyDoesnotMatch)
expectRemoveIfAsync("key1", { 0x0a, 0x0b, 0x0c });
expectPollWait();
expectModifyIfAck(std::error_code(), false);
- EXPECT_EQ(false, syncStorage->removeIf(ns, "key1", { 0x0a, 0x0b, 0x0c }));
+ EXPECT_FALSE(syncStorage->removeIf(ns, "key1", { 0x0a, 0x0b, 0x0c }));
}
TEST_F(SyncStorageImplTest, RemoveIfCanThrowBackendError)
expectModifyIfAck(aec, false);
EXPECT_THROW(syncStorage->setIfNotExists(ns, "key1", { 0x0a, 0x0b, 0x0c }), BackendError);
break;
+ case AsyncRedisCommandDispatcherErrorCode::WRITING_TO_SLAVE:
+ expectModifyIfAck(aec, false);
+ EXPECT_THROW(syncStorage->setIfNotExists(ns, "key1", { 0x0a, 0x0b, 0x0c }), BackendError);
+ break;
default:
FAIL() << "No mapping for AsyncRedisCommandDispatcherErrorCode value: " << aec;
break;