blob: 16af7af03026a0ec089b9bab40744eaf9ccf243c [file]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include <cstdint>
#include <limits>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <gtest/gtest.h>
#include "iggy.hpp"
TEST(ConnectionStringTest, ConstructsQuicClient) {
iggy::ffi::Client *client = nullptr;
ASSERT_NO_THROW({ client = iggy::ffi::from_connection_string("iggy+quic://iggy:iggy@127.0.0.1:8080"); });
ASSERT_NE(client, nullptr);
iggy::ffi::delete_client(client);
}
TEST(CompressionAlgorithmTest, ReturnsExpectedValues) {
EXPECT_EQ(iggy::CompressionAlgorithm::None().Value(), "none");
EXPECT_EQ(iggy::CompressionAlgorithm::Gzip().Value(), "gzip");
}
TEST(SnapshotCompressionTest, ReturnsExpectedValues) {
EXPECT_EQ(iggy::SnapshotCompression::Stored().Value(), "stored");
EXPECT_EQ(iggy::SnapshotCompression::Deflated().Value(), "deflated");
EXPECT_EQ(iggy::SnapshotCompression::Bzip2().Value(), "bzip2");
EXPECT_EQ(iggy::SnapshotCompression::Zstd().Value(), "zstd");
EXPECT_EQ(iggy::SnapshotCompression::Lzma().Value(), "lzma");
EXPECT_EQ(iggy::SnapshotCompression::Xz().Value(), "xz");
}
TEST(SystemSnapshotTypeTest, ReturnsExpectedValues) {
EXPECT_EQ(iggy::SystemSnapshotType::FilesystemOverview().SnapshotTypeValue(), "filesystem_overview");
EXPECT_EQ(iggy::SystemSnapshotType::ProcessList().SnapshotTypeValue(), "process_list");
EXPECT_EQ(iggy::SystemSnapshotType::ResourceUsage().SnapshotTypeValue(), "resource_usage");
EXPECT_EQ(iggy::SystemSnapshotType::Test().SnapshotTypeValue(), "test");
EXPECT_EQ(iggy::SystemSnapshotType::ServerLogs().SnapshotTypeValue(), "server_logs");
EXPECT_EQ(iggy::SystemSnapshotType::ServerConfig().SnapshotTypeValue(), "server_config");
EXPECT_EQ(iggy::SystemSnapshotType::All().SnapshotTypeValue(), "all");
}
TEST(MaxTopicSizeTest, ReturnsExpectedValues) {
EXPECT_EQ(iggy::MaxTopicSize::ServerDefault().Value(), "server_default");
EXPECT_EQ(iggy::MaxTopicSize::Unlimited().Value(), "unlimited");
EXPECT_EQ(iggy::MaxTopicSize::FromBytes(0).Value(), "server_default");
EXPECT_EQ(iggy::MaxTopicSize::FromBytes(std::numeric_limits<std::uint64_t>::max()).Value(), "unlimited");
EXPECT_EQ(iggy::MaxTopicSize::FromBytes(1024).Value(), "1024");
}
TEST(PollingStrategyTest, ReturnsExpectedKindAndValue) {
const auto offset = iggy::PollingStrategy::Offset(7);
EXPECT_EQ(offset.Kind(), "offset");
EXPECT_EQ(offset.Value(), 7u);
const auto timestamp = iggy::PollingStrategy::Timestamp(42);
EXPECT_EQ(timestamp.Kind(), "timestamp");
EXPECT_EQ(timestamp.Value(), 42u);
const auto first = iggy::PollingStrategy::First();
EXPECT_EQ(first.Kind(), "first");
EXPECT_EQ(first.Value(), 0u);
const auto last = iggy::PollingStrategy::Last();
EXPECT_EQ(last.Kind(), "last");
EXPECT_EQ(last.Value(), 0u);
const auto next = iggy::PollingStrategy::Next();
EXPECT_EQ(next.Kind(), "next");
EXPECT_EQ(next.Value(), 0u);
}
TEST(ExpiryTest, ReturnsExpectedKindAndValue) {
const auto server_default = iggy::Expiry::ServerDefault();
EXPECT_EQ(server_default.Kind(), "server_default");
EXPECT_EQ(server_default.Value(), static_cast<std::uint64_t>(0));
const auto never_expire = iggy::Expiry::NeverExpire();
EXPECT_EQ(never_expire.Kind(), "never_expire");
EXPECT_EQ(never_expire.Value(), std::numeric_limits<std::uint64_t>::max());
const auto duration = iggy::Expiry::Duration(15);
EXPECT_EQ(duration.Kind(), "duration");
EXPECT_EQ(duration.Value(), static_cast<std::uint64_t>(15));
EXPECT_THROW(iggy::Expiry::Duration(0), std::invalid_argument);
}
TEST(TopicCreateOptionsTest, DefaultHasNoValues) {
const iggy::TopicCreateOptions options;
EXPECT_FALSE(options.PartitionsCount().has_value());
EXPECT_FALSE(options.CompressionAlgorithm().has_value());
EXPECT_FALSE(options.MessageExpiry().has_value());
EXPECT_FALSE(options.MaxTopicSize().has_value());
EXPECT_FALSE(options.SegmentSize().has_value());
EXPECT_FALSE(options.Durability().has_value());
EXPECT_FALSE(options.ConsumerOffsetDurability().has_value());
EXPECT_FALSE(options.MessagesRequiredToSave().has_value());
EXPECT_FALSE(options.SizeOfMessagesRequiredToSave().has_value());
EXPECT_FALSE(options.PreallocateSegments().has_value());
EXPECT_TRUE(options.RawEntries().empty());
}
TEST(TopicCreateOptionsTest, PartitionsCountStoresValue) {
iggy::TopicCreateOptions options;
options.SetPartitionsCount(3);
ASSERT_TRUE(options.PartitionsCount().has_value());
EXPECT_EQ(*options.PartitionsCount(), 3u);
options.SetPartitionsCount(1000);
EXPECT_EQ(*options.PartitionsCount(), 1000u);
}
TEST(TopicCreateOptionsTest, SegmentSizeStoresValue) {
iggy::TopicCreateOptions options;
options.SetSegmentSize(0x0102030405060708ULL);
ASSERT_TRUE(options.SegmentSize().has_value());
EXPECT_EQ(*options.SegmentSize(), 0x0102030405060708ULL);
}
TEST(TopicCreateOptionsTest, DurabilityStoresPolicy) {
iggy::TopicCreateOptions persisted;
persisted.SetDurability(iggy::Durability::Persisted);
ASSERT_TRUE(persisted.Durability().has_value());
EXPECT_EQ(*persisted.Durability(), iggy::Durability::Persisted);
iggy::TopicCreateOptions replicated;
replicated.SetDurability(iggy::Durability::Replicated);
ASSERT_TRUE(replicated.Durability().has_value());
EXPECT_EQ(*replicated.Durability(), iggy::Durability::Replicated);
iggy::TopicCreateOptions offset;
offset.SetConsumerOffsetDurability(iggy::Durability::Persisted);
ASSERT_TRUE(offset.ConsumerOffsetDurability().has_value());
EXPECT_EQ(*offset.ConsumerOffsetDurability(), iggy::Durability::Persisted);
}
TEST(TopicCreateOptionsTest, MessagesRequiredToSaveStoresValue) {
iggy::TopicCreateOptions options;
options.SetMessagesRequiredToSave(0x01020304U);
ASSERT_TRUE(options.MessagesRequiredToSave().has_value());
EXPECT_EQ(*options.MessagesRequiredToSave(), 0x01020304U);
}
TEST(TopicCreateOptionsTest, SizeOfMessagesRequiredToSaveStoresValue) {
iggy::TopicCreateOptions options;
options.SetSizeOfMessagesRequiredToSave(1024ULL * 1024ULL);
ASSERT_TRUE(options.SizeOfMessagesRequiredToSave().has_value());
EXPECT_EQ(*options.SizeOfMessagesRequiredToSave(), 1024ULL * 1024ULL);
}
TEST(TopicCreateOptionsTest, PreallocateSegmentsStoresBool) {
iggy::TopicCreateOptions enabled;
enabled.SetPreallocateSegments(true);
ASSERT_TRUE(enabled.PreallocateSegments().has_value());
EXPECT_EQ(*enabled.PreallocateSegments(), true);
iggy::TopicCreateOptions disabled;
disabled.SetPreallocateSegments(false);
ASSERT_TRUE(disabled.PreallocateSegments().has_value());
EXPECT_EQ(*disabled.PreallocateSegments(), false);
}
TEST(TopicCreateOptionsTest, MaximumValuesPreserved) {
iggy::TopicCreateOptions options;
options.SetSegmentSize(std::numeric_limits<std::uint64_t>::max());
ASSERT_TRUE(options.SegmentSize().has_value());
EXPECT_EQ(*options.SegmentSize(), std::numeric_limits<std::uint64_t>::max());
options.SetMessagesRequiredToSave(std::numeric_limits<std::uint32_t>::max());
ASSERT_TRUE(options.MessagesRequiredToSave().has_value());
EXPECT_EQ(*options.MessagesRequiredToSave(), std::numeric_limits<std::uint32_t>::max());
options.SetSizeOfMessagesRequiredToSave(std::numeric_limits<std::uint64_t>::max());
ASSERT_TRUE(options.SizeOfMessagesRequiredToSave().has_value());
EXPECT_EQ(*options.SizeOfMessagesRequiredToSave(), std::numeric_limits<std::uint64_t>::max());
}
TEST(TopicCreateOptionsTest, ChainingAndOverwrite) {
iggy::TopicCreateOptions options;
options.SetSegmentSize(1024).SetDurability(iggy::Durability::Persisted).SetMessagesRequiredToSave(512);
EXPECT_EQ(*options.SegmentSize(), 1024ULL);
EXPECT_EQ(*options.Durability(), iggy::Durability::Persisted);
EXPECT_EQ(*options.MessagesRequiredToSave(), 512u);
options.SetSegmentSize(2048);
EXPECT_EQ(*options.SegmentSize(), 2048ULL);
}
TEST(TopicCreateOptionsTest, CompressionAlgorithmAndExpiryAndMaxTopicSize) {
iggy::TopicCreateOptions options;
options.SetCompressionAlgorithm(iggy::CompressionAlgorithm::Gzip())
.SetMessageExpiry(iggy::Expiry::Duration(15))
.SetMaxTopicSize(iggy::MaxTopicSize::FromBytes(1024));
ASSERT_TRUE(options.CompressionAlgorithm().has_value());
EXPECT_EQ(options.CompressionAlgorithm()->Value(), "gzip");
ASSERT_TRUE(options.MessageExpiry().has_value());
EXPECT_EQ(options.MessageExpiry()->Kind(), "duration");
EXPECT_EQ(options.MessageExpiry()->Value(), 15u);
ASSERT_TRUE(options.MaxTopicSize().has_value());
EXPECT_EQ(options.MaxTopicSize()->Value(), "1024");
}
TEST(TopicCreateOptionsTest, ServerDefaultSentinelsClearValues) {
iggy::TopicCreateOptions options;
options.SetMessageExpiry(iggy::Expiry::Duration(15)).SetMaxTopicSize(iggy::MaxTopicSize::FromBytes(1024));
ASSERT_TRUE(options.MessageExpiry().has_value());
ASSERT_TRUE(options.MaxTopicSize().has_value());
options.SetMessageExpiry(iggy::Expiry::ServerDefault()).SetMaxTopicSize(iggy::MaxTopicSize::ServerDefault());
EXPECT_FALSE(options.MessageExpiry().has_value());
EXPECT_FALSE(options.MaxTopicSize().has_value());
}
TEST(TopicCreateOptionsTest, RawMapStoresForwardCompatibleKeys) {
iggy::TopicCreateOptions options;
options.SetRawEntries({{"custom_key", "custom_value"}});
EXPECT_EQ(options.RawEntries().count("custom_key"), 1u);
EXPECT_EQ(options.RawEntries().at("custom_key"), "custom_value");
options.SetRawEntries(std::map<std::string, std::string>{{"a", "1"}, {"b", "2"}});
EXPECT_EQ(options.RawEntries().size(), 3u);
EXPECT_EQ(options.RawEntries().at("a"), "1");
}
TEST(TopicCreateOptionsTest, RawMapReplacesDuplicateKeys) {
iggy::TopicCreateOptions options;
const std::map<std::string, std::string> first_entries{{"message_expiry", "7 days"}};
const std::map<std::string, std::string> second_entries{{"message_expiry", "1 day"}};
options.SetRawEntries(first_entries).SetRawEntries(second_entries);
EXPECT_EQ(options.RawEntries().at("message_expiry"), "1 day");
}
TEST(TopicCreateOptionsTest, RawMapReplacesDuplicateKeysWhenMoved) {
iggy::TopicCreateOptions options;
std::map<std::string, std::string> first_entries{{"message_expiry", "7 days"}};
std::map<std::string, std::string> second_entries{{"message_expiry", "1 day"}};
options.SetRawEntries(std::move(first_entries)).SetRawEntries(std::move(second_entries));
EXPECT_EQ(options.RawEntries().at("message_expiry"), "1 day");
}
TEST(TopicUpdateOptionsTest, DefaultHasNoValues) {
const iggy::TopicUpdateOptions options;
EXPECT_FALSE(options.CompressionAlgorithm().has_value());
EXPECT_FALSE(options.MessageExpiry().has_value());
EXPECT_FALSE(options.MaxTopicSize().has_value());
EXPECT_TRUE(options.RawEntries().empty());
}
TEST(TopicUpdateOptionsTest, StoresUpdatableFields) {
iggy::TopicUpdateOptions options;
options.SetCompressionAlgorithm(iggy::CompressionAlgorithm::Gzip())
.SetMessageExpiry(iggy::Expiry::NeverExpire())
.SetMaxTopicSize(iggy::MaxTopicSize::Unlimited());
ASSERT_TRUE(options.CompressionAlgorithm().has_value());
EXPECT_EQ(options.CompressionAlgorithm()->Value(), "gzip");
ASSERT_TRUE(options.MessageExpiry().has_value());
EXPECT_EQ(options.MessageExpiry()->Kind(), "never_expire");
ASSERT_TRUE(options.MaxTopicSize().has_value());
EXPECT_EQ(options.MaxTopicSize()->Value(), "unlimited");
}
TEST(TopicUpdateOptionsTest, ServerDefaultSentinelsClearValues) {
iggy::TopicUpdateOptions options;
options.SetMessageExpiry(iggy::Expiry::Duration(15)).SetMaxTopicSize(iggy::MaxTopicSize::FromBytes(1024));
ASSERT_TRUE(options.MessageExpiry().has_value());
ASSERT_TRUE(options.MaxTopicSize().has_value());
options.SetMessageExpiry(iggy::Expiry::ServerDefault()).SetMaxTopicSize(iggy::MaxTopicSize::ServerDefault());
EXPECT_FALSE(options.MessageExpiry().has_value());
EXPECT_FALSE(options.MaxTopicSize().has_value());
}
TEST(TopicUpdateOptionsTest, RawMapStoresKeys) {
iggy::TopicUpdateOptions options;
options.SetRawEntries({{"message_expiry", "7 days"}});
EXPECT_EQ(options.RawEntries().count("message_expiry"), 1u);
options.SetRawEntries(std::map<std::string, std::string>{{"compression_algorithm", "gzip"}});
EXPECT_EQ(options.RawEntries().size(), 2u);
}
TEST(TopicUpdateOptionsTest, RawMapReplacesDuplicateKeys) {
iggy::TopicUpdateOptions options;
const std::map<std::string, std::string> first_entries{{"message_expiry", "7 days"}};
const std::map<std::string, std::string> second_entries{{"message_expiry", "1 day"}};
std::map<std::string, std::string> third_entries{{"message_expiry", "7 days"}};
std::map<std::string, std::string> fourth_entries{{"message_expiry", "1 day"}};
options.SetRawEntries(first_entries).SetRawEntries(second_entries);
EXPECT_EQ(options.RawEntries().at("message_expiry"), "1 day");
options.SetRawEntries(std::move(third_entries)).SetRawEntries(std::move(fourth_entries));
EXPECT_EQ(options.RawEntries().at("message_expiry"), "1 day");
}
TEST(StreamUpdateOptionsTest, RawMapStoresKeys) {
iggy::StreamUpdateOptions options;
EXPECT_TRUE(options.RawEntries().empty());
options.SetRawEntries({{"future_key", "future_value"}});
EXPECT_EQ(options.RawEntries().count("future_key"), 1u);
EXPECT_EQ(options.RawEntries().at("future_key"), "future_value");
}
TEST(StreamUpdateOptionsTest, RawMapReplacesDuplicateKeys) {
iggy::StreamUpdateOptions options;
std::map<std::string, std::string> first_entries{{"future_key", "first_value"}};
std::map<std::string, std::string> second_entries{{"future_key", "second_value"}};
const std::map<std::string, std::string> third_entries{{"future_key", "first_value"}};
const std::map<std::string, std::string> fourth_entries{{"future_key", "second_value"}};
options.SetRawEntries(std::move(first_entries)).SetRawEntries(std::move(second_entries));
EXPECT_EQ(options.RawEntries().at("future_key"), "second_value");
options.SetRawEntries(third_entries).SetRawEntries(fourth_entries);
EXPECT_EQ(options.RawEntries().at("future_key"), "second_value");
}
TEST(IggyExceptionTest, StoresMessage) {
const iggy::IggyException from_cstr("boom");
EXPECT_EQ(std::string(from_cstr.what()), "boom");
const std::string message = "boom2";
const iggy::IggyException from_string(message);
EXPECT_EQ(std::string(from_string.what()), message);
}
TEST(IggyBlockingClientTest, MovedFromOperationsThrow) {
auto client = iggy::IggyBlockingClient::Builder().Build();
auto moved_to = std::move(client);
(void)moved_to;
const auto stream = iggy::Identifier::String("stream");
const auto topic = iggy::Identifier::String("topic");
const auto group = iggy::Identifier::String("group");
const auto consumer = iggy::Consumer::Single(iggy::Identifier::Numeric(1));
// Exercising the moved-from guard requires invoking every operation on the valid but empty source object.
EXPECT_THROW(client.Connect(), iggy::IggyException);
EXPECT_THROW(client.Disconnect(), iggy::IggyException);
EXPECT_THROW(client.Shutdown(), iggy::IggyException);
EXPECT_THROW(client.Login("iggy", "iggy"), iggy::IggyException);
EXPECT_THROW(client.Logout(), iggy::IggyException);
EXPECT_THROW((void)client.GetUser(stream), iggy::IggyException);
EXPECT_THROW((void)client.GetUsers(), iggy::IggyException);
EXPECT_THROW((void)client.CreateUser("user", "secret123", iggy::UserStatus::Active), iggy::IggyException);
EXPECT_THROW(client.DeleteUser(stream), iggy::IggyException);
EXPECT_THROW(client.UpdateUser(stream, "updated-user", iggy::UserStatus::Active, iggy::UserUpdateOptions{}),
iggy::IggyException);
EXPECT_THROW(client.CreateStream("stream"), iggy::IggyException);
EXPECT_THROW(client.UpdateStream(stream, "updated-stream"), iggy::IggyException);
EXPECT_THROW(client.GetStreams(), iggy::IggyException);
EXPECT_THROW(client.GetStream(stream), iggy::IggyException);
EXPECT_THROW(client.DeleteStream(stream), iggy::IggyException);
EXPECT_THROW(client.PurgeStream(stream), iggy::IggyException);
EXPECT_THROW(client.CreateTopic(stream, "topic", iggy::TopicCreateOptions().SetPartitionsCount(1)),
iggy::IggyException);
EXPECT_THROW(client.UpdateTopic(stream, topic, "updated-topic"), iggy::IggyException);
EXPECT_THROW(client.GetTopics(stream), iggy::IggyException);
EXPECT_THROW(client.GetTopic(stream, topic), iggy::IggyException);
EXPECT_THROW(client.DeleteTopic(stream, topic), iggy::IggyException);
EXPECT_THROW(client.PurgeTopic(stream, topic), iggy::IggyException);
EXPECT_THROW(client.CreatePartitions(stream, topic, 1), iggy::IggyException);
EXPECT_THROW(client.DeletePartitions(stream, topic, 1), iggy::IggyException);
EXPECT_THROW(client.DeleteSegments(stream, topic, 0, 1), iggy::IggyException);
EXPECT_THROW(client.CreateConsumerGroup(stream, topic, "group"), iggy::IggyException);
EXPECT_THROW(client.GetConsumerGroup(stream, topic, group), iggy::IggyException);
EXPECT_THROW(client.GetConsumerGroups(stream, topic), iggy::IggyException);
EXPECT_THROW(client.DeleteConsumerGroup(stream, topic, group), iggy::IggyException);
EXPECT_THROW(client.JoinConsumerGroup(stream, topic, group), iggy::IggyException);
EXPECT_THROW(client.LeaveConsumerGroup(stream, topic, group), iggy::IggyException);
EXPECT_THROW(client.StoreConsumerOffset(consumer, stream, topic, 0, 0), iggy::IggyException);
EXPECT_THROW(client.GetConsumerOffset(consumer, stream, topic, 0), iggy::IggyException);
EXPECT_THROW(client.DeleteConsumerOffset(consumer, stream, topic, 0), iggy::IggyException);
EXPECT_THROW(client.FlushUnsavedBuffer(stream, topic, 0, true), iggy::IggyException);
EXPECT_THROW((void)client.GetStats(), iggy::IggyException);
EXPECT_THROW((void)client.GetMe(), iggy::IggyException);
EXPECT_THROW((void)client.GetClient(1), iggy::IggyException);
EXPECT_THROW((void)client.GetClients(), iggy::IggyException);
}
TEST(IggyBlockingClientTest, ConsumerOffsetOperationsRejectMaximumPartitionId) {
auto client = iggy::IggyBlockingClient::Builder().Build();
const auto stream = iggy::Identifier::String("stream");
const auto topic = iggy::Identifier::String("topic");
const auto consumer = iggy::Consumer::Single(iggy::Identifier::Numeric(1));
const auto maximum_partition = std::numeric_limits<std::uint32_t>::max();
const auto expect_rejection = [](auto &&operation) {
try {
operation();
FAIL() << "Expected the maximum std::uint32_t partition_id to be rejected";
} catch (const iggy::IggyException &error) {
EXPECT_STREQ(error.what(), "partition_id cannot be the maximum std::uint32_t value");
}
};
expect_rejection([&] { client.StoreConsumerOffset(consumer, stream, topic, maximum_partition, 0); });
expect_rejection([&] { (void)client.GetConsumerOffset(consumer, stream, topic, maximum_partition); });
expect_rejection([&] { client.DeleteConsumerOffset(consumer, stream, topic, maximum_partition); });
}
TEST(AutoLoginKindTest, HasStableDiscriminantsAndZeroInitializedDefault) {
EXPECT_EQ(static_cast<std::uint8_t>(iggy::ffi::AutoLoginKind::Disabled), 0u);
EXPECT_EQ(static_cast<std::uint8_t>(iggy::ffi::AutoLoginKind::UsernamePassword), 1u);
EXPECT_EQ(static_cast<std::uint8_t>(iggy::ffi::AutoLoginKind::PersonalAccessToken), 2u);
const iggy::ffi::IggyClientConfig config{};
EXPECT_EQ(config.auto_login_kind, iggy::ffi::AutoLoginKind::Disabled);
}
TEST(IggyBlockingClientBuilderTest, BuildsWithEachAutoLoginKind) {
EXPECT_NO_THROW((void)iggy::IggyBlockingClient::Builder().Build());
EXPECT_NO_THROW((void)iggy::IggyBlockingClient::Builder().WithAutoLogin("iggy", "iggy").Build());
EXPECT_NO_THROW((void)iggy::IggyBlockingClient::Builder().WithPersonalAccessToken("token").Build());
}
TEST(IggyBlockingClientBuilderTest, RejectsEmptyServerAddress) {
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithServerAddress(""), iggy::IggyException);
}
TEST(IggyBlockingClientBuilderTest, RejectsEmptyAutoLoginCredentials) {
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithAutoLogin("", "password"), iggy::IggyException);
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithAutoLogin("username", ""), iggy::IggyException);
}
TEST(IggyBlockingClientBuilderTest, RejectsEmptyPersonalAccessToken) {
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithPersonalAccessToken(""), iggy::IggyException);
}
TEST(IggyBlockingClientBuilderTest, RejectsTlsDomainWhenTlsIsDisabled) {
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithTlsDomain("localhost").Build(), iggy::IggyException);
}
TEST(IggyBlockingClientBuilderTest, RejectsTlsCaFileWhenTlsIsDisabled) {
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithTlsCaFile("ca.pem").Build(), iggy::IggyException);
}
TEST(IggyBlockingClientBuilderTest, RejectsTlsValidationWhenTlsIsDisabled) {
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithTlsCertificateValidation().Build(), iggy::IggyException);
}
TEST(IggyBlockingClientBuilderTest, RejectsEmptyTlsSettings) {
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithTlsDomain(""), iggy::IggyException);
EXPECT_THROW((void)iggy::IggyBlockingClient::Builder().WithTlsCaFile(""), iggy::IggyException);
}