Alex Klein | 3970133 | 2021-02-24 14:34:58 -0700 | [diff] [blame] | 1 | # Copyright 2021 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """compile_build_api_proto tests.""" |
| 6 | |
| 7 | from google import protobuf |
| 8 | from chromite.api import compile_build_api_proto |
| 9 | |
| 10 | |
| 11 | def test_versions_match(): |
| 12 | """Verify the versions match. |
| 13 | |
| 14 | The protoc version in the compile script needs to be compatible with the |
| 15 | version of the library we're using (in chromite/third_party). For now, that |
| 16 | means we're checking equality. |
| 17 | |
| 18 | TODO: Investigate whether, e.g. 1.2.0 ~= 1.2.3, and we only need to check the |
| 19 | major and minor components. |
| 20 | TODO: Investigate using protobuf.__version__ instead of hard coding a version |
| 21 | in compile_build_api_proto. |
| 22 | """ |
| 23 | assert compile_build_api_proto.PROTOC_VERSION == protobuf.__version__, ( |
| 24 | 'The protobuf library or compile_build_api_proto.PROTOC_VERSION has been ' |
| 25 | 'updated, but the other has not. They must be updated together.') |