[hibernate-dev] [OGM] Embedded MongoDB for tests

Gunnar Morling gunnar at hibernate.org
Wed Jul 10 05:06:26 EDT 2013


Hi,

In a copy of the OGM job I've added a post build step which runs
"hibernate-ogm-mongodb" and "hibernate-ogm-integrationtest-mongodb" against
an external MongoDB.

This works as expected, the only shortcoming being, that the test results
reported by Jenkins are always those created by the embedded test run part
of the main build step. So in case a test running against the external DB
fails in the post build step, the build would be marked as failed, but the
test failure wouldn't show up in the test results view. This may make
analyzing the test failure a bit more complicated.

I think the proper way of doing this kind of thing in Jenkins would be to
set up a "multi-configuration" job which builds one project applying
different configurations (here once with embedded and once with external
MongoDB). This gives you separate as well as aggregated reports and the
overall build is marked as failed as soon as one of the configurations
fails. You can see an example at [1].

Let me know which option you prefer, I'll set it up then. Personally I
think a simple post step would suffice for the beginning despite the issue
described above.

--Gunnar

[1]
http://ci.hibernate.org/view/Personal%20runs/job/gunnar-hibernate-ogm-295-mc/




2013/7/9 Sanne Grinovero <sanne at hibernate.org>

> +1
>
> We need to test it, not just for the functional aspect of our code but
> to make sure the _build_ works fine in both configurations.
> Also, I'm pretty sure the server mode and embedded mode can not
> guarantee to be using the same MongoDB version so it's possible that a
> fix made by someone is verified in one environment but breaks tests
> for other developers.. kind of things I'd better be notified about
> ASAP than on JIRA.
>
> Sanne
>
>
>
> On 9 July 2013 09:43, Gunnar Morling <gunnar at hibernate.org> wrote:
> > 2013/7/9 Emmanuel Bernard <emmanuel at hibernate.org>
> >
> >> Custom configuration is not something you would exercise for example.
> >> I'm talking about hostname, ports, the ability to forbid plain "table"
> >> scan.
> >>
> >> Gunnar's proposal for an additional slave job only running the mongodb
> >> module with the non embedded mode seems the easiest solution.
> >>
> >
> > I didn't mean to add a different job, just to add a "post build step" to
> > the existing job which basically runs
> >
> >     mvn test -DuseExternalMongoDb -pl
> > :hibernate-ogm-mongodb,:hibernate-ogm-integrationtest-mongodb
> >
> >
> >> Emmanuel
> >>
> >> On Tue 2013-07-09  9:58, Hardy Ferentschik wrote:
> >> > I just don't get the point. AFAIU the embedded version is nothing else
> >> than a downloaded mongodb,
> >> > installed in a given directory and started by the plugin. Where is the
> >> difference to a "proper"
> >> > mongodb instance? Installing MongoDB is nothing else than getting the
> >> distribution and running the
> >> > daemon. The only difference I can see is that on a production machine
> >> you would run mongodb as
> >> > a service and probably monitor it, but that is imo not relevant in
> this
> >> scenario.
> >> >
> >> > --Hardy
> >> >
> >> >
> >> > On 9 Jan 2013, at 8:36 AM, Gunnar Morling <gunnar at hibernate.org>
> wrote:
> >> >
> >> > > 2013/7/8 Sanne Grinovero <sanne at hibernate.org>
> >> > >
> >> > >> On 8 July 2013 11:08, Gunnar Morling <gunnar at hibernate.org> wrote:
> >> > >>> 2013/7/8 Sanne Grinovero <sanne at hibernate.org>
> >> > >>>>
> >> > >>>> Nice!
> >> > >>>> now a tricky question: how can I get the tests to run both with
> >> > >>>> embedded and external on CI?
> >> > >>>>
> >> > >>>> I guess I need two jobs :-(
> >> > >>>
> >> > >>>
> >> > >>> Yes, as of know, you'd need two jobs. If really needed, one could
> >> > >> probably
> >> > >>> make it run against both by configuring several surefire
> executions.
> >> > >>>
> >> > >>> But why would you want to do that? As said, AFAICS there is no
> >> functional
> >> > >>> difference between both "modes", so I think having CI run one of
> it
> >> > >> should
> >> > >>> be good enough.
> >> > >>
> >> > >> I'm sure there is no difference for the tests, but we need to make
> >> > >> sure both approaches work today and stay working: I want to test
> the
> >> > >> infrastructure code of the testsuite.
> >> > >>
> >> > >> Personally I'll likely stick to using an external MongoDB server
> so I
> >> > >> would not be able to detect if someone broke the build on the
> embedded
> >> > >> one.
> >> > >>
> >> > >
> >> > > We could add another build step to the existing CI job which only
> runs
> >> the
> >> > > tests of the "mongodb" module against an external instance.
> >> > >
> >> > > That way we would have the "it just works" experience out of the box
> >> via
> >> > > the embedded mode, and on CI it would still be ensured that both
> modes
> >> > > work. The CI job would run a bit longer, but I think that's
> acceptable
> >> and
> >> > > the set up is easier than with two separate jobs. WDYT?
> >> > >
> >> > >
> >> > >>
> >> > >> Sanne
> >> > >>
> >> > >>>
> >> > >>>
> >> > >>>>
> >> > >>>>
> >> > >>>> On 8 July 2013 11:01, Gunnar Morling <gunnar at hibernate.org>
> wrote:
> >> > >>>>> Hi,
> >> > >>>>>
> >> > >>>>> I've submitted PR #197 [1] for OGM-295.
> >> > >>>>>
> >> > >>>>> This makes the "mongodb" module part of the OGM build by
> default,
> >> > >>>>> executing
> >> > >>>>> the tests on an "embedded" MongoDB instance. "Embedded" means in
> >> this
> >> > >>>>> context, that the original distribution *.tar.gz is retrieved
> from
> >> > >>>>> mongodb.org, unpacked and an external mongodb process is
> started
> >> > >> before
> >> > >>>>> and
> >> > >>>>> stopped after test execution.
> >> > >>>>>
> >> > >>>>> To run tests alternatively against an external MongoDB
> >> installation,
> >> > >> the
> >> > >>>>> "useExternalMongoDb" property can be specified like this:
> >> > >>>>>
> >> > >>>>>    mvn clean install -DuseExternalMongoDb
> >> > >>>>>
> >> > >>>>> This will skip launching/stopping of the embedded instance and
> >> expect
> >> > >> a
> >> > >>>>> running instance on MONGODB_HOSTNAME:MONGODB_PORT as before.
> >> > >>>>>
> >> > >>>>> --Gunnar
> >> > >>>>>
> >> > >>>>> [1] https://github.com/hibernate/hibernate-ogm/pull/197
> >> > >>>>>
> >> > >>>>>
> >> > >>>>>
> >> > >>>>> 2013/7/4 Sanne Grinovero <sanne at hibernate.org>
> >> > >>>>>>
> >> > >>>>>> Thanks!
> >> > >>>>>>
> >> > >>>>>> On 4 July 2013 11:26, Gunnar Morling <gunnar at hibernate.org>
> >> wrote:
> >> > >>>>>>> Thanks, Sanne, for creating the issue. I can do that, already
> >> > >>>>>>> assigned
> >> > >>>>>>> it to
> >> > >>>>>>> me.
> >> > >>>>>>>
> >> > >>>>>>> --Gunnar
> >> > >>>>>>>
> >> > >>>>>>>
> >> > >>>>>>>
> >> > >>>>>>> 2013/7/4 Sanne Grinovero <sanne at hibernate.org>
> >> > >>>>>>>>
> >> > >>>>>>>> Created as
> >> > >>>>>>>> https://hibernate.atlassian.net/browse/OGM-295
> >> > >>>>>>>>
> >> > >>>>>>>> volunteers?
> >> > >>>>>>>>
> >> > >>>>>>>>
> >> > >>>>>>>> On 28 June 2013 10:20, Hardy Ferentschik <
> hardy at hibernate.org>
> >> > >>>>>>>> wrote:
> >> > >>>>>>>>>
> >> > >>>>>>>>> On 28 Jan 2013, at 11:15 AM, Emmanuel Bernard
> >> > >>>>>>>>> <emmanuel at hibernate.org>
> >> > >>>>>>>>> wrote:
> >> > >>>>>>>>>
> >> > >>>>>>>>>> I wonder how you can debug things though and look at the
> >> > >> content
> >> > >>>>>>>>>> outside
> >> > >>>>>>>>>> your tests? I guess you would install a regular mongodb on
> a
> >> > >>>>>>>>>> different
> >> > >>>>>>>>>> port.
> >> > >>>>>>>>>
> >> > >>>>>>>>> Right, for active development and/or debugging it makes
> >> probably
> >> > >>>>>>>>> sense
> >> > >>>>>>>>> to have a regular
> >> > >>>>>>>>> mongodb instance.
> >> > >>>>>>>>>
> >> > >>>>>>>>> I see the use case more in simple execution of the build
> >> > >> including
> >> > >>>>>>>>> unit
> >> > >>>>>>>>> tests on any machine.
> >> > >>>>>>>>> Also easier to get started for anyone new to the project.
> >> > >>>>>>>>>
> >> > >>>>>>>>> --Hardy
> >> > >>>>>>>>>
> >> > >>>>>>>>>
> >> > >>>>>>>>> _______________________________________________
> >> > >>>>>>>>> hibernate-dev mailing list
> >> > >>>>>>>>> hibernate-dev at lists.jboss.org
> >> > >>>>>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >> > >>>>>>>> _______________________________________________
> >> > >>>>>>>> hibernate-dev mailing list
> >> > >>>>>>>> hibernate-dev at lists.jboss.org
> >> > >>>>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >> > >>>>>>>
> >> > >>>>>>>
> >> > >>>>>
> >> > >>>>>
> >> > >>>
> >> > >>>
> >> > >>
> >> > > _______________________________________________
> >> > > hibernate-dev mailing list
> >> > > hibernate-dev at lists.jboss.org
> >> > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >> >
> >> >
> >> > _______________________________________________
> >> > hibernate-dev mailing list
> >> > hibernate-dev at lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >>
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list