From 04f2a46f6904533f598d1e0505c15bc51399455d Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Thu, 9 Nov 2023 19:38:18 +0000 Subject: [PATCH 1/4] fix: confirm owlbot-copy succeeeded --- library_generation/test/generate_library_integration_test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library_generation/test/generate_library_integration_test.sh b/library_generation/test/generate_library_integration_test.sh index 64b526e47c..c29aaa6659 100755 --- a/library_generation/test/generate_library_integration_test.sh +++ b/library_generation/test/generate_library_integration_test.sh @@ -173,6 +173,11 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do echo "Generate library finished." echo "Compare generation result..." if [ $enable_postprocessing == "true" ]; then + if [ $(find "${output_folder}/workspace" -name '*.java' | wc -l) -eq 0 ]; + then + echo 'no java files found in workspace. This probably means that owlbot copy failed' + exit 1 + fi echo "Checking out repository..." pushd "${target_folder}" SOURCE_DIFF_RESULT=0 From cdc13009bb51093f9fd995900dee2f05daa3d07f Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Fri, 10 Nov 2023 18:43:06 +0000 Subject: [PATCH 2/4] use v2 of iam in IT --- library_generation/test/resources/proto_path_list.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library_generation/test/resources/proto_path_list.txt b/library_generation/test/resources/proto_path_list.txt index 8943c03716..f56e78643c 100755 --- a/library_generation/test/resources/proto_path_list.txt +++ b/library_generation/test/resources/proto_path_list.txt @@ -17,7 +17,7 @@ google/cloud/redis/v1 java-redis false google/cloud/redis/v1beta1 java-redis false # google/example/library/v1 google-cloud-example-library-v1-java null false google/devtools/containeranalysis/v1 java-containeranalysis false -google/iam/v1 java-iam false +google/iam/v2 java-iam false google/iam/credentials/v1 java-iamcredentials false google/logging/v2 java-logging true google/pubsub/v1 java-pubsub true From 355affdaf2638b145b9ac481b46b4ddb8238f918 Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Fri, 10 Nov 2023 19:55:49 +0000 Subject: [PATCH 3/4] keep iam v1 and skip PP test --- .../test/generate_library_integration_test.sh | 6 +++--- library_generation/test/resources/proto_path_list.txt | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/library_generation/test/generate_library_integration_test.sh b/library_generation/test/generate_library_integration_test.sh index c29aaa6659..fa86b4e6b8 100755 --- a/library_generation/test/generate_library_integration_test.sh +++ b/library_generation/test/generate_library_integration_test.sh @@ -85,7 +85,7 @@ fi grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do proto_path=$(echo "$line" | cut -d " " -f 1) repository_path=$(echo "$line" | cut -d " " -f 2) - is_handwritten=$(echo "$line" | cut -d " " -f 3) + skip_postprocessing=$(echo "$line" | cut -d " " -f 3) # parse destination_path pushd "${output_folder}" echo "Checking out googleapis-gen repository..." @@ -110,8 +110,8 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do service_yaml=${service_yaml}, include_samples=${include_samples}." pushd "${output_folder}" - if [ "${is_handwritten}" == "true" ]; then - echo 'this is a handwritten library' + if [ "${skip_postprocessing}" == "true" ]; then + echo 'this library is not intended for postprocessing test' popd # output folder continue else diff --git a/library_generation/test/resources/proto_path_list.txt b/library_generation/test/resources/proto_path_list.txt index f56e78643c..c85cbccbd9 100755 --- a/library_generation/test/resources/proto_path_list.txt +++ b/library_generation/test/resources/proto_path_list.txt @@ -1,6 +1,6 @@ # This file is used in integration test against `generate_library.sh`. # Format: -# proto_path repository_path is_handwritten +# proto_path repository_path skip_postprocessing_test # google/bigtable/admin/v2 java-bigtable true # google/bigtable/v2 java-bigtable true google/cloud/apigeeconnect/v1 java-apigee-connect false @@ -17,6 +17,7 @@ google/cloud/redis/v1 java-redis false google/cloud/redis/v1beta1 java-redis false # google/example/library/v1 google-cloud-example-library-v1-java null false google/devtools/containeranalysis/v1 java-containeranalysis false +google/iam/v1 java-iam true google/iam/v2 java-iam false google/iam/credentials/v1 java-iamcredentials false google/logging/v2 java-logging true From fc5a0a818b9656498d3b41690a1b19235ea56015 Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Fri, 10 Nov 2023 20:08:43 +0000 Subject: [PATCH 4/4] format fixes --- .../test/generate_library_integration_test.sh | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/library_generation/test/generate_library_integration_test.sh b/library_generation/test/generate_library_integration_test.sh index fa86b4e6b8..3cc5a1544c 100755 --- a/library_generation/test/generate_library_integration_test.sh +++ b/library_generation/test/generate_library_integration_test.sh @@ -126,7 +126,7 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do # generate GAPIC client library echo "Generating library from ${proto_path}, to ${destination_path}..." generation_start=$(date "+%s") - if [ $enable_postprocessing == "true" ]; then + if [ "${enable_postprocessing}" == "true" ]; then if [[ "${repository_path}" == "null" ]]; then # we need a repository to compare the generated results with. Skip this # library @@ -180,7 +180,7 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do fi echo "Checking out repository..." pushd "${target_folder}" - SOURCE_DIFF_RESULT=0 + source_diff_result=0 git diff \ --ignore-space-at-eol \ -r \ @@ -189,34 +189,34 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do ':!*pom.xml' \ ':!*README.md' \ ':!*package-info.java' \ - || SOURCE_DIFF_RESULT=$? + || source_diff_result=$? - POM_DIFF_RESULT=$(compare_poms "${target_folder}") + pom_diff_result=$(compare_poms "${target_folder}") popd # target_folder - if [[ ${SOURCE_DIFF_RESULT} == 0 ]] && [[ ${POM_DIFF_RESULT} == 0 ]] ; then + if [[ ${source_diff_result} == 0 ]] && [[ ${pom_diff_result} == 0 ]] ; then echo "SUCCESS: Comparison finished, no difference is found." # Delete google-cloud-java to allow a sparse clone of the next library rm -rdf google-cloud-java - elif [ ${SOURCE_DIFF_RESULT} != 0 ]; then + elif [ ${source_diff_result} != 0 ]; then echo "FAILURE: Differences found in proto path: ${proto_path}." exit "${SOURCE_DIFF_RESULT}" - elif [ ${POM_DIFF_RESULT} != 0 ]; then + elif [ ${pom_diff_result} != 0 ]; then echo "FAILURE: Differences found in generated poms" - exit "${POM_DIFF_RESULT}" + exit "${pom_diff_result}" fi - elif [ $enable_postprocessing == "false" ]; then + elif [ "${enable_postprocessing}" == "false" ]; then # include gapic_metadata.json and package-info.java after # resolving https://github.com/googleapis/sdk-platform-java/issues/1986 - SOURCE_DIFF_RESULT=0 + source_diff_result=0 diff --strip-trailing-cr -r "googleapis-gen/${proto_path}/${destination_path}" "${output_folder}/${destination_path}" \ -x "*gradle*" \ -x "gapic_metadata.json" \ - -x "package-info.java" || SOURCE_DIFF_RESULT=$? - if [ ${SOURCE_DIFF_RESULT} == 0 ] ; then + -x "package-info.java" || source_diff_result=$? + if [ ${source_diff_result} == 0 ] ; then echo "SUCCESS: Comparison finished, no difference is found." else echo "FAILURE: Differences found in proto path: ${proto_path}." - exit "${SOURCE_DIFF_RESULT}" + exit "${source_diff_result}" fi fi