googleapis / sdk-platform-java

Tooling and shared libraries for Cloud SDK for Java
https://cloud.google.com/java/docs/bom
Apache License 2.0
64 stars 52 forks source link

Hermetic build integration test does not catch differences as `git diff` does #2540

Closed diegomarquezp closed 6 months ago

diegomarquezp commented 6 months ago

Reproduction:

cd library_generation
rm -rdf build && rm -rdf output && python -m pip install .
python -m unittest test/integration_tests.py
cd output/google-cloud-java
git diff
cd ../java-bigtable
git diff

git diff produces differences that are not detected by the IT. The differences are in the proto classes mainly. For example:

diff --git a/java-alloydb/proto-google-cloud-alloydb-v1/src/main/java/com/google/cloud/alloydb/v1/ResourcesProto.java b/java-alloydb/proto-google-cloud-alloydb-v1/src/main/java/com/google/cloud/alloydb/v1/ResourcesProto.java
index d16e0d6fb6a..53175e7a8c5 100644
--- a/java-alloydb/proto-google-cloud-alloydb-v1/src/main/java/com/google/cloud/alloydb/v1/ResourcesProto.java
+++ b/java-alloydb/proto-google-cloud-alloydb-v1/src/main/java/com/google/cloud/alloydb/v1/ResourcesProto.java
@@ -197,271 +197,273 @@ public final class ResourcesProto {
           + "protobuf/wrappers.proto\032\033google/type/day"
           + "ofweek.proto\032\033google/type/timeofday.prot"
           + "o\".\n\014UserPassword\022\014\n\004user\030\001 \001(\t\022\020\n\010passw"
-          + "ord\030\002 \001(\t\"\343\001\n\017MigrationSource\022\026\n\thost_po"
-          + "rt\030\001 \001(\tB\003\340A\003\022\031\n\014reference_id\030\002 \001(\tB\003\340A\003"
-          + "\022V\n\013source_type\030\003 \001(\0162<.google.cloud.all"
-          + "oydb.v1.MigrationSource.MigrationSourceT"
-          + "ypeB\003\340A\003\"E\n\023MigrationSourceType\022%\n!MIGRA"
-          + "TION_SOURCE_TYPE_UNSPECIFIED\020\000\022\007\n\003DMS\020\001\""
-          + "(\n\020EncryptionConfig\022\024\n\014kms_key_name\030\001 \001("
-          + "\t\"\206\002\n\016EncryptionInfo\022J\n\017encryption_type\030"
-          + "\001 \001(\0162,.google.cloud.alloydb.v1.Encrypti"
-          + "onInfo.TypeB\003\340A\003\022J\n\020kms_key_versions\030\002 \003"

cc: @JoeWang1127

JoeWang1127 commented 6 months ago

I think, in the integration test, dircmp is not actually comparing files recursively. I chained compare_result.subdirs all the way to a directory without subdirectory and could see the difference.

image

I'll create a fix.