Skip to content

Move integration tests into script_test - #226

Open
Bencodes wants to merge 1 commit into
masterfrom
move-integration-tests-into-script_test
Open

Move integration tests into script_test#226
Bencodes wants to merge 1 commit into
masterfrom
move-integration-tests-into-script_test

Conversation

@Bencodes

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 18, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the integration tests from ad hoc shell scripts into a Bazel script_test-based integration suite with shared helpers and generated inner-workspace fixtures.

Changes:

  • Replaces individual integration shell scripts and checked-in test fixtures with a consolidated integration_test.sh.
  • Adds shared integration/bashunit helpers and new Bazel test targets.
  • Updates module dependencies and CI to run the new integration test target.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
.github/workflows/main.yml Runs the new Bazel integration test suite in CI.
BUILD.bazel Exports MODULE.bazel for test runfiles.
MODULE.bazel Adds dev dependencies and fetched bashunit files for integration testing.
tests/bashunit/BUILD Packages bashunit helper files for shell tests.
tests/integration/BUILD Defines the new script_test integration suite.
tests/integration/integration_helper.sh Adds shared setup/build/report helpers for integration tests.
tests/integration/integration_test.sh Adds consolidated integration test cases.
tests/integration/suite.sh Removes the previous integration test driver.
tests/integration/test_baseline.sh Removes old standalone baseline test script.
tests/integration/test_baseline_plugin.sh Removes old standalone baseline plugin test script.
tests/integration/test_config_file_lenient.sh Removes old standalone config-file test script.
tests/integration/test_config_filegroup_lenient.sh Removes old standalone config-filegroup test script.
tests/integration/test_report_html.sh Removes old standalone HTML report test script.
tests/integration/test_report_text.sh Removes old standalone text report test script.
tests/integration/test_report_xml.sh Removes old standalone XML report test script.
tests/integration/detekt_baseline.xml Removes fixture now generated by the test.
tests/integration/detekt_config_lenient.yml Removes fixture now generated by the test.
tests/integration/src/main/kotlin/io/buildfoundation/bazel/detekt/A.kt Removes fixture now generated by the test.
tests/integration/src/main/kotlin/io/buildfoundation/bazel/detekt/B.kt Removes fixture now generated by the test.
tests/integration/src/main/kotlin/io/buildfoundation/bazel/detekt/C.kt Removes fixture now generated by the test.
tests/integration/src/main/kotlin/io/buildfoundation/bazel/detekt/main.kt Removes fixture now generated by the test.
Comments suppressed due to low confidence (2)

tests/integration/BUILD:29

  • Leaving this test untagged means the existing bazel test //... unit-test job will now run the full integration suite in addition to the dedicated integration-test job. That duplicates the nested Bazel integration run for every matrix entry and can substantially increase CI time/noise; add a distinct tag and filter it out of the unit-test job, or otherwise ensure it only runs in the intended workflow job.
    bazel_binaries = bazel_binaries,
    bazel_version = bazel_binaries.versions.current,
    tags = [],

tests/bashunit/BUILD:9

  • These external repositories are only introduced in MODULE.bazel; WORKSPACE.bazel has no corresponding rules_shell or bazel_unittest_* definitions. Because the project documents and CI still exercise WORKSPACE mode, this package will fail to load/analyze in that mode unless the WORKSPACE dependencies are added too.
genrule(
    name = "bashunit_sources",
    srcs = [
        "@bazel_unittest_bash//file:unittest.bash",
        "@bazel_unittest_utils_sh//file:unittest_utils.sh",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration/BUILD
Comment on lines +1 to +3
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
load("@rules_bazel_integration_test//bazel_integration_test:defs.bzl", "script_test")
load("@rules_shell//shell:sh_library.bzl", "sh_library")
Comment on lines +19 to +23
# The main repo's runfiles apparent name under bzlmod is the MODULE.bazel
# repo_name = "bazel_rules_detekt". rlocation returns 1 when a path is
# unresolvable, which would kill the script under set -e.
_helper="$(rlocation bazel_rules_detekt/tests/integration/integration_helper.sh 2>/dev/null || true)"
if [[ -z "${_helper}" ]]; then
Comment on lines +22 to +27
# Resolve a runfile under the rules_detekt main repo. The apparent repo name
# under bzlmod comes from MODULE.bazel's repo_name = "bazel_rules_detekt".
# rlocation returns 1 when a path is unresolvable, which would kill the
# script under set -e, so guard with `|| true`.
function rd_rlocation() {
rlocation "bazel_rules_detekt/$1" 2>/dev/null || true
Comment on lines +61 to +64
# The inner workspace always uses bzlmod. Bazel 9+ silently forces bzlmod
# on even when --noenable_bzlmod is passed, so a separate WORKSPACE-mode
# branch would be dead code.
write_inner_module_bazel "${rules_detekt_dir}"
Comment on lines +7 to +11
# the outer rules_detekt source tree via local_path_override (bzlmod) or
# local_repository (workspace mode), and provides utilities for emitting a
# BUILD file with a detekt target, generating cache-busting sources, and
# inspecting the resulting reports.

Comment thread tests/bashunit/BUILD
Comment on lines +1 to +2
load("@rules_shell//shell:sh_library.bzl", "sh_library")

run: cp .github/workflows/ci.bazelrc .
- name: "Integration tests (${{ matrix.mode }})"
run: bash tests/integration/suite.sh "${{ matrix.flags }}"
run: bazel test //tests/integration:integration_tests ${{ matrix.flags }} No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants