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
Clean the test logs #2606
Merged
Merged
Clean the test logs #2606
Conversation
This file contains 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
Adjust the log levels to: - WARN for the pooled directory - WARN for the MessageHandlerRegistrar - ERROR for the DefaultConfigurer #enhancement/shorten-build-logs
Whether a TEP or PSEP is fast enough to invoke the openStream method is not fixed. Hence, sometimes the tests receive a NullPointerException and sometimes they do not. We should make the sources global fields and return a mocked BlockingStream. #enhancement/shorten-build-logs
Set XStreamSerializer to ensure a safe variant is used. #enhancement/shorten-build-logs
Resolve warnings #enhancement/shorten-build-logs
Set LoggingCallback log level to ERROR #enhancement/shorten-build-logs
The test usesDuplicateCommandHandlerResolver() validating duplicate handler resolution is taken care off, causes the message to log for all other test cases. Hence, the global bus can be configured to not log at all. #enhancement/shorten-build-logs
Ensure test does not throw exception into the logs. To that end, we should not interrupt, and adjust the gateway to expect a TimeoutException. While touching the file, resolve warnings. #enhancement/shorten-build-logs
Clear test classes of warnings and indentation inconsistencies #enhancement/shorten-build-logs
Expand on logger configuration to not pollute test and build logs #enhancement/shorten-build-logs
Align logger configurations, to follow the paradigm of axon-messaging #enhancement/shorten-build-logs
- Rename 'em' to 'entityManager' for clarity - Make the EntityManagerFactory a field, to be able to close it after a test - Adjust the persistence unit name to be very specific for this test - Move the properties to the persistence.xml #enhancement/shorten-build-logs
Replace the mock StreamableMessageSource and BlockingStream, for an actual EventStore using the in-memory EventStorageEngine. For whatever reason, the current version of Mockito caused this approach to fail with OutOfMemory errors during a Maven test run, and only during a Maven test run. As the fact it is a mock or an EmbeddedEventStore instance makes no difference for test, we should switch this. #enhancement/shorten-build-logs
Fine tune logging configuration by setting the GlobalMetricRegistry log level to WARN #enhancement/shorten-build-logs
Add properties to disable AxonServer and the SpringBoot banner #enhancement/shorten-build-logs
Add log4j2.properties to fine tune test logging #enhancement/shorten-build-logs
Fine tune logging configuration by: - Adding the LoggingCallback on ERROR level - Adding the AbstractEventStore on ERROR level - Adding the AbstractSnapshotter on ERROR level - Adding the Test Container specifics on ERROR level #enhancement/shorten-build-logs
Fine tune logging configuration by: - Adding the AbstractEventStore on ERROR level - Adding the SimpleQueryUpdateEmitter on OFF level - Adding the SimpleDeadlineManager on OFF level - Adding the axonserver-connector-java on WARN level - Adding the JobRunr on WARN level - Adding the Test Container on WARN and OFF level - Adjust the TrackingEventProcessor from ERROR to OFF #enhancement/shorten-build-logs
Clarify log line to be part of the test case. While touching the file, resolve some warnings #enhancement/shorten-build-logs
Ignore the onErrorDropped default logging hook, as it does not benefit this test case. Be sure to revert this setting after the test runs. #enhancement/shorten-build-logs
- QueryEventHandlingTest.java is not clear enough. Rename this class to ProjectorTest - Disable auto-configurer module loading, since that will disable the automatic connection of Axon Server and thus clean the logs #enhancement/shorten-build-logs
Set a no-op ListenerInvocationErrorHandler i.o. the LoggingErrorHandler to minimize the amount of logs #enhancement/shorten-build-logs
Fine tune logging configuration by: - Adding the LoggingDuplicateCommandHandlerResolver on ERROR level - Adding the Test Container specifics on the levels ERROR and OFF #enhancement/shorten-build-logs
Remove the logger, as it was only used during test case construction. #enhancement/shorten-build-logs
Fine tune logging configuration by: - Adding the ChainingConverter on OFF level - Adding the AbstractSnapshotter on ERROR level - Adding the SpringAxonAutoConfigurer on ERROR level - Adding the SpringBeanParameterResolverFactory on ERROR level - Adding mchange-v2 name space on WARN level - Add Test Container specific levels to ERROR and OFF #enhancement/shorten-build-logs
- Replace addressbook for axontext in the JDBC URL - Rename the persistence unit to AxonSpringTest - Set the persistence unit provider to HibernatePersistenceProvider - Set the name of the MyAggregate entity to "myAggregate" as otherwise a dollar sign is used to reference the parent and inner class combination. Hibernate doesn't like that. #enhancement/shorten-build-logs
- Move PlatformService to the utils packages. This is more inline with the desired package structuring. - Extract the ContextInterceptor from the StubServer and place under utils. This is pre-work to reuse the interceptor. - Use the ContextInterceptor in the DummyMessagePlatformServer. This ensures we no longer receive NPE on health monitoring messages #enhancement/shorten-build-logs
Fine tune logging configuration by: - Adding the AbstractEventStore on ERROR level - Adding the AbstractAxonServerChannel on WARN level - Adding the AxonServerConnectionFactory on ERROR level - Adding the ControlChannelImpl on WARN level - Adding the CommandChannelImpl on WARN level - Adding the HeartbeatMonitor on WARN level - Adding the AxonServerManagedChannel on ERROR level - Adding the QueryChannelImpl on WARN level - Add Test Container specific levels to ERROR and OFF #enhancement/shorten-build-logs
Disable Axon Server when it is not needed for the tests, as this will minimize the logs greatly #enhancement/shorten-build-logs
Fine tune logging configuration by: - Adding the pooled package on WARN level - Adding the AxonServerConnectionManager on ERROR level - Adding the AxonServerConnectionFactory on ERROR level - Adding the ControlChannelImpl on WARN level - Adding the HeartbeatMonitor on WARN level - Adding the AxonServerManagedChannel on WARN level - Adding org.axonframework.springboot.autoconfig on WARN level - Adding org.axonframework.springboot.util on ERROR level - Adding the SagaCustomizeIntegrationTest on WARN level - Adding the AnnotationMBeanExporter on WARN level - Adding the AnnotationConfigApplicationContext on ERROR level #enhancement/shorten-build-logs
Remove logger used for test validation #enhancement/shorten-build-logs
Several of the tests require the existence of a connection to what they expect to be Axon Server. Although we can set up a test container for this, doing so will lengthen the tests quite some. Especially since the only required operation to work, is registering a client. Hence, we can copy the stub solutions present in the axonserver-connector module, and fine tune them for these tests. To not get clashes in port numbers between closing server instances, the TcpUtils is also reused, setting a system property for the entire test class (and clearing it afterwards). While add it, adjust some of the tests to use the ApplicationContextRunner approach, streamlining the test cases. #enhancement/shorten-build-logs
Fine tune logging configuration by: - Adding the DefaultCommandGateway on ERROR level - Adding the AbstractEventStore on ERROR level - Adding the pooled package on WARN level - Adding the DeadLetteredEventProcessingTask on ERROR level - Adding the org.axonframework.messaging.deadletter on WARN level - Adding the org.axonframework.eventhandling.deadletter on WARN level - Adding AxonServerConnectionManager on ERROR level - Adding AxonServerConnectionFactory on WARN level - Adding ControlChannelImpl on WARN level - Adding HeartbeatMonitor on WARN level - Adding AxonServerManagedChannel on WARN level - Adding org.axonframework.springboot.autoconfig on WARN level - Adding org.axonframework.springboot.util on ERROR level - Adding the SagaCustomizeIntegrationTest on WARN level - Adding the SagaCustomizeIntegrationTest on WARN level - Adding the TrackingEventProcessorIntegrationTest on WARN level - Adding the com.zaxxer.hikari package on WARN level - Adding the "SQL dialect" on WARN level - Adding the org.springframework.data package on WARN level - Add Test Container specific levels to ERROR and OFF #enhancement/shorten-build-logs
Fine tune logging configuration by adding the AnnotationMBeanExporter on WARN level #enhancement/shorten-build-logs
Fine tune logging configuration by adding the JdbcSagaStore on ERROR level #enhancement/shorten-build-logs
Fine tune logging configuration by adding the DeepEqualsMatcher on ERROR level #enhancement/shorten-build-logs
Remove stack trace printing #enhancement/shorten-build-logs
smcvb
added
Type: Enhancement
Use to signal an issue enhances an already existing feature of the project.
Priority 3: Could
Low priority. Issues that are nice to have but have a straightforward workaround.
Status: In Progress
Use to signal this issue is actively worked on.
labels
Feb 15, 2023
Fix all jdbc urls to axontest i.o. addressbook #2606
Move test specific log settings to the bottom #2606
Better specify log configuration for AF SpringBoot #2606
Rename persistence unit to something test specific #2606
Remove disabled annotation from tests #2606
Drop usage of old Sping xml config. The axon-messaging/db-context.xml still anticipated a persistence unit name of "eventStore". Although we can fix the xml I think it's smarter to move to the annotation based configuration. #2606
Switch JDBC URL to point to axontest i.o. address-book #2606
Switch persistence unit name to "AxonSpringTest" i.o. ""eventStore" #2606
Switch persistence unit name to "integrationtest" i.o. ""eventStore" #2606
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
gklijs
approved these changes
Feb 21, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, might even have made the build a bit faster.
smcvb
added
Status: Resolved
Use to signal that work on this issue is done.
and removed
Status: In Progress
Use to signal this issue is actively worked on.
labels
Feb 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Priority 3: Could
Low priority. Issues that are nice to have but have a straightforward workaround.
Status: Resolved
Use to signal that work on this issue is done.
Type: Enhancement
Use to signal an issue enhances an already existing feature of the project.
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.
This pull request aims to ensure a test run of the Axon Framework project does not flood you with logs.
To ensure this, numerous adjustments have been made:
log4j2.properties
files have been adjusted to be stricter on specific classes and sometimes packages, regarding what's logged and what's not during a test run. While touching these property files, properties logically belonging to one another have been grouped under a comment (e.g., command specific configuration is placed under# Commands
).printf
/println
/etc methods to print out text used for test case validation. These are leftovers from when the test was built, so have been removed.persistence.xml
have been revamped to, in all cases, use a unique persistence unit name, reflecting the test or tests they're used in. Furthermore, mentions ofaddressbook
in thehibernate.connection.url
have been replaced foraxontest
.StubServer
andPlatformService
from the axonserver-connector module, although they're revamped to only allow the client registration.Here are a couple of specific adjustments in this pull request worth mentioning:
ContextInterceptor
of theStubServer
in theaxonserver-connector
module is now reused for both the Event and Command dummy platform service during testing. Doing so, we ensure the heartbeat monitoring log messages do not error out.EventProcessingModuleTest
used mockStreamableMessageSources
, which sometimes caused exceptions depending on the speed of the TEP or PSEP within the test. To completely eliminate this predicament, these tests now use a spiedEmbeddedEventStore
using theInMemoryEventStorageEngine
.persistence.xml
now doesdrop-and-create
instead ofcreate
. This ensures we are not flooded with SQL execution exceptions because the tables already exist.ApplicationContextRunner
. Doing so, these tests are aligned with the desired Spring Boot test format.ListenerInvocationErrorHandler
to ensure theLoggingErrorHandler
does not kick in during tests.Lastly, I resolved warnings and other issues whenever I touched test classes directly.