Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2279] improvement(test): Isolate catalog class path in IT #2397

Merged
merged 46 commits into from
Mar 12, 2024

Conversation

yuqi1129
Copy link
Contributor

@yuqi1129 yuqi1129 commented Feb 29, 2024

What changes were proposed in this pull request?

Move the test cases that depend on the Docker environment to their corresponding catalog modules.

Why are the changes necessary?

For better management.

Fix: #2279

Does this PR introduce any user-facing change?

N/A.

How was this patch tested?

Existing test can cover the changes.

@yuqi1129 yuqi1129 changed the title [#2279] improvement(test): Move JDBC related UTs that depends on docker environment to catalogs modules [#2390] improvement(test): Move JDBC related UTs that depends on docker environment to catalogs modules Feb 29, 2024
@jerryshao
Copy link
Contributor

@yuqi1129 I would suggest we have a thorough solution before doing this change.

@yuqi1129
Copy link
Contributor Author

@yuqi1129 I would suggest we have a thorough solution before doing this change.

Let me thoroughly review the hive-related tests. It appears that the hive-related tests have more complex dependencies:

  • HDFS. This is to check the file's existence and read/write status. For example, drop an external table and verify if the path of the table is clear.
  • Hive Metastore was used to check the status of the Hive Docker instance, retrieve Hive table objects through Thrift, and then compare them with that loaded by Gravitino.
  • Thrift: Handle some exceptions.

Iceberg and JDBC-related tests are clear and under control.

@yuqi1129 yuqi1129 changed the title [#2390] improvement(test): Move JDBC related UTs that depends on docker environment to catalogs modules [#2390] improvement(test): Isolate catalog class path in IT Mar 5, 2024
@yuqi1129 yuqi1129 requested review from jerryshao and diqiu50 March 6, 2024 03:17
@jerryshao
Copy link
Contributor

Issue has nothing related to your PR, please fix the issue. Also adding detailed descriptions to issue.

@yuqi1129 yuqi1129 changed the title [#2390] improvement(test): Isolate catalog class path in IT [#2279] improvement(test): Isolate catalog class path in IT Mar 6, 2024
@jerryshao
Copy link
Contributor

The code is far from ready, please spend time on polishing it, and think about the overall code organizations.

@yuqi1129 yuqi1129 self-assigned this Mar 6, 2024
if (skipUTs) {
// Only run integration tests
include("**/integration/**")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you verified locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have verified the changes locally.

@jerryshao
Copy link
Contributor

You should also check why tasks.configureEach<Test> in root gradle is not worked. Also, if the tasks.configureEach<Test> is not worked, it means other codes here is also not worked, like setting testNG and others, you should confirm all.

@jerryshao
Copy link
Contributor

Also, I think you need to keep this behavior after the change

  tasks.configureEach<Test> {
    testLogging {
      exceptionFormat = TestExceptionFormat.FULL
      showExceptions = true
      showCauses = true
      showStackTraces = true
    }
    reports.html.outputLocation.set(file("${rootProject.projectDir}/build/reports/"))
    val skipTests = project.hasProperty("skipTests")
    if (!skipTests) {
      if (project.name == "trino-connector") {
        useTestNG()
        maxHeapSize = "2G"
      } else {
        useJUnitPlatform()
      }

      jvmArgs(project.property("extraJvmArgs") as List<*>)
      finalizedBy(tasks.getByName("jacocoTestReport"))
    }
  }

@yuqi1129
Copy link
Contributor Author

yuqi1129 commented Mar 11, 2024

You should also check why tasks.configureEach<Test> in root gradle is not worked. Also, if the tasks.configureEach<Test> is not worked, it means other codes here is also not worked, like setting testNG and others, you should confirm all.

Maybe we need to clarify what the skipTests means. In the main branch, skipTests will skip all tests in the module, it's equivalent to skipping all unit tests, however, when we move ITs to the module, I want to confirm what the behavior skipTests we need to abide by.

The latest changes mean we will skip all unit tests if users set property skipTests.

Maybe I need to revert the latest changes here as the syntax skipTests in module integration-test and catalogs-related test is not the same? @jerryshao

You should also check why tasks.configureEach<Test> in root gradle is not worked

It works actually if skipTests means skipping all tests including ITs.

@yuqi1129
Copy link
Contributor Author

Also, I think you need to keep this behavior after the change

  tasks.configureEach<Test> {
    testLogging {
      exceptionFormat = TestExceptionFormat.FULL
      showExceptions = true
      showCauses = true
      showStackTraces = true
    }
    reports.html.outputLocation.set(file("${rootProject.projectDir}/build/reports/"))
    val skipTests = project.hasProperty("skipTests")
    if (!skipTests) {
      if (project.name == "trino-connector") {
        useTestNG()
        maxHeapSize = "2G"
      } else {
        useJUnitPlatform()
      }

      jvmArgs(project.property("extraJvmArgs") as List<*>)
      finalizedBy(tasks.getByName("jacocoTestReport"))
    }
  }

This behavior has not changed.

@jerryshao
Copy link
Contributor

You should also check why tasks.configureEach<Test> in root gradle is not worked. Also, if the tasks.configureEach<Test> is not worked, it means other codes here is also not worked, like setting testNG and others, you should confirm all.

Maybe we need to clarify what the skipTests means. In the main branch, skipTests will skip all tests in the module, it's equivalent to skipping all unit tests, however, when we move ITs to the module, I want to confirm what the behavior skipTests we need to abide by.

The latest changes means we will skip all unit tests if users set property skipTests.

You should also check why tasks.configureEach<Test> in root gradle is not worked

It works actually if skipTests means skipping all tests including ITs.

Let's keep this behavior.

@yuqi1129
Copy link
Contributor Author

Let's keep this behavior.

Okay, I will revert the latest changes.

@jerryshao
Copy link
Contributor

jerryshao commented Mar 11, 2024

I mean keep what current main branch's definition: skipTests => skip UT, skipITs => skip IT, not reverting it. You can check the ci script, currently there's no chance to run ITs in each catalog.

You should think about which way is the right way, not just changing it and then reverting it abruptly.

@yuqi1129
Copy link
Contributor Author

I mean keep what current main branch's definition: skipTests => skip UT, skipITs => skip IT, not reverting it. You can check the ci script, currently there's no chance to run ITs in each catalog.

You should think about which way is the right way, not just changing it and then reverting it abruptly.

I see. I will use another PR to change the name skipTests to skipUTs, the current name is quite misleading.

@yuqi1129
Copy link
Contributor Author

Each sub-module needs to configure useJUnitPlatform() to make the UTs work well, that is how skipTests is working.

@jerryshao jerryshao merged commit 1d79b51 into apache:main Mar 12, 2024
7 checks passed
@jerryshao
Copy link
Contributor

Thanks @yuqi1129 for your work, please keep improving if there's something missing or need to refactor further.

@jerryshao
Copy link
Contributor

I mean keep what current main branch's definition: skipTests => skip UT, skipITs => skip IT, not reverting it. You can check the ci script, currently there's no chance to run ITs in each catalog.
You should think about which way is the right way, not just changing it and then reverting it abruptly.

I see. I will use another PR to change the name skipTests to skipUTs, the current name is quite misleading.

It's actually the way maven uses, maven uses skipTests to skip all the UTs.

@yuqi1129
Copy link
Contributor Author

I mean keep what current main branch's definition: skipTests => skip UT, skipITs => skip IT, not reverting it. You can check the ci script, currently there's no chance to run ITs in each catalog.
You should think about which way is the right way, not just changing it and then reverting it abruptly.

I see. I will use another PR to change the name skipTests to skipUTs, the current name is quite misleading.

It's actually the way maven uses, maven uses skipTests to skip all the UTs.

To the best of my ability, SkipTests will skip all tests other than UTs.

zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 12, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 13, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 13, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 13, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 13, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 14, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 14, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 14, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 14, 2024
zhoukangcn added a commit to zhoukangcn/gravitino that referenced this pull request Mar 15, 2024
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.

[Improvement] Use isolated classpath for mini gravitino server
5 participants