Skip to content

Commit

Permalink
Increase message count in end2end test
Browse files Browse the repository at this point in the history
  • Loading branch information
numinnex committed Oct 18, 2023
1 parent b69471b commit 06f8cf6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Iggy_SDK_Tests.E2ETests.Fixtures.Tcp;

public sealed class IggyTcpFetchMessagesFixture : IAsyncLifetime
{
private readonly IContainer _container = new ContainerBuilder().WithImage("iggyrs/iggy:latest")
public readonly IContainer _container = new ContainerBuilder().WithImage("iggyrs/iggy:latest")
//.WithPortBinding(3000, true)
.WithPortBinding(8090, true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(8090))
Expand Down Expand Up @@ -65,11 +65,11 @@ await sut.LoginUser(new LoginUserRequest

var request = MessageFactory.CreateMessageSendRequest(
StreamRequest.StreamId, TopicRequest.TopicId, PartitionId,
MessageFactory.GenerateMessages(20));
MessageFactory.GenerateMessages(1000000));

var requestWithHeaders = MessageFactory.CreateMessageSendRequest(
StreamRequest.StreamId, HeadersTopicRequest.TopicId, PartitionId,
MessageFactory.GenerateMessages(20, MessageFactory.GenerateMessageHeaders(6)));
MessageFactory.GenerateMessages(1000000, MessageFactory.GenerateMessageHeaders(6)));
await sut.SendMessagesAsync(request);
await sut.SendMessagesAsync(requestWithHeaders);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Iggy_SDK_Tests.E2ETests.Fixtures.Tcp;

public sealed class IggyTcpPollMessagesFixture : IAsyncLifetime
{
private readonly IContainer _container = new ContainerBuilder().WithImage("iggyrs/iggy:latest")
public readonly IContainer _container = new ContainerBuilder().WithImage("iggyrs/iggy:latest")
//.WithPortBinding(3000, true)
.WithPortBinding(8090, true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(8090))
Expand All @@ -29,7 +29,7 @@ public sealed class IggyTcpPollMessagesFixture : IAsyncLifetime
private static readonly StreamRequest StreamRequest = StreamFactory.CreateStreamRequest();
private static readonly TopicRequest TopicRequest = TopicFactory.CreateTopicRequest();
private static readonly TopicRequest HeadersTopicRequest = TopicFactory.CreateTopicRequest();
public const int MessageCount = 1000;
public const int MessageCount = 1000000;

public readonly int StreamId = StreamRequest.StreamId;
public readonly int TopicId = TopicRequest.TopicId;
Expand Down Expand Up @@ -82,7 +82,7 @@ await sut.SendMessagesAsync(new MessageSendRequest<DummyMessage>
},
MessageFactory.Serializer,
headers: MessageFactory.GenerateMessageHeaders(HeadersCount));
//await Task.Delay(2500);
await Task.Delay(2500);
}

public async Task DisposeAsync()
Expand Down
20 changes: 17 additions & 3 deletions Iggy_SDK_Tests/E2ETests/Messaging/FetchMessagesE2ETcp.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using DotNet.Testcontainers.Builders;
using FluentAssertions;
using Iggy_SDK.Contracts.Http;
using Iggy_SDK.Enums;
Expand All @@ -6,6 +7,7 @@
using Iggy_SDK_Tests.Utils;
using Iggy_SDK_Tests.Utils.DummyObj;
using Iggy_SDK_Tests.Utils.Messages;
using Xunit.Abstractions;

namespace Iggy_SDK_Tests.E2ETests.Messaging;

Expand All @@ -21,16 +23,18 @@ public FetchMessagesE2ETcp(IggyTcpFetchMessagesFixture fixture)
{
_fixture = fixture;
_messageFetchRequest =
MessageFactory.CreateMessageFetchRequestConsumer(10, _fixture.StreamId, _fixture.TopicId, _fixture.PartitionId);
MessageFactory.CreateMessageFetchRequestConsumer(10000, _fixture.StreamId, _fixture.TopicId, _fixture.PartitionId);
_headersMessageFetchRequest =
MessageFactory.CreateMessageFetchRequestConsumer(10, _fixture.StreamId, _fixture.HeadersTopicId, _fixture.PartitionId);
MessageFactory.CreateMessageFetchRequestConsumer(10000, _fixture.StreamId, _fixture.HeadersTopicId, _fixture.PartitionId);
_invalidFetchRequest =
MessageFactory.CreateMessageFetchRequestConsumer(10, _fixture.InvalidStreamId, _fixture.InvalidTopicId, _fixture.PartitionId);
MessageFactory.CreateMessageFetchRequestConsumer(10000, _fixture.InvalidStreamId, _fixture.InvalidTopicId, _fixture.PartitionId);
}

[Fact, TestPriority(1)]
public async Task PollMessagesTMessage_WithNoHeaders_Should_PollMessages_Successfully()
{
var logs = await _fixture._container.GetLogsAsync();
Console.WriteLine($"{logs.Stderr} {logs.Stdout}");
var response = await _fixture.sut.FetchMessagesAsync<DummyMessage>(_messageFetchRequest, MessageFactory.DeserializeDummyMessage);
response.Messages.Count.Should().Be(10);
response.PartitionId.Should().Be(_fixture.PartitionId);
Expand All @@ -48,11 +52,15 @@ public async Task PollMessagesTMessage_Should_Throw_InvalidResponse()
await _fixture.sut.Invoking(x => x.FetchMessagesAsync(_invalidFetchRequest, MessageFactory.DeserializeDummyMessage))
.Should()
.ThrowExactlyAsync<InvalidResponseException>();
var logs = await _fixture._container.GetLogsAsync();
Console.WriteLine($"{logs.Stderr} {logs.Stdout}");
}

[Fact, TestPriority(3)]
public async Task PollMessages_WithNoHeaders_Should_PollMessages_Successfully()
{
var logs = await _fixture._container.GetLogsAsync();
Console.WriteLine($"{logs.Stderr} {logs.Stdout}");
var response = await _fixture.sut.FetchMessagesAsync(_messageFetchRequest);
response.Messages.Count.Should().Be(10);
response.PartitionId.Should().Be(_fixture.PartitionId);
Expand All @@ -70,11 +78,15 @@ public async Task PollMessages_Should_Throw_InvalidResponse()
await _fixture.sut.Invoking(x => x.FetchMessagesAsync(_invalidFetchRequest))
.Should()
.ThrowExactlyAsync<InvalidResponseException>();
var logs = await _fixture._container.GetLogsAsync();
Console.WriteLine($"{logs.Stderr} {logs.Stdout}");
}

[Fact, TestPriority(5)]
public async Task PollMessages_WithHeaders_Should_PollMessages_Successfully()
{
var logs = await _fixture._container.GetLogsAsync();
Console.WriteLine($"{logs.Stderr} {logs.Stdout}");
var response = await _fixture.sut.FetchMessagesAsync(_headersMessageFetchRequest);
response.Messages.Count.Should().Be(10);
response.PartitionId.Should().Be(_fixture.PartitionId);
Expand All @@ -90,6 +102,8 @@ public async Task PollMessages_WithHeaders_Should_PollMessages_Successfully()
[Fact, TestPriority(6)]
public async Task PollMessagesTMessage_WithHeaders_Should_PollMessages_Successfully()
{
var logs = await _fixture._container.GetLogsAsync();
Console.WriteLine($"{logs.Stderr} {logs.Stdout}");
var response = await _fixture.sut.FetchMessagesAsync(_headersMessageFetchRequest, MessageFactory.DeserializeDummyMessage);
response.Messages.Count.Should().Be(10);
response.PartitionId.Should().Be(_fixture.PartitionId);
Expand Down

0 comments on commit 06f8cf6

Please sign in to comment.