Skip to content

Improve Test Coverage for udp.go - UDPDialerSession #2892

Improve Test Coverage for udp.go - UDPDialerSession

Improve Test Coverage for udp.go - UDPDialerSession #2892

---
name: Codecov
on: # yamllint disable-line rule:truthy
pull_request: # yamllint disable-line rule:empty-values
push:
branches: [devel]
env:
DESIRED_GO_VERSION: '1.23'
DESIRED_PYTHON_VERSION: '3.12'
jobs:
go_test_coverage:
name: go test coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.DESIRED_GO_VERSION }}
- name: build and install receptor
run: |
make build-all
sudo cp ./receptor /usr/local/bin/receptor
- name: Download kind binary
run: curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 && chmod +x ./kind
- name: Create k8s cluster
run: ./kind create cluster
- name: Interact with the cluster
run: kubectl get nodes
- name: Run receptor tests with coverage
run: make coverage
- name: Set up nox
uses: wntrblm/nox@2025.11.12
with:
python-versions: ${{ env.DESIRED_PYTHON_VERSION }}
- name: Provision nox environment for coverage
run: nox --install-only --session coverage
working-directory: ./receptorctl
- name: Run `receptorctl` nox coverage session
run: nox --no-install --session coverage
working-directory: ./receptorctl
- name: SonarCube Static Scans (on push)
uses: SonarSource/sonarqube-scan-action@v6
if: github.event_name == 'push' && github.repository == 'ansible/receptor'
env:
SONAR_TOKEN: ${{ secrets[format('{0}', vars.SONAR_TOKEN_SECRET_NAME)] }}
with:
args: >
-Dsonar.go.coverage.reportPaths=coverage.txt
-Dsonar.python.coverage.reportPaths=receptorctl/receptorctl_coverage.xml
- name: Upload Code Coverage Report from Receptor Unit Tests
uses: actions/upload-artifact@v5
with:
name: receptor-coverage-report
path: coverage.txt
- name: Save off PR Number
run: echo "PR ${{ github.event.number }}" > pr_number.txt
- name: Upload PR Number
uses: actions/upload-artifact@v5
with:
name: pr_number
path: pr_number.txt
- name: get k8s logs
if: ${{ failure() }}
run: .github/workflows/artifact-k8s-logs.sh
- name: Archive receptor binary
uses: actions/upload-artifact@v5
with:
name: receptor
path: /usr/local/bin/receptor
- name: Upload Code Coverage Report from Receptorctl Unit Tests
uses: actions/upload-artifact@v5
with:
name: receptorctl-coverage-report
path: receptorctl/receptorctl_coverage.xml