Skip to content

Conversation

@rossnelson
Copy link
Member

  • Added table-driven tests for NewConsumer, SetLogger, SetConnector,
    SetStrategy, SetDLQHandler, SetProcessor, Setup, IsRunning, Stop,
    and Validate functions.
  • Used testify's assert package for matchers to avoid if statements.
  • Included mock implementations for Logger, Connector, Strategy,
    and DLQHandler.

- Added table-driven tests for NewConsumer, SetLogger, SetConnector,
  SetStrategy, SetDLQHandler, SetProcessor, Setup, IsRunning, Stop,
  and Validate functions.
- Used testify's assert package for matchers to avoid if statements.
- Included mock implementations for Logger, Connector, Strategy,
  and DLQHandler.
@codecov
Copy link

codecov bot commented Mar 6, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
226 1 225 0
View the top 1 failed test(s) by shortest run time
github.com/simiancreative/simiango/messaging/natsjscon TestHandleResult
Stack Traces | 0.5s run time
Failed

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

rossnelson and others added 14 commits March 7, 2025 11:45
- Added a new Cobra command to run a NATS consumer.
- Implemented the consumer setup and start logic.
- Integrated with the existing logger and connection manager.
- Added mock implementations for unit testing.
- Removed unused EnableDLQ configuration.
- Added pull-based consumer strategy for NATS JetStream
- Added NATS service configuration with TLS support
- Added certificate generation script
- Updated consumer example to use the new strategy
- Added .gitignore rule for certificate files
…integration

- Add publisher command to simian-go CLI for publishing test messages to NATS
- Fix circuit breaker logger to use configured logger instead of global
- Update NATS consumer interface to require Debugf method
- Add debug logging to message acknowledgement
- Improve consumer example to properly process messages
- Integrated circuit breaker into PullStrategy to handle message
  consumption failures.
- Added circuit breaker configuration to PullStrategy's Config struct.
- Implemented circuit breaker checks and recording in the Consume method.
- Updated consumer example to include circuit breaker initialization.
Properly capture and propagate the exit code from go test to ensure GitHub Actions fails when tests fail, while still generating junit reports.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Ensure pull strategy can reconnect when the connection manager loses and recreates its connection. Previously, the strategy would fail to recover when the JetStream object was recreated.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Moved consumer creation logic to a new `createConsumer` method
- Updated `Setup` and `ensureConsumerActive` methods to use `createConsumer`
- Added new `connection` package for shared connection management
- Refactored `consumer` package to use shared connection and modularized setup
- Improved logging in `processor` function
- Replaced inline mock dependencies with reusable mock dependencies
  from conmock package.
- Updated tests in natsjscon_test.go to use new mock dependencies.
- Added new tests for natsjsstrategypull package.
- Created new mock implementations for jetstream.Consumer and other
  interfaces in natsjscm package.
- Refactored existing mocks to follow a consistent naming convention.
- Implemented MockMessageBatch to mock MessageBatch interface.
- Added NewMockMessageBatch constructor to create mock instances.
- Updated NewDependencies to include MockMessageBatch.
- Modified TestConsume to use MockMessageBatch for testing.
- Removed locking in the Stop method of Consumer to prevent deadlocks.
- Added a test case to ensure Stop method does not panic.
- Added tests to validate Consumer configuration in natsjscon package.
- Ensured tests cover invalid processor, connector, stream name, consumer
  name, and subject.
- Updated Dependencies.NewConsumer to accept optional ConsumerConfig.
- Replace ReconnectHandler with DisconnectHandler in ConnectionManager
- Remove handleReconnect method and inline JetStream context creation
- Change Processor and ConsumptionStrategy to use channels for messages
- Update tests and mocks to reflect new message handling approach
- Add default case in handleResult to log unknown process status
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.

2 participants