blob: 751fcf49439fd0835886fc6e41cd9a79d41e0ea9 [file] [log] [blame]
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""compile_build_api_proto tests."""
from import protobuf
from chromite.api import compile_build_api_proto
def test_versions_match():
"""Verify the versions match.
The protoc version in the compile script needs to be compatible with the
version of the library we're using (in chromite/third_party). For now, that
means we're checking equality.
TODO: Investigate whether, e.g. 1.2.0 ~= 1.2.3, and we only need to check the
major and minor components.
TODO: Investigate using protobuf.__version__ instead of hard coding a version
in compile_build_api_proto.
assert compile_build_api_proto.PROTOC_VERSION == protobuf.__version__, (
'The protobuf library or compile_build_api_proto.PROTOC_VERSION has been '
'updated, but the other has not. They must be updated together.')