diff --git a/e2e/binary/git/BUILD.bazel b/e2e/binary/git/BUILD.bazel index 51e8901855da16003ea6364db4a0f2d46aeed778..5cb151eff6aae07679ab7fd86759915c46f9cc87 100644 --- a/e2e/binary/git/BUILD.bazel +++ b/e2e/binary/git/BUILD.bazel @@ -1,11 +1,32 @@ -load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@rules_python_pytest//python_pytest:defs.bzl", "py_pytest_test") +load("@bazel_skylib//rules:native_binary.bzl", "native_test") -# TODO: write an _actual_ test for `git` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["config.py"], + data = [ + "fixture.txt", + "expected.txt", + "@ape//ape:git", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "git", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:git"], + src = "@ape//ape:git", + args = ["--version"], +) + +test_suite( + name = "git", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/git/config.py b/e2e/binary/git/config.py new file mode 100644 index 0000000000000000000000000000000000000000..d6bfc7db4866409d7d54b8b067d27c2e5e214bdb --- /dev/null +++ b/e2e/binary/git/config.py @@ -0,0 +1,19 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Diff, Relative, Tool + + +def test_config(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("git") + fixture = relative("fixture.txt") + expected = relative("expected.txt") + output = tmp_path / "output.txt" + + cmd = (binary, "config", f"--file={str(fixture)}", "--get", "core.bare") + with open(output, "w") as stream: + run(cmd, check=True, timeout=30, stdout=stream) + + assert Diff(expected) == Diff(output) diff --git a/e2e/binary/git/expected.txt b/e2e/binary/git/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..c508d5366f70bba37fcc09d128b6537c4adb2c79 --- /dev/null +++ b/e2e/binary/git/expected.txt @@ -0,0 +1 @@ +false diff --git a/e2e/binary/git/fixture.txt b/e2e/binary/git/fixture.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7a1e0a6fb4299c829ca9d88c14fb0aa8a22ac42 --- /dev/null +++ b/e2e/binary/git/fixture.txt @@ -0,0 +1,8 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[branch "main"] + remote = origin + merge = refs/heads/main