generated from bazel-contrib/rules-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix download filename for RC versions (#37)
* fix filename for rc versions * chore: restore example * chore: format --------- Co-authored-by: Andy Aylward <[email protected]>
- Loading branch information
Showing
3 changed files
with
50 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
load(":prebuilt_protoc_toolchain_test.bzl", "release_version_to_artifact_name_test_suite") | ||
|
||
bzl_library( | ||
name = "versions", | ||
srcs = ["versions.bzl"], | ||
visibility = ["//protoc:__subpackages__"], | ||
) | ||
|
||
release_version_to_artifact_name_test_suite() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Unit test suite for version-to-artifact-name resolution helper. | ||
Based on the example at https://bazel.build/rules/testing#testing-starlark-utilities | ||
""" | ||
|
||
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") | ||
load(":prebuilt_protoc_toolchain.bzl", "release_version_to_artifact_name") | ||
load(":versions.bzl", "PROTOC_VERSIONS") | ||
|
||
def _release_version_to_artifact_name_test_impl(ctx): | ||
env = unittest.begin(ctx) | ||
count = 0 | ||
|
||
for release_version in PROTOC_VERSIONS: | ||
artifact_name = release_version_to_artifact_name(release_version, "linux-x86_64") | ||
artifact_dict = PROTOC_VERSIONS[release_version] | ||
|
||
# there should be a linux-x86_64 artifact in every release | ||
asserts.true(env, artifact_name in artifact_dict, "'{}' not found for release version '{}'".format(artifact_name, release_version)) | ||
count += 1 | ||
|
||
asserts.true(env, count > 0, "no versions tested") | ||
return unittest.end(env) | ||
|
||
release_version_to_artifact_name_test = unittest.make(_release_version_to_artifact_name_test_impl) | ||
|
||
def release_version_to_artifact_name_test_suite(): | ||
unittest.suite( | ||
"release_version_to_artifact_name_tests", | ||
release_version_to_artifact_name_test, | ||
) |