Skip to content

Merge pull request #461 from aojea/e2e-assert-on-behaviour #1439

Merge pull request #461 from aojea/e2e-assert-on-behaviour

Merge pull request #461 from aojea/e2e-assert-on-behaviour #1439

Workflow file for this run

# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: bats
on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
env:
GO_VERSION: "1.26"
jobs:
bats_tests:
runs-on: ubuntu-latest
name: Bats e2e tests
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: make build
- name: Setup Bats and bats libs
id: setup-bats
uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # 4.0.0
# The sandbox canary builds its own namespaces from inside a pod, and a
# user namespace is what grants it CAP_NET_ADMIN for the tun. Ubuntu
# 24.04 confines an AppArmor-unconfined process that creates one to the
# unprivileged_userns profile, which denies every capability -- so the
# namespace is created and the tun is then refused. kind runs its pods
# unconfined, so every sandbox in this cluster is that process.
- name: Let an unprivileged user namespace keep its capabilities
shell: bash
run: |
restrict=/proc/sys/kernel/apparmor_restrict_unprivileged_userns
if [[ -e "${restrict}" ]]; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
- name: Bats tests
shell: bash
env:
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
TERM: xterm
run: bats -o _artifacts --print-output-on-failure tests/e2e/
- name: Upload logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-logs-${{ env.JOB_NAME }}-${{ github.run_id }}
# tests/e2e/logs is where the bats harnesses dump container logs
# for tests that did not complete (see mesh_cleanup_test_resources).
path: |
./_artifacts
./tests/e2e/logs