Re: Review Request 68541: SQOOP-3104: Create test categories instead of test suites and naming conventions

2018-09-07 Thread Nguyen Truong

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/68541/
---

(Updated Sept. 8, 2018, 3:47 a.m.)


Review request for Sqoop.


Changes
---

- Applied Szabolcs' fix on parameterized issue
- Added categories for missing tests
- Changed the JacocoTestReport into a task. Please take a look at this. I am 
not sure I understood it correctly
- Changed dependsOn to finalizedBy for sqoopTest and test so all tests will 
run, even when some others fail. If I understand it correctly, if we use 
dependsOn, a test task won't run if the one before it failed. Also, I need your 
opinion on this.
- Added definitions into a file under sqoop/src/docs/dev and also javadoc at 
each category interface
Thank you very much for your help and opinion.
I ran ./gradlew test and one test failed. That was TestClassWriter > 
testWideTableClassGeneration. It was a connection refused error. I also need 
your help with this.
Thanks :)


Bugs: SQOOP-3104
https://issues.apache.org/jira/browse/SQOOP-3104


Repository: sqoop-trunk


Description
---

We are currently unsing test naming conventions to differentiate between 
ManualTests, Unit tests and 3rd party tests. Instead of that, I implemented 
junit categories which will allow us to have more categories in the future. 
This would also remove the reliance on the test class name.

Test categories skeleton:
  SqoopTest _ UnitTest
  |__ IntegrationTest
  |__ ManualTest

  ThirdPartyTest _ CubridTest
   |__ Db2Test
   |__ MainFrameTest
   |__ MysqlTest
   |__ NetezzaTest
   |__ OracleTest
   |__ PostgresqlTest
   |__ SqlServerTest

  KerberizedTest

Categories explanation:
* SqoopTest: Group of the big categories, including:
- UnitTest: It tests one class only with its dependencies mocked or if 
the dependency
is lightweight we can keep it. It must not start a minicluster or an 
hsqldb database.
It does not need JCDB drivers.
- IntegrationTest: It usually tests a whole scenario. It may start up 
miniclusters,
hsqldb and connect to external resources like RDBMSs.
- ManualTest: This should be a deprecated category which should not be 
used in the future.
It only exists to mark the currently existing manual tests.
* ThirdPartyTest: An orthogonal hierarchy for tests that need a JDBC driver 
and/or a docker
container/external RDBMS instance to run. Subcategories express what kind 
of external
resource the test needs. E.g: OracleTest needs an Oracle RDBMS and Oracle 
driver on the classpath
* KerberizedTest: Test that needs Kerberos, which needs to be run on a 
separate JVM.

Opinions are very welcomed. Thanks!


Diffs (updated)
-

  build.gradle fc7fc0c4c 
  src/docs/dev/test-categories-definitions.txt PRE-CREATION 
  src/test/org/apache/sqoop/TestConnFactory.java fb6c94059 
  src/test/org/apache/sqoop/TestIncrementalImport.java 29c477954 
  src/test/org/apache/sqoop/TestSqoopOptions.java e55682edf 
  src/test/org/apache/sqoop/accumulo/TestAccumuloUtil.java 631eeff5e 
  src/test/org/apache/sqoop/authentication/TestKerberosAuthenticator.java 
f5700ce65 
  src/test/org/apache/sqoop/db/TestDriverManagerJdbcConnectionFactory.java 
244831672 
  
src/test/org/apache/sqoop/db/decorator/TestKerberizedConnectionFactoryDecorator.java
 d3e3fb23e 
  src/test/org/apache/sqoop/hbase/HBaseImportAddRowKeyTest.java c4caafba5 
  src/test/org/apache/sqoop/hbase/HBaseKerberizedConnectivityTest.java 
3bfb39178 
  src/test/org/apache/sqoop/hbase/HBaseUtilTest.java c6a808c33 
  src/test/org/apache/sqoop/hbase/TestHBasePutProcessor.java e78a535f4 
  src/test/org/apache/sqoop/hcat/TestHCatalogBasic.java ba05cabbb 
  
src/test/org/apache/sqoop/hive/HiveServer2ConnectionFactoryInitializerTest.java 
4d2cb2f88 
  src/test/org/apache/sqoop/hive/TestHiveClientFactory.java a3c2dc939 
  src/test/org/apache/sqoop/hive/TestHiveMiniCluster.java 419f888c0 
  src/test/org/apache/sqoop/hive/TestHiveServer2Client.java 02617295e 
  src/test/org/apache/sqoop/hive/TestHiveServer2ParquetImport.java b55179a4f 
  src/test/org/apache/sqoop/hive/TestHiveServer2TextImport.java 410724f37 
  src/test/org/apache/sqoop/hive/TestHiveTypesForAvroTypeMapping.java 276e9eaa4 
  src/test/org/apache/sqoop/hive/TestTableDefWriter.java 626ad22f6 
  src/test/org/apache/sqoop/hive/TestTableDefWriterForExternalTable.java 
f1768ee76 
  src/test/org/apache/sqoop/importjob/avro/AvroImportForNumericTypesTest.java 
ff13dc3bc 
  src/test/org/apache/sqoop/io/TestCodecMap.java e71921823 
  src/test/org/apache/sqoop/io/TestLobFile.java 2bc95f283 
  src/test/org/apache/sqoop/io/TestNamedFifo.java a93784e08 
  

Re: Review Request 68541: SQOOP-3104: Create test categories instead of test suites and naming conventions

2018-09-07 Thread Boglarka Egyed


> On Aug. 31, 2018, 1:24 p.m., Boglarka Egyed wrote:
> > Hi Nguyen,
> > 
> > Many thanks for taking care of this huge effort! Having well categorized 
> > tests is a long-awaited improvement Sqoop, it will ease the life of every 
> > developer.
> > 
> > In general your change looks good to me however I have three findings:
> > 
> > 1.) New test classes have been introduced recently in SQOOP-3348, 
> > SQOOP-3363 and SQOOP-3368 testing the Sqoop-S3 integration. I think it 
> > would make sense to have a new test category for the S3 related tests 
> > similarly to the KerberizedTest category.
> > 
> > 2.) There should be well defined, thorough definitions of each test 
> > categories and these should be well documented somewhere. This is something 
> > that could be a result of a discussion amongst the contributors. After 
> > creating such definitions they could be added as javadocs to the test 
> > category interfaces as well as included in the Sqoop Developer’s Guide 
> > (changes would be needed under sqoop/src/docs/dev).
> > 
> > 3.) It would be also very useful to have exact commands described to run 
> > specific categories in the COMPILING.txt.
> > 
> > Thank you very much,
> > Bogi
> 
> Nguyen Truong wrote:
> Hi Boglarka,
> 
> Thanks for your review. I will go on and add categories for the new tests.
> 
> I don't know about the S3 tests. Could you please let me know more why 
> they should be under a separate category as KerberizedTest? Thank you very 
> much.
> 
> I will update the COMPILING.txt after we come up with the final decision 
> on the categories.
> 
> Thanks,
> Nguyen
> 
> Boglarka Egyed wrote:
> S3 tests should be in a separate test category as they test the 
> integration with the Amazon S3 cloud service that is a third party side just 
> like an RDBMS. These tests also require AWS credentials to access S3 and they 
> run only if these credentials are provided via the 
> -Ds3.generator.command= property as well as the 
> target S3 location via the -Ds3.bucket.url= property.
> The S3 tests that should be in a separate category are under 
> sqoop/src/test/org/apache/sqoop/s3/
> The S3 related test case added in SQOOP-3368 is a simple unit test case 
> though, it doesn't test the integration with S3 just the sqoop option 
> validation mechanism.
> 
> I will also think about the definitions of the test categories and will 
> share my thoughts later.

Hey Natalie,

I think I ran a bit forward with my previous comments. Let's skip the S3 
category now, it can be added in a later patch as well. Please ignore my words 
above.

We had a discussion with Szabolcs and Fero and here is our recommendation for 
the test categorie definitions:

SqoopTest
-
UnitTest:
A unit test shall test one class at a time having it's dependencies mocked.
A unit test shall not start a mini cluster nor an embedded database and it 
shall not use a JDBC driver.

IntegrationTest:
An integration test shall test if independently developed classes work together 
correctly.
An integration test checks a whole scenario and thus may start mini clusters or 
embedded databases and may connect to external resources like RDBMS instances.

ManualTest:
Deprecated category, shall not be used nor extended.

ThirdPartyTest
--
A third party test shall test a scenario where a third party side is required 
such as a JDBC driver or an external RDBMS instance.

CubridTest:
A CubridTest shall test scenarios where a Cubrid driver and/or external 
instance is required.

Db2Test:
A DB2 test shall test scenarios where a DB2 driver and/or external instance is 
required.

MainFrameTest:
A MainFrame test shall test scenarios where a MainFrame external instance is 
required.

MysqlTest:
A MySql test shall test scenarios where a MySql driver and/or external instance 
is required.

NetezzaTest:
A Netezza test shall test scenarios where a Netezza driver and/or external 
instance is required.

OracleTest:
An Oracle test shall test scenarios where a Oracle driver and/or external 
instance is required.

PostgresqlTest:
A PostgreSql test shall test scenarios where a PostgreSql driver and/or 
external instance is required.

SqlServerTest:
An SqlServer test shall test scenarios where a SqlServer driver and/or external 
instance is required.

KerberizedTest
--
A kerberized test shall run in kerberized environment thus it starts mini KDC 
server.


These also can be refined and/or extended later but could be a good start for 
now.

What do you think?

Thanks,
Bogi


- Boglarka


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/68541/#review208172
---


On Aug. 28, 2018, 3:52 p.m., Nguyen Truong wrote:
> 
> ---
> This is an automatically generated e-mail. To