Skip to content

Commit

Permalink
Newer linter requires better tests (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Oct 24, 2023
1 parent 297e802 commit ac26b7f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 62 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ jobs:

steps:
- name: Log in to the container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false

- name: Lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -48,7 +49,7 @@ jobs:
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
- name: Build and push image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand All @@ -60,7 +61,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go 1.21
uses: actions/setup-go@v4
Expand Down
7 changes: 4 additions & 3 deletions api/v2/helper/shoot_access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/metal-stack/metal-lib/pkg/genericcli"
"github.com/metal-stack/metal-lib/pkg/testcommon"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -70,11 +71,11 @@ users:
}

if got != nil {
assert.Equal(t, got.Host, "https://shoot-name")
assert.Equal(t, "https://shoot-name", got.Host)
}

gotRaw, err := h.Raw(context.Background())
assert.NoError(t, err)
require.NoError(t, err)
equal, err := genericcli.YamlIsEqual(gotRaw, []byte(`apiVersion: v1
clusters:
- cluster:
Expand All @@ -95,7 +96,7 @@ users:
user:
token: /var/run/secrets/gardener.cloud/shoot/generic-kubeconfig/token
`))
assert.NoError(t, err)
require.NoError(t, err)
assert.True(t, equal)
})
}
Expand Down
33 changes: 16 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ require (
github.com/go-logr/logr v1.2.4
github.com/go-logr/zapr v1.2.4
github.com/go-openapi/strfmt v0.21.7
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.3.1
github.com/metal-stack/metal-go v0.23.2
github.com/metal-stack/metal-lib v0.13.2
github.com/metal-stack/metal-go v0.24.3
github.com/metal-stack/metal-lib v0.13.5
github.com/metal-stack/v v1.0.3
github.com/onsi/ginkgo/v2 v2.12.0
github.com/onsi/gomega v1.27.10
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.28.1
github.com/stretchr/testify v1.8.4
go.uber.org/zap v1.25.0
go.uber.org/zap v1.26.0
k8s.io/api v0.26.3
k8s.io/apimachinery v0.27.4
k8s.io/client-go v0.26.3
Expand Down Expand Up @@ -83,7 +83,7 @@ require (
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/metal-stack/security v0.6.6 // indirect
github.com/metal-stack/security v0.6.7 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
Expand Down Expand Up @@ -111,26 +111,25 @@ require (
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/vincent-petithory/dataurl v1.0.0 // indirect
go.mongodb.org/mongo-driver v1.12.0 // indirect
go.mongodb.org/mongo-driver v1.12.1 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.3 // indirect
Expand Down
Loading

0 comments on commit ac26b7f

Please sign in to comment.