apache / gravitino

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
https://gravitino.apache.org
Apache License 2.0
926 stars 299 forks source link

[Bug report] `TestHiveTableOperations` can't be test alone #4851

Closed LindaSummer closed 2 weeks ago

LindaSummer commented 2 weeks ago

Version

main branch

Describe what's wrong

When using this command line gradle :catalogs:catalog-hive:test --tests 'org.apache.gravitino.catalog.hive.TestHiveTableOperations', unit test will fail.

Error message and/or stacktrace

Here are logs of testing.

gradle :catalogs:catalog-hive:test --tests 'org.apache.gravitino.catalog.hive.TestHiveTableOperations'

> Configure project :
------------------ Check Docker environment ---------------------
Docker server status ............................................ [running]
Run test cases without `gravitino-docker-test` tag .............. [embedded test]
-----------------------------------------------------------------

> Task :catalogs:catalog-hive:test

TestHiveTableOperations > initializationError FAILED
    java.lang.NullPointerException
        at org.apache.gravitino.catalog.hive.TestHiveTable.initHiveSchema(TestHiveTable.java:90)
        at org.apache.gravitino.catalog.hive.TestHiveTableOperations.setup(TestHiveTableOperations.java:62)

1 test completed, 1 failed

> Task :catalogs:catalog-hive:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':catalogs:catalog-hive:test'.
> There were failing tests. See the report at: file:///home/ubuntu/opensource/gravitino/build/reports/index.html

* Try:
> Run with --scan to get full insights.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 12s
30 actionable tasks: 4 executed, 26 up-to-date

How to reproduce

Gravitino version: main branch commit 03e2110.

Run this command: gradle :catalogs:catalog-hive:test --tests 'org.apache.gravitino.catalog.hive.TestHiveTableOperations'

Additional context

This issue only happens when TestHiveTable is not initialized. It imports static variables TestHiveTable.hiveCatalogOperations. So, when TestHiveTable class is not initialized with setup(), the imported variable is null.

I find this problem during check the coverage of TestHiveTableOperations on issue #2183.

LindaSummer commented 2 weeks ago

Hi Team,

Please correct me if I misunderstand the problem or my way of usage is incorrect.

I will try to fix it first and then continue to check the coverage of TestHiveTableOperations.

Best Regards, Edward