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

Cleaner integration tests #489

Merged
merged 70 commits into from
Jul 12, 2019
Merged

Cleaner integration tests #489

merged 70 commits into from
Jul 12, 2019

Conversation

wblachowski
Copy link
Contributor

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 and CamelContextCreator to inject different camel context configuration during testing and normal execution.

Motivation and Context

Refers to enhancement brought up in #441

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • I have reviewed (and updated if needed) the documentation regarding this change

I hereby agree to the terms of the AET Contributor License Agreement.

@plutasnyy
Copy link
Contributor

Good job!

@@ -33,6 +33,22 @@
<name>AET :: Core :: Cleaner</name>
<description>Cleaner responsible for removing outdated AET artifacts from datastorage</description>

<dependencyManagement>
<dependencies>
<dependency>
Copy link
Contributor

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>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done 😉

</parent>

<artifactId>cleaner-test</artifactId>
<packaging>jar</packaging>
Copy link
Contributor

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.

Copy link
Contributor

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 {
Copy link
Contributor

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?

Copy link
Contributor

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

@tkaik tkaik merged commit 41cba3e into master Jul 12, 2019
@tkaik tkaik deleted the feature/cleaner-integration-test branch July 12, 2019 08:20
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.

4 participants