Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions .github/actions/cpp-bazel/pre-merge/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ description: C++ pre-merge testing github iggy actions

inputs:
task:
description: "Task to run (lint, build, test, e2e)"
description: "Task to run (lint, build, test)"
required: true

runs:
Expand Down Expand Up @@ -73,33 +73,26 @@ runs:
cd foreign/cpp
bazel build --config=ci //:iggy-cpp

- name: Test
- name: Setup server for tests
if: inputs.task == 'test'
shell: bash
run: |
cd foreign/cpp
bazel test --config=ci //:unit

- name: Setup server for e2e tests
if: inputs.task == 'e2e'
uses: ./.github/actions/utils/server-start
with:
cargo-bin: iggy-server

- name: Run e2e tests
if: inputs.task == 'e2e'
- name: Test
if: inputs.task == 'test'
shell: bash
run: |
cd foreign/cpp
bazel test --config=ci //:e2e
bazel test --config=ci //...

- name: Stop server after e2e tests
if: always() && inputs.task == 'e2e'
- name: Stop server after tests
if: always() && inputs.task == 'test'
uses: ./.github/actions/utils/server-stop

- name: Validate task
if: inputs.task != 'lint' && inputs.task != 'build' && inputs.task != 'test' && inputs.task != 'e2e'
if: inputs.task != 'lint' && inputs.task != 'build' && inputs.task != 'test'
shell: bash
run: |
echo "::error::Unsupported task '${{ inputs.task }}'. Expected one of: lint, build, test, e2e."
echo "::error::Unsupported task '${{ inputs.task }}'. Expected one of: lint, build, test."
exit 1
2 changes: 1 addition & 1 deletion .github/config/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ components:
- "ci-infrastructure"
paths:
- "foreign/cpp/**"
tasks: ["lint", "build", "test", "e2e"]
tasks: ["lint", "build", "test"]

# Shared BDD infrastructure that affects all BDD tests
bdd-infrastructure:
Expand Down
5 changes: 4 additions & 1 deletion bdd/cpp/features/step_definitions/background_steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <cstdlib>
#include <string>
#include <utility>

#include "world.hpp"

Expand All @@ -44,7 +45,9 @@ GIVEN("^I have a running Iggy server$") {
// Empty address makes the SDK fall back to its default TCP endpoint; in CI the address
// is supplied via IGGY_TCP_ADDRESS (e.g. iggy-server:8090).
const std::string address = env_or("IGGY_TCP_ADDRESS", "");
iggy::ffi::Client *client = iggy::ffi::new_connection(address);
iggy::ffi::IggyClientConfig config{};
config.server_address = address;
iggy::ffi::Client *client = iggy::ffi::new_connection(std::move(config));
ASSERT_NE(client, nullptr);
context->client = client;
context->client->connect();
Expand Down
18 changes: 9 additions & 9 deletions bdd/cpp/features/step_definitions/messaging_steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ WHEN("^I create a topic with name \"([^\"]{1,255})\" in stream ([0-9]+) with ([0
// Drive the SDK through the typed helpers in iggy.hpp rather than raw strings. Options that
// still take plain strings below (partitioning kind, consumer kind) mark where the C++ SDK
// does not yet expose a typed wrapper.
const auto compression = iggy::CompressionAlgorithm::none();
const auto message_expiry = iggy::Expiry::never_expire();
const auto max_topic_size = iggy::MaxTopicSize::server_default();
const auto compression = iggy::CompressionAlgorithm::None();
const auto message_expiry = iggy::Expiry::NeverExpire();
const auto max_topic_size = iggy::MaxTopicSize::ServerDefault();

context->client->create_topic(bdd::make_numeric_identifier(static_cast<std::uint32_t>(stream_id)), topic_name,
static_cast<std::uint32_t>(partitions_count),
std::string(compression.compression_algorithm_value()),
std::string(message_expiry.expiry_kind()), message_expiry.expiry_value(),
std::string(max_topic_size.max_topic_size()), {});
std::string(compression.CompressionAlgorithmValue()),
std::string(message_expiry.ExpiryKind()), message_expiry.ExpiryValue(),
std::string(max_topic_size.MaxTopicSizeValue()), {});
}

THEN("^the topic should be created successfully$") {
Expand Down Expand Up @@ -146,12 +146,12 @@ WHEN("^I poll messages from stream ([0-9]+), topic ([0-9]+), partition ([0-9]+)
REGEX_PARAM(int, offset);
cucumber::ScenarioScope<bdd::GlobalContext> context;

const auto polling_strategy = iggy::PollingStrategy::offset(static_cast<std::uint64_t>(offset));
const auto polling_strategy = iggy::PollingStrategy::Offset(static_cast<std::uint64_t>(offset));
const auto polled = context->client->poll_messages(
bdd::make_numeric_identifier(static_cast<std::uint32_t>(stream_id)),
bdd::make_numeric_identifier(static_cast<std::uint32_t>(topic_id)), static_cast<std::uint32_t>(partition_id),
"consumer", bdd::make_numeric_identifier(1), std::string(polling_strategy.polling_strategy_kind()),
polling_strategy.polling_strategy_value(), 100, false);
"consumer", bdd::make_numeric_identifier(1), std::string(polling_strategy.PollingStrategyKind()),
polling_strategy.PollingStrategyValue(), 100, false);

context->polled.count = polled.count;
context->polled.offsets.clear();
Expand Down
5 changes: 4 additions & 1 deletion foreign/cpp/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
# Enable BzlMod
common --enable_bzlmod

# Default test behavior
test --test_output=errors
test --cache_test_results=no

# Debug configuration
build:debug --compilation_mode=dbg
build:debug --copt=-g3
Expand All @@ -44,5 +48,4 @@ build:ci --config=release
build:ci --lockfile_mode=error

test:ci --lockfile_mode=error
test:ci --test_output=errors
test:ci --test_summary=detailed
Loading
Loading