Skip to content

Add unit tests for Karaf features#516

Merged
asfgit merged 4 commits intoapache:masterfrom
googlielmo:feature/test-karaf-features
Apr 10, 2017
Merged

Add unit tests for Karaf features#516
asfgit merged 4 commits intoapache:masterfrom
googlielmo:feature/test-karaf-features

Conversation

@googlielmo
Copy link
Copy Markdown
Contributor

@googlielmo googlielmo commented Jan 13, 2017

Add pax exam unit tests to brooklyn server / karaf.

Currently, the unit tests check that the Karaf features load correctly.

@geomacy
Copy link
Copy Markdown
Contributor

geomacy commented Jan 13, 2017

hi @googlielmo do you know there are pax exam tests for karaf in brooklyn-dist? If I recall correctly, the tests are there because they are testing the whole of brooklyn (not just brooklyn-server).

@googlielmo
Copy link
Copy Markdown
Contributor Author

hi @geomacy, yes I'm aware of that; as these are actually unit tests (not integration tests), the idea is to test the brooklyn-server features at every build, to spot regressions early on, especially in view of a simplification of dependencies (which is another effort going on in parallel). These being local tests, I think they can co-exist with the broader ones in dist. Wdyt?

@geomacy
Copy link
Copy Markdown
Contributor

geomacy commented Jan 13, 2017

@googlielmo I guess that seems sensible, just wondered if you knew about them. thanks

@googlielmo
Copy link
Copy Markdown
Contributor Author

I should have clarified the (somewhat limited) scope of this PR in the first place, thank you for giving me the occasion to do it @geomacy 🙂

@googlielmo googlielmo force-pushed the feature/test-karaf-features branch 2 times, most recently from 333f1b3 to 0371e50 Compare February 9, 2017 14:58
@googlielmo googlielmo changed the title [WIP] Feature/test karaf features Add unit tests for Karaf features Feb 9, 2017
@googlielmo
Copy link
Copy Markdown
Contributor Author

Rebased on master (not squashed)

<pax.exam.version>4.9.1</pax.exam.version>
<pax-url.version>2.5.2</pax-url.version>
<servlet.api.version>3.1.0</servlet.api.version>
<validation.api.version>1.1.0.Final</validation.api.version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you move these to the parent pom

<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
<version>1.3</version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be parameterised

-->
<!-- TODO use ServiceMix bundle for okhttp when dependency on okio is fixed there -->
<bundle dependency="true">wrap:mvn:com.squareup.okhttp/okhttp/2.2.0$Import-Package=org.apache.http.*;resolution:=optional,android.util.*;resolution:=optional,okio;version=%27[1.2.0,1.3.0)%27,*</bundle>
<bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okhttp/2.2.0_2</bundle>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you explain your reasoning for this ... I remember there being an issue with the servicemix wrapped version

Also version should be parameterised

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.

Hi @m4rkmckenna servicemix accepted my pull request apache/servicemix-bundles#91 so it's safe to use their version now!

@googlielmo
Copy link
Copy Markdown
Contributor Author

Thanks for the comments @m4rkmckenna. Will address them with a new commit.

Copy link
Copy Markdown
Member

@m4rkmckenna m4rkmckenna left a comment

Choose a reason for hiding this comment

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

Overall I can see value in having this ... but currently only tests if a feature installs correctly.

I would like to see some more assertions made on the health of the brooklyn kernel. ie Does the feature install cause a wave of bundle restarts

<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-atinject_1.0_spec</artifactId>
<version>1.0</version>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be parameterise

@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class FeatureInstallationTest extends TestBase {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you comment on how this differs from the verify phase of the karaf-maven-plugin

(Differentiator to karaf-maven-plugin) Should we be performing some sort of assertion after feature install?

ie can we establish the health of the karaf / brooklyn kernel?

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.

Had a look at this with @andreaturli who wrote the first unit tests in this PR.
It's fair to say that at the moment this is quite similar to the verify phase of the karaf-maven-plugin, especially as we're using the PerClass Exam reactor strategy.
At the same time, yes we can add more tests / assertions to check the health of karaf / brooklyn, good point! Will add some.

@aledsage
Copy link
Copy Markdown
Contributor

aledsage commented Mar 1, 2017

@googlielmo (cc @m4rkmckenna) given Marks' comment about seeing value in this, then I'm fine with us merging it and then iterating on it to add more assertions (as we find time to do that). That feels better than having the PR sitting around for longer. Does that sound sensible to you @m4rkmckenna?

@googlielmo can you squash your commits please, and ensure there is a nice description on the commit(s)? (We want the commits descriptions to be understandable when glancing through the history of Brooklyn commits, where we can't easily tell which PR they were in; commit messages like "wip" don't tell us what it's for).

core/pom.xml Outdated
<dependency>
<groupId>com.hierynomus</groupId>
<artifactId>sshj</artifactId>
<version>${sshj.version}</version>
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.

Do we really need this line? It's defined int he dependencyManagement section of parent/pom.xml, so we shouldn't have to repeat it here.

<servicemix.version>6.0.0</servicemix.version>
<reflections.bundle.version>0.9.9_1</reflections.bundle.version> <!-- see reflections.version -->

<maven.buildhelper.plugin.version>1.10</maven.buildhelper.plugin.version>
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.

Where is this used?

<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>

<okhttp.bundle.version>2.2.0_2</okhttp.bundle.version>
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.

I wonder where this should be defined - should it be in the root pom.xml, alongside all the other dependency versions? Or should it be here (closer to where it's used in feature.xml)? I lean towards the former. But no strong feelings.

andreaturli and others added 4 commits March 28, 2017 18:11
  - test the brooklyn-server features at every build, to spot
    regressions early on
  - Rebase PR
 - parameterise version numbers
 - remove stale TODO comment
@googlielmo googlielmo force-pushed the feature/test-karaf-features branch from dbae41d to e058ced Compare March 28, 2017 16:33
@googlielmo
Copy link
Copy Markdown
Contributor Author

@aledsage I squashed and edited the commit messages to something more useful.
If it's okay to you and @m4rkmckenna I second the idea of merging it and then iterating on it to add more assertions.

@drigodwin
Copy link
Copy Markdown
Member

I agree that we should merge this and iterate, since there have been no more comments I'm going to do that now. Thanks @googlielmo @m4rkmckenna @aledsage

@asfgit asfgit merged commit e058ced into apache:master Apr 10, 2017
asfgit pushed a commit that referenced this pull request Apr 10, 2017
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.

7 participants