Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ggj][infra][3/5] feat: implement update golden bazel rules for dummy test#314

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
xiaozhenliu-gg5 merged 45 commits intomasterfromupdate_golden_bazel
Sep 24, 2020

Conversation

@xiaozhenliu-gg5
Copy link
Contributor

@xiaozhenliu-gg5xiaozhenliu-gg5 commentedSep 18, 2020
edited
Loading

Find more details in design doc: go/java-micro-file-diff-infra

  1. Addedrules_bazel/java_diff_test.bzl whereupdate_golden bazel rule is defined, including two parts: running JUnit test and overwritting goldens.
  2. AddedSingleJUnitTestRunner which helps us to manually trigger the JUnit test, it takestest_class_name as arg and emits test result if any failure is detected.
  3. AddedUtils.java intest/framework which helps to save the generated code from JUnit test to tmp file in folder$TEST_OUTPUT_HOME. System environment is set to interact with update golden bazel rules, the folder will get deleted once the bazel rules finish.
  4. update_golden rule is called fromBUILD.bazel in dummy test, andjunit_runner_binary is defined for running the JUnit test when updating goldens.

How we use it (check out this branch and modify the dummy/goldens/*.golden)

> bazel test //...Tests have failures: [classWithHeader(com.google.api.generator.gapic.dummy.FileDiffInfraDummyTest): Differences found: --- golden+++ codegen@@ -17,3 +17,3 @@ package com.google.showcase.v1beta1.stub; -public class  {}+public class EchoStubSettings {}]//src/test/java/com/google/api/generator/gapic/dummy:FileDiffInfraDummyTest FAILED in 5.6s  /private/var/tmp/_bazel_xiaozhenliu/27d546162d4fdfcb8b9c40b4c5bf4971/execroot/com_google_api_codegen/bazel-out/darwin-fastbuild/testlogs/src/test/java/com/google/api/generator/gapic/dummy/FileDiffInfraDummyTest/test.log> bazel run //src/test/java/com/google/api/generator/gapic/dummy:FileDiffInfraDummyTest_update> bazel test //........Executed 53 out of 66 tests: 66 tests pass.

Next step would be:

  1. Move the existing expected class string to file-diff infra, including
    (a)gapic/composer/*Test.
    (b)engine/astIntegrationTest
  2. Update developer doc to include this instruction for updating goldens.

Copy link
Contributor

@vam-googlevam-google left a comment
edited
Loading

Choose a reason for hiding this comment

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

It looks good. I left quite a few comments, but most of them are minor and/or optional.

My only real concern is the general structure of the BUILD.bazel files (if we don't be careful here, we may end up in a very verbose layout, with many BUILD files everywhere and many targets being redeclared in each BUILD file, which will be very difficult to maintain).

xiaozhenliu-gg5 reacted with thumbs up emoji
Copy link
Contributor

@miraleungmiraleung left a comment
edited
Loading

Choose a reason for hiding this comment

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

It looks good. I left quite a few comments, but most of them are minor and/or optional.

My only real concern is the general structure of the BUILD.bazel files (if we don't be careful here, we may end up in a very verbose layout, with many BUILD files everywhere and many targets being redeclared in each BUILD file, which will be very difficult to maintain).

The motivation for the BUILD file structure in this repo is to keep individual repos self-contained (following google3 style), so the proliferation of files is fine.

Otherwise +1 to Vadym's comments below.

@xiaozhenliu-gg5xiaozhenliu-gg5 merged commit26611d7 intomasterSep 24, 2020
@xiaozhenliu-gg5xiaozhenliu-gg5 deleted the update_golden_bazel branchSeptember 24, 2020 17:40
@miraleung
Copy link
Contributor

From a clean client, I tried running this update command, and got the error below, plus lots of warnings. Seems that this isn't working and requires each incremental target to be built first, whereas it should all just work withbazel run. I'll fix these issues too.

bazel run //src/test/java/com/google/api/generator/gapic/dummy:FileDiffInfraDummyTest_updateTarget //src/test/java/com/google/api/generator/gapic/dummy:FileDiffInfraDummyTest_update up-to-date:  bazel-bin/src/test/java/com/google/api/generator/gapic/dummy/FileDiffInfraDummyTest_update.shINFO: Elapsed time: 8.211s, Critical Path: 0.06sINFO: 0 processes.INFO: Build completed successfully, 4 total actionsINFO: Build completed successfully, 4 total actionsunzip:  cannot find or open bazel-out/k8-fastbuild/bin/src/test/java/com/google/api/generator/gapic/dummy/FileDiffInfraDummyTest_update_output.zip, bazel-out/k8-fastbuild/bin/src/test/java/com/google/api/generator/gapic/dummy/FileDiffInfraDummyTest_update_output.zip.zip or bazel-out/k8-fastbuild/bin/src/test/java/com/google/api/generator/gapic/dummy/FileDiffInfraDummyTest_update_output.zip.ZIP.

@miraleung
Copy link
Contributor

Another one I found: In a clean client, I get this error, even though it updates fine:

Error occurs when reading golden file

@miraleung
Copy link
Contributor

Fixed all of these in#363.

@xiaozhenliu-gg5
Copy link
ContributorAuthor

This implementation was based on the prerequisites of users runningbazel test orbazel build first before updating any goldens files. The usage was described in the description, but it does not support directlybazel run testTarget_update for updating goldens before any test run.
Error occurs when reading golden file only happens when not finding/reading the goldens files, I did not have chance to repro that error, but thanks for the refactor to allow the direct usage of update_goldens.

suztomo pushed a commit that referenced this pull requestDec 16, 2022
* chore: fix auto-release* chore: remove codecov.yml* chore: update license headers for yaml filesSource-Link:googleapis/synthtool@5b77727Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:ebc2104854c5b81c6fd72ca79400a2e20e0d510c5e0654fd1a19e5c9be160ca6
suztomo pushed a commit that referenced this pull requestDec 16, 2022
🤖 I have created a release *beep* *boop*---### [1.2.11](googleapis/java-iam@v1.2.10...v1.2.11) (2022-03-25)### Dependencies* update dependency com.google.api:api-common to v2.1.5 ([#313](googleapis/java-iam#313)) ([08a700e](googleapis/java-iam@08a700e))---This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
suztomo pushed a commit that referenced this pull requestMar 21, 2023
not needed since we removed v2 solution -googleapis/synthtool#964Source-Author: Emily Ball <emilyball@google.com>Source-Date: Mon Mar 29 14:47:37 2021 -0700Source-Repo: googleapis/synthtoolSource-Sha: 572ef8f70edd9041f5bcfa71511aed6aecfc2098Source-Link:googleapis/synthtool@572ef8f
suztomo pushed a commit that referenced this pull requestMar 21, 2023
🤖 I have created a release \*beep\* \*boop\* ---### [1.93.10](https://www.github.com/googleapis/java-core/compare/v1.93.9...v1.93.10) (2020-10-30)### Dependencies* update core dependencies ([#294](https://www.github.com/googleapis/java-core/issues/294)) ([5f6b784](https://www.github.com/googleapis/java-core/commit/5f6b784ad94b71553d339e3450b17f70dd307e6d))* update core transport dependencies ([#295](https://www.github.com/googleapis/java-core/issues/295)) ([39fdd06](https://www.github.com/googleapis/java-core/commit/39fdd06a84a92c2d314c9de8b1baba0cd5b6589d))* update dependency com.google.api:api-common to v1.10.1 ([#302](https://www.github.com/googleapis/java-core/issues/302)) ([6ebd6b1](https://www.github.com/googleapis/java-core/commit/6ebd6b186dc99bc0a306e2b28150d84c6e6d8125))* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.2 ([#312](https://www.github.com/googleapis/java-core/issues/312)) ([e416c1c](https://www.github.com/googleapis/java-core/commit/e416c1cafdafac7165f986194a028096ff936993))* update dependency com.google.guava:guava-bom to v30 ([#310](https://www.github.com/googleapis/java-core/issues/310)) ([1026809](https://www.github.com/googleapis/java-core/commit/1026809177b3460a7170e13cb205b8505bde1ddb))* update dependency io.grpc:grpc-bom to v1.33.0 ([#309](https://www.github.com/googleapis/java-core/issues/309)) ([e021cb0](https://www.github.com/googleapis/java-core/commit/e021cb0943b7b538df79941f98c46cbc53633959))* update dependency org.threeten:threetenbp to v1.4.5 ([#297](https://www.github.com/googleapis/java-core/issues/297)) ([9286f76](https://www.github.com/googleapis/java-core/commit/9286f761449ae51bd7ae4fe84494f9b987a45623))* update dependency org.threeten:threetenbp to v1.5.0 ([#314](https://www.github.com/googleapis/java-core/issues/314)) ([35bcf4d](https://www.github.com/googleapis/java-core/commit/35bcf4d3ff1f47295a466ff37685b7b526af2b1a))---This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@summer-ji-engsummer-ji-engAwaiting requested review from summer-ji-eng

@vam-googlevam-googleAwaiting requested review from vam-google

1 more reviewer

@miraleungmiraleungmiraleung approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@xiaozhenliu-gg5@miraleung@vam-google

[8]ページ先頭

©2009-2025 Movatter.jp