Skip to content

Commit a9a5b92

Browse files
tetragon/windows: Run unit tests on Windows
This PR enabled running unit tests on Windows on a windows-latest runner. Tests are run on cmd and pkg folders Signed-off-by: Anadi Anadi<[email protected]>
1 parent cecf673 commit a9a5b92

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Tetragon Go Test (Windows)
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- 'docs/**'
6+
push:
7+
branches:
8+
- main
9+
paths-ignore:
10+
- 'docs/**'
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
timeout-minutes: 40
15+
strategy:
16+
fail-fast: false
17+
steps:
18+
- name: Install Go
19+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
20+
with:
21+
# renovate: datasource=golang-version depName=go
22+
go-version: '1.24.2'
23+
24+
- name: Checkout code
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
with:
27+
path: go/src/github.com/cilium/tetragon/
28+
29+
30+
- name: Run go tests
31+
working-directory: ${{ github.workspace }}\go\src\github.com\cilium\tetragon
32+
run: |
33+
env
34+
dir
35+
go test --failfast .\pkg\... .\cmd\...
36+
37+
38+

cmd/tetragon/main_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// Copyright Authors of Tetragon
33

4+
//go:build !windows
5+
46
package main
57

68
import (

pkg/sensors/exec/procevents/proc_reader_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package procevents
55

66
import (
77
"os/exec"
8+
"runtime"
89
"strconv"
910
"strings"
1011
"testing"
@@ -29,7 +30,7 @@ func TestListRunningProcs(t *testing.T) {
2930
}
3031

3132
func TestInInitTreeProcfs(t *testing.T) {
32-
if err := exec.Command("docker", "version").Run(); err != nil {
33+
if err := exec.Command("docker", "version").Run(); (err != nil) || (runtime.GOOS == "windows") {
3334
t.Skipf("docker not available. skipping test: %s", err)
3435
}
3536

0 commit comments

Comments
 (0)