-
Notifications
You must be signed in to change notification settings - Fork 49
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
Cleaner integration tests #489
Conversation
# Conflicts: # CHANGELOG.md # core/cleaner/src/test/java/com/cognifide/aet/cleaner/processors/filters/SuiteRemoveConditionTest.java
Good job! |
core/cleaner/pom.xml
Outdated
@@ -33,6 +33,22 @@ | |||
<name>AET :: Core :: Cleaner</name> | |||
<description>Cleaner responsible for removing outdated AET artifacts from datastorage</description> | |||
|
|||
<dependencyManagement> | |||
<dependencies> | |||
<dependency> |
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.
If those are dependencies only for tests then we should probably add<scope>test</scope>
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.
done 😉
…' into feature/cleaner-integration-test
…e/cleaner-integration-test
…e/cleaner-integration-test
</parent> | ||
|
||
<artifactId>cleaner-test</artifactId> | ||
<packaging>jar</packaging> |
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.
Wy do we need jar
distribution of this module?
It is only for tests.
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.
Yes, if we set it to pom
then the tests are not being compiled or executed
import org.apache.commons.io.FileUtils; | ||
import org.bson.Document; | ||
|
||
public class InMemoryDB { |
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.
Shouldn't all files in this module be in src/test
?
Why do we need any of the code to be non-test?
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.
You're right, I moved all files to src/test
Added cleaner integration tests as suggested in #441
Description
My solution uses a mocked osgi context as well as in-memory mock of mongoDB server. It checks various combinations of cleaner params (versions to keep and suite max age) and verifies whether correct metadata and artifacts documents have been removed from database.
For testing data I used real json objects extracted from my local aet instance db after a couple of runs (with some timestamp changes).
To make testing possible I had to incorporate some changes in cleaner code. This includes
LocalDateTimeProvider
interface to mock current system time andCamelContextCreator
to inject different camel context configuration during testing and normal execution.Motivation and Context
Refers to enhancement brought up in #441
Types of changes
Checklist:
I hereby agree to the terms of the AET Contributor License Agreement.