Files
coredns/.github/workflows/go.test.yml
houyuwushang 0fe7b08fbb core/dnsserver: preserve UDP packet destination addresses (#8644)
* core/dnsserver: preserve UDP packet destination addresses

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>

* test: modernize reverse UDP reply traversal

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>

* test: account for Unix IPv4 source-control capabilities

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>

---------

Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>
2026-10-20 20:34:18 -07:00

191 lines
5.6 KiB
YAML

name: Go Tests
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
id: go
- name: Build
run: go build -v ./...
- name: Test
run: |
( cd request; go test -race ./... )
( cd core; go test -race ./... )
( cd coremain; go test -race ./... )
- name: Build manual-registration mode
run: go build -tags=coredns_manual_registration ./...
- name: Test manual-registration mode
run: go test -race -tags=coredns_manual_registration ./core/dnsserver ./coremain
test-windows:
name: Test Windows
runs-on: windows-latest
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
id: go
- name: Build
run: go build -v ./...
- name: Test
shell: bash
run: |
( cd request; go test -race ./... )
( cd core; go test -race ./... )
( cd coremain; go test -race ./... )
- name: Build manual-registration mode
run: go build -tags=coredns_manual_registration ./...
- name: Test manual-registration mode
run: go test -race -tags=coredns_manual_registration ./core/dnsserver ./coremain
- name: Test UDP destination views
run: go test -race ./test -run '^TestViewServerIP'
test-plugins:
name: Test Plugins
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
id: go
- name: Build
run: go build -v ./...
- name: Test
shell: bash
run: ( cd plugin; go test -race ./... )
test-udp-macos:
name: Test UDP macOS
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
- name: Add a second loopback address
run: sudo ifconfig lo0 alias 127.0.0.2
- name: Test UDP destination addresses
run: |
go test -race ./core/dnsserver ./plugin/pkg/proxyproto ./request
go test -race ./test -run '^TestViewServerIP'
test-e2e:
name: Test e2e
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
id: go
- name: Build
run: go build -v ./...
- name: Install clients for DDNS interoperability tests
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends bind9-dnsutils kea-dhcp-ddns-server
nsupdate -V
kea-dhcp-ddns -v
# Keep the distribution AppArmor profile and use its allowed paths.
sudo systemctl stop kea-dhcp-ddns-server
sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /etc/kea/coredns-tests
sudo install -d -m 0755 -o "$(id -u)" -g "$(id -g)" /run/kea
sudo install -m 0600 -o "$(id -u)" -g "$(id -g)" /dev/null /run/kea/logger_lockfile
test ! -e /run/kea/kea-dhcp-ddns.kea-dhcp-ddns.pid
- name: Test
env:
COREDNS_KEA_CONFIG_DIR: /etc/kea/coredns-tests
KEA_PIDFILE_DIR: /run/kea
KEA_LOCKFILE_DIR: /run/kea
run: |
( cd test; go test -race ./... )
test-makefile-release:
name: Test Makefile.release
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install dependencies
run: sudo apt-get install make curl
- name: Test Makefile.release release
run: make GITHUB_ACCESS_TOKEN=x release -f Makefile.release
- name: Test Makefile.release release/github-push (dry-run)
run: make GITHUB_ACCESS_TOKEN=x -n release github-push -f Makefile.release
- name: Test Makefile.docker release/github-push (dry-run)
run: make VERSION=x DOCKER=x -n release docker-push -f Makefile.docker
- name: Prepare Docker build
run: |
for arch in amd64 arm arm64 mips64le ppc64le s390x riscv64 loong64; do
mkdir -p build/docker/$arch
cp build/linux/$arch/coredns build/docker/$arch/
done
- name: Test Makefile.docker build
run: make VERSION=x DOCKER=x -f Makefile.docker docker-build