Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bazel/container_structure_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ fi
"""

def _structure_test_impl(ctx):
fixed_args = []
fixed_args = [
"--test-report $XML_OUTPUT_FILE",
"--output junit",
"--junit-suite-name $TEST_TARGET"
]
test_bin = ctx.toolchains["@container_structure_test//bazel:structure_test_toolchain_type"].st_info.binary
jq_bin = ctx.toolchains["@aspect_bazel_lib//lib:jq_toolchain_type"].jqinfo.bin

Expand Down
31 changes: 30 additions & 1 deletion bazel/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,37 @@

Verifies that the container_structure_test bazel rule exposed by this project works properly.

## Running tests with pre-compiled toolchain

```sh
cd bazel/test
bazel test ...
bazel test --enable_bzlmod ...
```
```

## Testing with local changes (non-pre-compiled toolchain)

When developing changes, you may want to test your modifications before they're compiled a release. Here's how to test with a locally built binary:

1. Build your local binary:
```sh
go build -o /tmp/container-structure-test-local ./cmd/container-structure-test/
```

2. Temporarily modify `bazel/container_structure_test.bzl`:
```sh
sed -i.bak 's|readonly st=$(rlocation {st_path})|readonly st="/tmp/container-structure-test-local"|g' bazel/container_structure_test.bzl
```

3. Run the bazel test:
```sh
cd bazel/test
bazel test :test --test_output=all
```

4. Restore the original rule:
```sh
mv bazel/container_structure_test.bzl.bak bazel/container_structure_test.bzl
```

This allows you to verify that your changes work correctly with the bazel integration before submitting them.
Loading