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

[#639] feat(CI): Improvement Docker management for integration test #711

Merged
merged 1 commit into from
Nov 30, 2023
Merged

[#639] feat(CI): Improvement Docker management for integration test #711

merged 1 commit into from
Nov 30, 2023

Conversation

xunliu
Copy link
Member

@xunliu xunliu commented Nov 9, 2023

What changes were proposed in this pull request?

I'm considering referencing the testcontaine approach in TrinoConnectorIT. It can be better to use containers for testing.

Why are the changes needed?

Currently, the HiveCatalogIT and CatalogIcebergIT integrated test environment launches the gravitino-ci-hive Docker image via a script, This creates a situation where the startup container is in GitHub Action or local to the user, and the test container is in the IT code, which is not uniform.

Fix: #639

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

CI Pass

@xunliu xunliu added this to the Graviton 0.3.0 milestone Nov 9, 2023
@xunliu xunliu changed the title [#639] feat(CI): Improving integration testing Docker methodology [#639] feat(CI): Improving IT Docker methodology Nov 9, 2023
Copy link

github-actions bot commented Nov 9, 2023

Code Coverage Report

Overall Project 66.13% 🟢

There is no coverage information present for the Files changed

@xunliu xunliu changed the title [#639] feat(CI): Improving IT Docker methodology [#639] feat(CI): Improvement IT Docker methodology Nov 9, 2023
@xunliu xunliu changed the title [#639] feat(CI): Improvement IT Docker methodology [#639] feat(CI): Improvement IT Docker testing methodology Nov 10, 2023
}
} catch (e: Exception) {
println("isMacDockerConnectorRunning execution failed: ${e.message}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably be better change to “checkContainerRunning command execution failed: ...”

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

if (exitCode == 0) {
project.extra["dockerRunning"] = true
} else {
println("checkDockerRunning Command execution failed with exit code $exitCode")
Copy link
Contributor

Choose a reason for hiding this comment

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

Low case "c" for "Command"

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

containerSuite.getHiveContainer().getContainerIpAddress(),
HiveContainer.HDFS_DEFAULTFS_PORT))
.config(
"spark.hadoop.fs.defaultFS",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to set this configuration.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed it.

try {
closer.close();
} catch (Exception e) {
LOG.error(e.getMessage(), e);
Copy link
Contributor

Choose a reason for hiding this comment

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

e.getMessage() should be simlar to e, I think we should add some more words for error message.

Copy link
Member Author

Choose a reason for hiding this comment

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

DONE

@@ -446,7 +482,10 @@ public void testHiveTableProperties() throws TException, InterruptedException {
TABLE_TYPE,
"external_table",
LOCATION,
"/tmp",
String.format(
"hdfs://%s:%d/tmp",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to use a random path?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the basic path of the Table, all tables have different table name. so they don't clash.

@jerryshao
Copy link
Contributor

I think you should also update the integration test doc.

@yuqi1129
Copy link
Contributor

@xunliu
If we do not start Docker locally, there will be a problem. Please take a look.

image image

@yuqi1129
Copy link
Contributor

Additionally, I suggest we do not remove messages explaining why some tests were ignored when testing them in IDE,
image

New developers would be very confused.

@xunliu
Copy link
Member Author

xunliu commented Nov 13, 2023

@yuqi1129 Please help me review this PR again. Thanks

@jerryshao
Copy link
Contributor

@xunliu If we do not start Docker locally, there will be a problem. Please take a look.

image image

Is it fixed now? @xunliu

@jerryshao
Copy link
Contributor

@xunliu If we do not start Docker locally, there will be a problem. Please take a look.
image image

Is it fixed now? @xunliu

Is it ready for review? @xunliu

@xunliu
Copy link
Member Author

xunliu commented Nov 16, 2023

@jerryshao I'm running tests with different CPU architectures and if they all pass, I'll update this PR status.

@xunliu
Copy link
Member Author

xunliu commented Nov 29, 2023

I think you should also update the integration test doc.

DONE

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.junit.jupiter.api.condition.EnabledIf;

@TestInstance(Lifecycle.PER_CLASS)
@Tag("gravitino-docker-it")
Copy link
Contributor

@FANNG1 FANNG1 Nov 29, 2023

Choose a reason for hiding this comment

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

IcebergRESTServiceIT doesn't need @Tag("gravitino-docker-it")

Copy link
Member Author

Choose a reason for hiding this comment

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

hi @FANNG1 Because IcebergRESTServiceIT extent IcebergRESTServiceBaseIT class.

We need get Hive Docker container IP in IcebergRESTServiceBaseIT class.
The relevant code is here

private static Map<String, String> getIcebergJdbcCatalogConfigs() {
    ...
    configMap.put(
        AuxiliaryServiceManager.GRAVITINO_AUX_SERVICE_PREFIX
            + IcebergRESTService.SERVICE_NAME
            + "."
            + IcebergConfig.CATALOG_WAREHOUSE.getKey(),
        GravitinoITUtils.genRandomName(
            String.format(
                "hdfs://%s:%d/user/hive/warehouse-jdbc-sqlite",
                containerSuite.getHiveContainer().getContainerIpAddress(),
                HiveContainer.HDFS_DEFAULTFS_PORT)));

I think it better to add the registerIcebergCatalogConfig() abstract interface in IcebergRESTServiceBaseIT.class, That would solve this problem.

So I created issue #874 to trace this issue, Please fix it(#874) and wait until you have time.

@xunliu
Copy link
Member Author

xunliu commented Nov 29, 2023

@xunliu If we do not start Docker locally, there will be a problem. Please take a look.

image image

I fixed this issue.

@xunliu
Copy link
Member Author

xunliu commented Nov 29, 2023

@jerryshao I fixed all problems, Please help me review this PR, Thanks.

@jerryshao jerryshao changed the title [#639] feat(CI): Improvement IT Docker testing methodology [#639] feat(CI): Improvement Docker management for integration test Nov 30, 2023
@jerryshao
Copy link
Contributor

Please rebase the code and test it on Linux environment.

@xunliu
Copy link
Member Author

xunliu commented Nov 30, 2023

@jerryshao I rebased the code and the test passed in the ubuntu environment.

@jerryshao jerryshao merged commit bb249d6 into apache:main Nov 30, 2023
2 checks passed
@xunliu xunliu deleted the issue-639 branch December 12, 2023 06:57
jerryshao pushed a commit that referenced this pull request Dec 14, 2023
### What changes were proposed in this pull request?
1. make getCatalogConfig abstract, Hive&Jdbc&Memory implement these
interfaces.
2. remove `gravitino-docker-it` tag from IcebergRESTServiceIT.

### Why are the changes needed?
After #711, It takes too much time to test IcebergRESTServiceIT, there's
no need to start the docker container for the memory catalog

Fix: #874 

### Does this PR introduce _any_ user-facing change?
no

### How was this patch tested?
existing UT
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] Improvement IT Docker methodology
4 participants