incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Burwell <jburw...@basho.com>
Subject Re: Unit Test Failures
Date Wed, 31 Oct 2012 13:12:54 GMT
Hugo,

You are correct -- I missed a very important word there.  An issue with using an in-memory
database for integration tests are the differences between SQL dialects (i.e. a valid query
for HSQLDB may not be valid on MySQL -- degrading the value of the test).  

Also, have considered using TestNG?  One of its many good features is test groups that allow
you to easily organize and select tests for execution.  It provides a JUnit4 test adapter
that would allow you leverage the current JUnit tests cases with little to no modification.

Thanks,
-John

On Oct 30, 2012, at 6:36 PM, Hugo Trippaers <HTrippaers@schubergphilis.com> wrote:

> I think/hope that you mean 'should not require' :-)
> 
> I think we can do something with the integration test framework in maven. I haven't looked
at it in detail yet. Ideally even that should by sort of self contained by using an in memory
database during the integration test fog example. 
> 
> For now we can put the test classes with db tests in the exclude list in the Pom.xml
and I'll see if I can enable them with a profile.
> 
> Cheers,
> 
> Hugo
> 
> Sent from my iPhone
> 
> On 30 okt. 2012, at 23:29, "John Burwell" <jburwell@basho.com> wrote:
> 
>> Hugo,
>> 
>> Generally speaking, unit tests should require any outside resources -- including
a database.  Is there a way we can separate the tests that require a database into an integration
test suite?  Such an approach would preserve the important testing being performed by these
tests to continue, and allow for the development of isolated unit tests.
>> 
>> Thanks,
>> -John
>> 
>> On Oct 30, 2012, at 6:21 PM, Hugo Trippaers <HTrippaers@schubergphilis.com>
wrote:
>> 
>>> Hey John,
>>> 
>>> The unit tests disabled in the maven build for a long time, because a lot of
the unit tests do indeed require an active database. Today I disabled most of those database
tests and enabled the test procedures in maven as I don't think every developer has an active
database, but still might want to run any unittests that don't depend on the database. The
tests you mention most have slipped through, which makes it very interesting as the test result
is blue (in jenkins) while obviously there is something going horribly wrong.
>>> 
>>> You can still disable the tests during your maven run, but they are now enabled
by default. See http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-test.html
>>> 
>>> 
>>> Cheers,
>>> 
>>> Hugo
>>> 
>>>> -----Original Message-----
>>>> From: John Burwell [mailto:jburwell@basho.com]
>>>> Sent: Tuesday, October 30, 2012 9:59 PM
>>>> To: cloudstack-dev@incubator.apache.org
>>>> Subject: Unit Test Failures
>>>> 
>>>> All,
>>>> 
>>>> I just pulled down the latest from master, and am receiving a pile of unit
test
>>>> errors such as the following:
>>>> 
>>>> 2012-10-30 16:56:50,951 ERROR [db.Transaction.Transaction] (Thread-587:)
>>>> Unexpected exception:
>>>> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
>>>> Communications link failure
>>>> 
>>>> The last packet sent successfully to the server was 0 milliseconds ago. The
>>>> driver has not received any packets from the server.
>>>>   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>>   at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor
>>>> AccessorImpl.java:39)
>>>>   at
>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon
>>>> structorAccessorImpl.java:27)
>>>>   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>>   at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
>>>>   at
>>>> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:112
>>>> 2)
>>>>   at
>>>> com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2260)
>>>>   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
>>>>   at
>>>> com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
>>>>   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>>   at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor
>>>> AccessorImpl.java:39)
>>>>   at
>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon
>>>> structorAccessorImpl.java:27)
>>>>   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>>   at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
>>>>   at
>>>> com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
>>>>   at
>>>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:28
>>>> 5)
>>>>   at java.sql.DriverManager.getConnection(DriverManager.java:582)
>>>>   at java.sql.DriverManager.getConnection(DriverManager.java:185)
>>>>   at
>>>> org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnec
>>>> tion(DriverManagerConnectionFactory.java:75)
>>>>   at
>>>> org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(Poolabl
>>>> eConnectionFactory.java:582)
>>>>   at
>>>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericO
>>>> bjectPool.java:1188)
>>>>   at
>>>> org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataS
>>>> ource.java:106)
>>>>   at
>>>> com.cloud.utils.db.Transaction.getStandaloneConnectionWithException(Tran
>>>> saction.java:200)
>>>>   at
>>>> com.cloud.utils.db.Transaction.getStandaloneConnection(Transaction.java:2
>>>> 09)
>>>>   at
>>>> com.cloud.utils.db.DbUtil.getConnectionForGlobalLocks(DbUtil.java:58)
>>>>   at com.cloud.utils.db.DbUtil.getGlobalLock(DbUtil.java:203)
>>>>   at com.cloud.utils.db.GlobalLock.lock(GlobalLock.java:159)
>>>>   at
>>>> com.cloud.utils.db.GlobalLockTest$Worker.run(GlobalLockTest.java:43)
>>>>   at java.lang.Thread.run(Thread.java:680)
>>>> Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
>>>> Communications link failure
>>>> 
>>>> The last packet sent successfully to the server was 0 milliseconds ago. The
>>>> driver has not received any packets from the server.
>>>>   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>>   at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor
>>>> AccessorImpl.java:39)
>>>>   ... 28 more
>>>> Caused by: java.net.ConnectException: Connection refused
>>>>   at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>>   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
>>>>   at
>>>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
>>>>   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
>>>>   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
>>>>   ... 29 more
>>>> 
>>>> Are the unit tests requiring an instance of MySql be up and running?
>>>> 
>>>> Thanks,
>>>> -John
>> 


Mime
View raw message