Skip to content

Cleaner integration tests#489

Merged
tkaik merged 70 commits intomasterfrom
feature/cleaner-integration-test
Jul 12, 2019
Merged

Cleaner integration tests#489
tkaik merged 70 commits intomasterfrom
feature/cleaner-integration-test

Conversation

@wblachowski
Copy link
Copy Markdown
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
Copy Markdown
Contributor

Good job!

Comment thread core/cleaner/pom.xml Outdated

<dependencyManagement>
<dependencies>
<dependency>
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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