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

chore: capture upgrading to rest_numeric_enums=False in baseline #120

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ py_gapic_library(
name = "library_py_gapic",
srcs = [":library_proto"],
grpc_service_config = "library_example_grpc_service_config.json",
rest_numeric_enums = True,
rest_numeric_enums = False,
service_yaml = "library_example_v1.yaml",
transport = "grpc+rest",
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public void testRegeneration() throws IOException, InterruptedException {
buildozer.batchSetStringAttribute(
gapicBuildFilePath, "library_java_gapic", "transport", "lightning");
buildozer.batchRemoveAttribute(
gapicBuildFilePath, "library_go_gapic", "rest_numeric_enums");
gapicBuildFilePath, "library_py_gapic", "rest_numeric_enums");
buildozer.batchSetStringAttribute(
gapicBuildFilePath, "library_go_gapic", "rest_numeric_enums", "Apennines");

// The following values should NOT be preserved:
buildozer.batchSetStringAttribute(
Expand Down Expand Up @@ -176,6 +178,9 @@ public void testRegeneration() throws IOException, InterruptedException {
buildozer.getAttribute(gapicBuildFilePath, "%java_gapic_library", "transport"));
Assert.assertEquals(
"False",
buildozer.getAttribute(gapicBuildFilePath, "%py_gapic_library", "rest_numeric_enums"));
Assert.assertEquals(
"Apennines",
buildozer.getAttribute(gapicBuildFilePath, "%go_gapic_library", "rest_numeric_enums"));

// Check that grpc_service_config value is not preserved:
Expand All @@ -186,22 +191,6 @@ public void testRegeneration() throws IOException, InterruptedException {
// Check that the changed root file is preserved
Assert.assertEquals(changedRootContent, ApisVisitor.readFile(rootBuildFilePath));


//// START section to be consolidated
// TODO: Consolidate this test attribute change with the other ones above, so we only run
// `buildozer.commit() and the BuildFileGenerator once. To do this, we need to make each change
// in a separate language, but at the moment, we're only supporting "rest_numeric_enums" in one
// language.
buildozer.batchSetStringAttribute(
gapicBuildFilePath, "library_go_gapic", "rest_numeric_enums", "Apennines");
buildozer.commit();
new BuildFileGenerator()
.generateBuildFiles(args.createApisVisitor(null, tempDirPath.toString()));
Assert.assertEquals(
"Apennines",
buildozer.getAttribute(gapicBuildFilePath, "%go_gapic_library", "rest_numeric_enums"));
//// END section to be consolidated

// Since buildozer does not differentiate between string and non-string values, we need to
// compare to a baseline to ensure the updates were coded with or without quotes, as appropriate.
ArgsParser argsUpdate =
Expand Down