Container Testing Rule

August 9, 2020 ยท View on GitHub

Overview

Provides a container_test rule that can test containers built with rules_docker.

Setup

After the rules_docker setup add the following to your WORKSPACE file:

http_archive(
    name = "bazel_rules_container_test",
    sha256 = "0ea03839bf059c0ec7c4f95cb6cb048b84094b180b051c737cbef9ca150bcc0b",
    strip_prefix = "bazel_rules_container_test-0.11.0",
    url = "https://github.com/guymers/bazel_rules_container/archive/0.11.0.tar.gz",
)

Example

load("@bazel_rules_container_test//container:test.bzl", "container_test")

container_test(
    name = "nodejs",
    read_only = False,
    size = "small",
    files = [
        "project/index.js",
        "project/package.json",
    ],
    golden = "output.txt",
    image = "//nodejs",
    test = "test.sh",
)

Docs

container_test

container_test(name, daemon, env, error, files, golden, image, incremental_load_template, mem_limit,
               options, read_only, regex, test, tmpfs_directories, volume_files, volume_mounts)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
daemon-BooleanoptionalFalse
env-Dictionary: String -> Stringoptional{}
error-Integeroptional0
files-List of labelsoptional[]
golden-LabeloptionalNone
image-LabeloptionalNone
incremental_load_template-Labeloptional@io_bazel_rules_docker//container:incremental_load_template
mem_limit-Stringoptional""
options-List of stringsoptional[]
read_only-BooleanoptionalTrue
regex-BooleanoptionalFalse
test-LabeloptionalNone
tmpfs_directories-List of stringsoptional[]
volume_files-List of labelsoptional[]
volume_mounts-List of stringsoptional[]