Skip to content

Commit 12f87c3

Browse files
committed
chore(bazel): Preserve dir structure for integration test goldens
1 parent 73b6834 commit 12f87c3

128 files changed

Lines changed: 14 additions & 8 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

rules_bazel/java/integration_test.bzl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ def _diff_integration_goldens_impl(ctx):
1414

1515
script = """
1616
mkdir codegen_tmp
17-
unzip -j {input} -d codegen_tmp
18-
unzip -j {input_resource_name} -d codegen_tmp
19-
unzip -j {input_test} -d codegen_tmp
17+
unzip {input} -d codegen_tmp
18+
unzip {input_resource_name} -d codegen_tmp
19+
unzip {input_test} -d codegen_tmp
2020
cd codegen_tmp
2121
# Remove unneeded non-Java files, like MANIFEST
2222
rm -rf $(find ./ -type f ! -name '*.java' -a ! -name '*gapic_metadata.json')
23+
rm -rf $(find ./ -type f -name 'PlaceholderFile.java')
24+
rm -r $(find ./ -type d -empty)
2325
cd ..
2426
diff codegen_tmp test/integration/goldens/{api_name}/ > {diff_output}
2527
# Bash `diff` command will return exit code 1 when there are differences between the two
@@ -114,12 +116,14 @@ def _overwrite_golden_impl(ctx):
114116

115117
script = """
116118
mkdir codegen_tmp
117-
unzip -j {input} -d codegen_tmp
118-
unzip -j {input_resource_name} -d codegen_tmp
119-
unzip -j {input_test} -d codegen_tmp
119+
unzip {input} -d codegen_tmp
120+
unzip {input_resource_name} -d codegen_tmp
121+
unzip {input_test} -d codegen_tmp
120122
cd codegen_tmp
121123
# Remove unneeded non-Java files, like MANIFEST
122124
rm -rf $(find ./ -type f ! -name '*.java' -a ! -name '*gapic_metadata.json')
125+
rm -rf $(find ./ -type f -name 'PlaceholderFile.java')
126+
rm -r $(find ./ -type d -empty)
123127
zip -r ../{goldens_output_zip} .
124128
""".format(
125129
goldens_output_zip = goldens_output_zip.path,
@@ -141,8 +145,10 @@ def _overwrite_golden_impl(ctx):
141145
# Overwrite the goldens.
142146
golden_update_script_content = """
143147
cd ${{BUILD_WORKSPACE_DIRECTORY}}
144-
rm -r test/integration/goldens/{api_name}/*.java
145-
rm -r test/integration/goldens/{api_name}/gapic_metadata.json
148+
# Clear out existing Java and JSON files.
149+
rm -r $(find test/integration/goldens/{api_name}/ -name '*.java')
150+
rm -r $(find test/integration/goldens/{api_name}/ -name 'gapic_metadata.json')
151+
rm -r $(find ./ -type d -empty)
146152
unzip -ao {goldens_output_zip} -d test/integration/goldens/{api_name}
147153
""".format(
148154
goldens_output_zip = goldens_output_zip.path,

test/integration/goldens/asset/AssetServiceClient.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceClient.java

File renamed without changes.

test/integration/goldens/asset/AssetServiceClientTest.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceClientTest.java

File renamed without changes.

test/integration/goldens/asset/AssetServiceSettings.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/AssetServiceSettings.java

File renamed without changes.

test/integration/goldens/asset/FeedName.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/FeedName.java

File renamed without changes.

test/integration/goldens/asset/MockAssetService.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/MockAssetService.java

File renamed without changes.

test/integration/goldens/asset/MockAssetServiceImpl.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/MockAssetServiceImpl.java

File renamed without changes.

test/integration/goldens/asset/gapic_metadata.json renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/gapic_metadata.json

File renamed without changes.

test/integration/goldens/asset/package-info.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/package-info.java

File renamed without changes.

test/integration/goldens/asset/AssetServiceStub.java renamed to test/integration/goldens/asset/com/google/cloud/asset/v1/stub/AssetServiceStub.java

File renamed without changes.

0 commit comments

Comments
 (0)