Skip to content

Commit

Permalink
chore: Fix tests (#84)
Browse files Browse the repository at this point in the history
- Skip UDS tests if not running on Linux
  docker/for-mac#483
- Test against correct Go versions
  actions/setup-go#491

Signed-off-by: Andrew Haines <[email protected]>
  • Loading branch information
haines authored Nov 4, 2024
1 parent 1e30995 commit b3ada4a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pr-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
pull_request:
branches:
- main
env:
GOTOOLCHAIN: local
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.21", "1.22"]
go: ["1.22", "1.23"]
name: Test on Go ${{ matrix.go }}
timeout-minutes: 10
steps:
Expand All @@ -19,7 +21,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go}}
go-version: ${{ matrix.go }}
check-latest: true

- name: Install just
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Submitting pull requests
Developing Cerbos Go SDK
------------------------

We currently require Go 1.20.x for development. [Just](https://just.systems/man/en/chapter_1.html) is used for build tasks. Run `just` at the root of the directory to see the list of available targets.
We currently require Go 1.22.x for development. [Just](https://just.systems/man/en/chapter_1.html) is used for build tasks. Run `just` at the root of the directory to see the list of available targets.
8 changes: 8 additions & 0 deletions cerbos/grpc_linux_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2021-2024 Zenauth Ltd.
// SPDX-License-Identifier: Apache-2.0

//go:build tests && linux

package cerbos_test

const osSupportsUDS = true
8 changes: 8 additions & 0 deletions cerbos/grpc_other_oses_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2021-2024 Zenauth Ltd.
// SPDX-License-Identifier: Apache-2.0

//go:build tests && !linux

package cerbos_test

const osSupportsUDS = false
4 changes: 4 additions & 0 deletions cerbos/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ func TestGRPCClient(t *testing.T) {
})

t.Run("uds", func(t *testing.T) {
if !osSupportsUDS {
t.Skip("Sharing a Unix domain socket over a Docker bind mount is not supported on this operating system")
}

tempDir := t.TempDir()
s, err := launcher.Launch(testutil.LaunchConf{
ConfFilePath: tc.confFilePath,
Expand Down

0 comments on commit b3ada4a

Please sign in to comment.