Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTTP SendMessage tests #17

Merged
merged 2 commits into from
Sep 10, 2024
Merged
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
100 changes: 64 additions & 36 deletions Iggy_SDK_Tests/E2ETests/SendMessagesE2E.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,52 +38,80 @@ public SendMessagesE2E(IggySendMessagesFixture fixture)
_invalidMessageWithHeadersSendRequest = MessageFactory.CreateMessageSendRequest(SendMessagesFixtureBootstrap.InvalidStreamId,
SendMessagesFixtureBootstrap.InvalidTopicId, SendMessagesFixtureBootstrap.PartitionId, messageWithHeaders);
}

[Fact(Skip = SkipMessage), TestPriority(1)]
[Fact, TestPriority(1)]
public async Task SendMessages_NoHeaders_Should_SendMessages_Successfully()
{
var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
{
await sut.Invoking(x => x.SendMessagesAsync(_messageNoHeadersSendRequest))
.Should()
.NotThrowAsync();
})).ToArray();
await Task.WhenAll(tasks);
// act & assert
await _fixture.HttpSut.Invoking(y => y.SendMessagesAsync(_messageNoHeadersSendRequest))
.Should()
.NotThrowAsync();

// TODO: This code block is commmented bacause TCP implementation is not working properly.
// var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
// {
// await sut.Invoking(x => x.SendMessagesAsync(_messageNoHeadersSendRequest))
// .Should()
// .NotThrowAsync();
// })).ToArray();
//
// await Task.WhenAll(tasks);
}

[Fact(Skip = SkipMessage), TestPriority(2)]
[Fact, TestPriority(2)]
public async Task SendMessages_NoHeaders_Should_Throw_InvalidResponse()
{
var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
{
await sut.Invoking(x => x.SendMessagesAsync(_invalidMessageNoHeadersSendRequest))
.Should()
.ThrowAsync<InvalidResponseException>();
})).ToArray();
await Task.WhenAll(tasks);
// act & assert
await _fixture.HttpSut.Invoking(y => y.SendMessagesAsync(_invalidMessageNoHeadersSendRequest))
.Should()
.ThrowAsync<InvalidResponseException>();

// TODO: This code block is commmented bacause TCP implementation is not working properly.
// var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
// {
// await sut.Invoking(x => x.SendMessagesAsync(_invalidMessageNoHeadersSendRequest))
// .Should()
// .ThrowAsync<InvalidResponseException>();
// })).ToArray();
//
// await Task.WhenAll(tasks);
}

[Fact(Skip = SkipMessage), TestPriority(3)]
[Fact, TestPriority(3)]
public async Task SendMessages_WithHeaders_Should_SendMessages_Successfully()
{
var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
{
await sut.Invoking(x => x.SendMessagesAsync(_messageWithHeadersSendRequest))
.Should()
.NotThrowAsync();
})).ToArray();
await Task.WhenAll(tasks);
// act & assert
await _fixture.HttpSut.Invoking(y => y.SendMessagesAsync(_messageWithHeadersSendRequest))
.Should()
.NotThrowAsync();

// TODO: This code block is commmented bacause TCP implementation is not working properly.
// var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
// {
// await sut.Invoking(x => x.SendMessagesAsync(_messageWithHeadersSendRequest))
// .Should()
// .NotThrowAsync();
// })).ToArray();
//
// await Task.WhenAll(tasks);
}

[Fact(Skip = SkipMessage), TestPriority(4)]
[Fact, TestPriority(4)]
public async Task SendMessages_WithHeaders_Should_Throw_InvalidResponse()
{
var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
{
await sut.Invoking(x => x.SendMessagesAsync(_invalidMessageWithHeadersSendRequest))
.Should()
.ThrowAsync<InvalidResponseException>();
})).ToArray();
await Task.WhenAll(tasks);
// act & assert
await _fixture.HttpSut.Invoking(y => y.SendMessagesAsync(_invalidMessageWithHeadersSendRequest))
.Should()
.ThrowAsync<InvalidResponseException>();

// TODO: This code block is commmented bacause TCP implementation is not working properly.
// var tasks = _fixture.SubjectsUnderTest.Select(sut => Task.Run(async () =>
// {
// await sut.Invoking(x => x.SendMessagesAsync(_invalidMessageWithHeadersSendRequest))
// .Should()
// .ThrowAsync<InvalidResponseException>();
// })).ToArray();
//
// await Task.WhenAll(tasks);
}
}
Loading