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

Add Akka.Streams.Kafka.Testkit to support other specs #263

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Arkatufus
Copy link
Contributor

No description provided.


namespace Akka.Streams.Kafka.Testkit.Dsl
{
public static class ConsumerControlFactory
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper functions for consumer controls


namespace Akka.Streams.Kafka.Testkit
{
public static class Extensions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from Kafka.Test


namespace Akka.Streams.Kafka.Testkit.Fixture
{
public abstract class FixtureBase: IAsyncLifetime
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified Fixture so that it is flexible enough to support multi-broker cluster


namespace Akka.Streams.Kafka.Testkit
{
public class MessageSinkLogger : ILoggingAdapter, IDisposable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ILoggingAdapter for Xunit IMessageSink

/// Specialized deserializer for MemberAssignment.
/// C# AdminClient returns raw bytes that needs to be deserialized into a proper object
/// </summary>
public class MemberAssignment
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dotnet Kafka admin client does not deserialize MemberAssignment struct, need to make a custom deserializer for it.

{
public static class BinaryUtils
{
public static short ReadInt16BE(this BinaryReader reader)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper functions to deserialize big-endian bytes, no support in dotnet

@@ -31,8 +32,8 @@ public BugFix240SupervisionStrategy(ITestOutputHelper output, KafkaFixture fixtu
[Fact]
public async Task SupervisionStrategy_Decider_on_Producer_Upstream_should_work()
{
var topic = CreateTopic(1);
var group = CreateGroup(1);
var topic = CreateTopicName(1);
Copy link
Contributor Author

@Arkatufus Arkatufus Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these changes in the test classes are cosmetic, making sure that the names are more in step with its intent, creating a topic name and group id, instead vague topic and group which can also means actual topic and group

namespace Akka.Streams.Kafka.Tests
{
[CollectionDefinition(Name)]
public sealed class KafkaSpecsFixture : ICollectionFixture<KafkaFixture>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection fixture moved here, separated from the testkit


namespace Akka.Streams.Kafka.Tests
{
public sealed class RepeatAttribute : DataAttribute
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper attribute for Xunit theory, used to repeat a test X numbers of times, useful for testing racy tests

TimeSpan eosCommitInterval,
IImmutableDictionary<string, string> properties,
Func<ProducerSettings<TKey, TValue>, Task<ProducerSettings<TKey, TValue>>> enrichAsync,
Func<ProducerSettings<TKey, TValue>, IProducer<TKey, TValue>> producerFactory,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added EnrichAsync (not implemented yet) and ProducerFactory

@Arkatufus
Copy link
Contributor Author

All the changes to the *Test.cs are cosmetic changes, old tests are still using the old KafkaIntegrationTest base class. New ported tests should use the new KafkaSpec base class. The new abstracted fixture should allow for testing multi-broker kafka cluster.

Whats missing compared to the JVM implementation is fixture readiness check, they have methods to make sure that the brokers/cluster are ready before starting their test. Dotnet client does not have some of the admin features needed to query these states and the new fixture need to be enhanced with script injection to do these tests right in the container instances themselves.

@Aaronontheweb
Copy link
Member

This is all meant to be internal right? Not for distribution to users?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants