-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add generation config comparator (#2587)
In this PR: - Add a generation config comparator to compare the change type and which libraries are affected by the change. - Refactor `LibraryConfig`. - Add unit tests (no integration tests because the comparator has not been used). The comparator makes assumptions that the following library level parameters will not change: - googleapis commit (no use case) This is the first step to [improve](https://docs.google.com/document/d/1JiCcG3X7lnxaJErKe0ES_JkyU7ECb40nf2Xez3gWvuo/edit?tab=t.g3vua2kd06gx#heading=h.pygigzqg78jp) performance of hermetic code generation.
- Loading branch information
1 parent
4c7fd88
commit a94c2f0
Showing
8 changed files
with
868 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
39 changes: 39 additions & 0 deletions
39
library_generation/test/model/library_config_unit_tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import unittest | ||
|
||
from library_generation.model.library_config import LibraryConfig | ||
|
||
|
||
class LibraryConfigTest(unittest.TestCase): | ||
def test_get_library_returns_library_name(self): | ||
library = LibraryConfig( | ||
api_shortname="secret", | ||
name_pretty="", | ||
product_documentation="", | ||
api_description="", | ||
gapic_configs=list(), | ||
library_name="secretmanager", | ||
) | ||
self.assertEqual("secretmanager", library.get_library_name()) | ||
|
||
def test_get_library_returns_api_shortname(self): | ||
library = LibraryConfig( | ||
api_shortname="secret", | ||
name_pretty="", | ||
product_documentation="", | ||
api_description="", | ||
gapic_configs=list(), | ||
) | ||
self.assertEqual("secret", library.get_library_name()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.