Add Comprehensive Testing Suite: Integration and E2E Tests for the current implementation#16
Open
ThisaraWeerakoon wants to merge 1 commit intoapache:mainfrom
Open
Add Comprehensive Testing Suite: Integration and E2E Tests for the current implementation#16ThisaraWeerakoon wants to merge 1 commit intoapache:mainfrom
ThisaraWeerakoon wants to merge 1 commit intoapache:mainfrom
Conversation
… and E2E test suites Major Changes: - Add complete integration test suite for CallMediator with HTTP server testing - Add end-to-end test suite for Synapse application lifecycle management - Add file inbound integration tests for component-level validation - Add shared test utilities and helper functions for reusable test components - Update Makefile with proper test targets for different test categories New Files Added: - internal/pkg/core/artifacts/call_mediator_endpoint_integration_test.go (353 lines) * Integration tests for HTTP endpoint calls with real servers * Concurrent call testing and timeout handling * Error scenario validation with actual network operations - internal/app/synapse/synapse_e2e_test.go (497 lines) * End-to-end application lifecycle testing * Configuration validation and deployment simulation * Concurrent operations and graceful shutdown testing - internal/app/adapters/inbound/file/file_inbound_integration_test.go (467 lines) * Integration tests for file system and message processing * JSON/XML file processing with real file operations * Error handling and concurrent file processing validation - internal/pkg/testutils/helpers.go (328 lines) * Shared test utilities, mocks, and data generators * Mock HTTP servers and test context builders * Performance timing utilities and JSON validation helpers Makefile Updates: - Add test-integration, test-e2e, test-all targets for organized test execution - Remove test-coverage and test-coverage-html targets (simplified) - Support for build tag-based test categorization Test Organization: - Unit tests: Default execution with no build tags - Integration tests: //go:build integration tag for component integration - E2E tests: //go:build e2e tag for full application workflows The testing infrastructure follows Go best practices with proper build tag separation, co-located test placement, and comprehensive coverage of unit, integration, and end-to-end testing scenarios. All tests pass successfully and can be executed individually or in combination.
Contributor
|
@isudana, shall we add GitHub Copilot as a reviewer to this repo? |
| msgContext.Headers["PROCESSING_TIME"] = time.Now().Format(time.RFC3339) | ||
|
|
||
| // Verify message context integration | ||
| suite.Equal(filename, msgContext.Headers["FILE_NAME"]) |
Contributor
There was a problem hiding this comment.
What is the purpose of this assertion?
We are setting the header in L433 and asserting it here.
Shouldn't we just provide the filepath to mediation, let it process and assert the message context created by the actual functions we have in Synapse?
| processCount int | ||
| } | ||
|
|
||
| func (m *MockMediator) ProcessMessage(ctx context.Context, msgContext *synctx.MsgContext) error { |
Contributor
There was a problem hiding this comment.
We are testing the functionality of this mock function in the test cases.
Shouldn't we test the actual function we have in the inbound endpoint?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses SYNAPSE-1132
Description
This PR introduces an end-to-end (E2E) testing suite for the current implementation. While the existing unit tests cover basic functionality, the codebase currently lacks component-level integration testing for key features like the File Inbound and Call Mediator, as well as full E2E testing for the Synapse server. This PR addresses that gap by adding targeted integration tests and E2E scenarios to ensure robustness and reliability.
Additionally, this PR includes shared test utilities that can be reused by future developers to simplify writing new tests. I've used build tags to separate unit, integration, and E2E tests, and adopted a co-located approach for organizing test files alongside the relevant implementation code.
Key Changes
The main additions in this PR are summarized below:
Call Mediator Tests
Purpose: Tests HTTP endpoint integration with real network operations.
Coverage:
File Inbound Tests
Purpose: Component-level file processing integration.
Coverage:
Shared Test Utilities
Purpose: Reusable test components and mocks.
Features:
Synapse Application E2E Tests
Purpose: End-to-end application lifecycle testing.
Coverage:
Testing Instructions
go test ./...(excludes integration/E2E via build tags)go test -tags=integration ./...go test -tags=e2e ./...This PR improves test coverage and maintainability without introducing breaking changes to the core functionality. Feedback welcome!