Use private host transport in containerized CI

This commit is contained in:
2026-07-20 00:27:41 -07:00
parent c2914af401
commit bf20a84a94
4 changed files with 45 additions and 2 deletions

View File

@@ -108,6 +108,23 @@ class ImageContractEvidenceTest < Minitest::Test
assert_failed_without_docker(evidence_path)
end
def test_rejects_malformed_ipv6_and_public_probe_hosts_before_docker
checkout, commit = git_checkout
["not-an-address", "::1", "8.8.8.8"].each_with_index do |probe_host, index|
evidence_path = File.join(@tmp, "probe-host-#{index}.json")
environment = base_environment(checkout, commit, evidence_path).merge(
"OPENCODE_PROBE_HOST" => probe_host
)
_output, error, status = run_contract(environment)
assert_equal 2, status.exitstatus
assert_match(/loopback or private IPv4 address/, error)
assert_failed_without_docker(evidence_path)
end
end
private
def base_environment(checkout, commit, evidence_path)

View File

@@ -287,6 +287,9 @@ class RepositoryTest < Minitest::Test
assert_includes workflow, "exact-image-contract-gitea:"
assert_includes workflow, "if: github.server_url != 'https://github.com'"
assert_includes workflow, "run: scripts/run_image_matrix_contract.sh"
assert_includes workflow, "ip -4 route show default"
assert_includes workflow, "address.ipv4? && address.private?"
assert_includes workflow, 'echo "OPENCODE_PROBE_HOST=$probe_host" >> "$GITHUB_ENV"'
assert_operator workflow.scan('BUNDLE_GEMFILE: ${{ github.workspace }}/ruby-client/Gemfile').length, :>=, 2
assert_operator workflow.scan("generated JSON is transient and is not review evidence").length, :>=, 3
@@ -327,6 +330,9 @@ class RepositoryTest < Minitest::Test
assert_includes runner, "exact_live_contract.rb"
assert_includes runner, 'docker cp "$repo_root/scripts/fake_llm.py"'
refute_includes runner, '--volume "$repo_root/scripts:/compat:ro"'
assert_includes runner, '--publish "${probe_host}::4096"'
assert_includes runner, 'base_url="http://${probe_host}:${host_port}"'
refute_includes runner, "--publish 0.0.0.0"
assert_includes runner, "OPENCODE_COMPAT_EVIDENCE_PATH"
assert_includes runner, "OPENCODE_EXPECTED_VERSION"
refute_match(/request_count.*-lt\s+1/, runner)