Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into SANDBOX-504
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryzak committed Jan 26, 2024
2 parents 3d90231 + 0594a84 commit 610c35d
Show file tree
Hide file tree
Showing 21 changed files with 228 additions and 147 deletions.
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ linters-settings:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: true
revive:
# https://golangci-lint.run/usage/linters/#revive
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports
- name: dot-imports
disabled: true

10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/codeready-toolchain/toolchain-common
go 1.20

require (
github.com/codeready-toolchain/api v0.0.0-20231129193441-f6c9b7feee01
github.com/codeready-toolchain/api v0.0.0-20240103194050-d5c7803671c1
github.com/go-logr/logr v1.2.3
github.com/gofrs/uuid v3.3.0+incompatible
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/lestrrat-go/jwx v1.2.26
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/lestrrat-go/jwx v1.2.28
github.com/magiconair/properties v1.8.5
// using latest commit from 'github.com/openshift/api branch release-4.12'
github.com/openshift/api v0.0.0-20230213134911-7ba313770556
Expand Down Expand Up @@ -42,7 +42,7 @@ require (
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
Expand All @@ -69,7 +69,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
Expand Down
17 changes: 8 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -220,8 +220,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -381,14 +381,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A=
github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y=
github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80=
github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU=
github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N+AkAr5k=
github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU=
github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE=
github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E=
github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=
github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=
github.com/lestrrat-go/jwx v1.2.26 h1:4iFo8FPRZGDYe1t19mQP0zTRqA7n8HnJ5lkIiDvJcB0=
github.com/lestrrat-go/jwx v1.2.26/go.mod h1:MaiCdGbn3/cckbOFSCluJlJMmp9dmZm5hDuIkx8ftpQ=
github.com/lestrrat-go/jwx v1.2.28 h1:uadI6o0WpOVrBSf498tRXZIwPpEtLnR9CvqPFXeI5sA=
github.com/lestrrat-go/jwx v1.2.28/go.mod h1:nF+91HEMh/MYFVwKPl5HHsBGMPscqbQb+8IDQdIazP8=
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=
github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
Expand Down Expand Up @@ -647,7 +647,6 @@ golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ func TestProcessAndApply(t *testing.T) {
createdOrUpdated, err = client.NewApplyClient(cl).Apply(context.TODO(), objs, newLabels("advanced", "john", "dev"))

// then
assert.Error(t, err)
require.Error(t, err)
assert.False(t, createdOrUpdated)
})
})
Expand Down
6 changes: 3 additions & 3 deletions pkg/cluster/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestListToolchainClusterConfigs(t *testing.T) {

// then
require.NoError(t, err)
require.Len(t, clusterConfigs, 0)
require.Empty(t, clusterConfigs)
})

t.Run("when list fails", func(t *testing.T) {
Expand All @@ -141,7 +141,7 @@ func TestListToolchainClusterConfigs(t *testing.T) {

// then
require.Error(t, err)
require.Len(t, clusterConfigs, 0)
require.Empty(t, clusterConfigs)
})

t.Run("when get secret fails", func(t *testing.T) {
Expand All @@ -156,6 +156,6 @@ func TestListToolchainClusterConfigs(t *testing.T) {

// then
require.Error(t, err)
require.Len(t, clusterConfigs, 0)
require.Empty(t, clusterConfigs)
})
}
6 changes: 3 additions & 3 deletions pkg/configuration/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func TestLoadLatest(t *testing.T) {
require.True(t, ok)
assert.Equal(t, 1100, *toolchaincfg.Spec.Host.CapacityThresholds.ResourceCapacityThreshold.DefaultThreshold)
assert.Len(t, secrets, 1)
assert.Equal(t, secrets["notification-secret"]["mailgunAPIKey"], "abc123")
assert.Equal(t, "abc123", secrets["notification-secret"]["mailgunAPIKey"])

t.Run("returns the same when the config hasn't been updated", func(t *testing.T) {
// when
Expand All @@ -235,7 +235,7 @@ func TestLoadLatest(t *testing.T) {
require.True(t, ok)
assert.Equal(t, 1100, *toolchaincfg.Spec.Host.CapacityThresholds.ResourceCapacityThreshold.DefaultThreshold)
assert.Len(t, secrets, 1)
assert.Equal(t, secrets["notification-secret"]["mailgunAPIKey"], "abc123")
assert.Equal(t, "abc123", secrets["notification-secret"]["mailgunAPIKey"])
})

t.Run("returns the new value when the config has been updated", func(t *testing.T) {
Expand All @@ -259,7 +259,7 @@ func TestLoadLatest(t *testing.T) {
require.True(t, ok)
assert.Equal(t, 2000, *toolchaincfg.Spec.Host.CapacityThresholds.ResourceCapacityThreshold.DefaultThreshold)
assert.Len(t, secrets, 1)
assert.Equal(t, secrets["notification-secret"]["mailgunAPIKey"], "abc456")
assert.Equal(t, "abc456", secrets["notification-secret"]["mailgunAPIKey"])
})
})

Expand Down
6 changes: 3 additions & 3 deletions pkg/configuration/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestLoadFromConfigMap(t *testing.T) {

// test env vars are parsed and created correctly
testTest := os.Getenv("MEMBER_OPERATOR_TEST_KEY_ONE")
assert.Equal(t, testTest, "")
assert.Equal(t, "", testTest)
})
t.Run("env overwrite", func(t *testing.T) {
// given
Expand All @@ -95,7 +95,7 @@ func TestLoadFromConfigMap(t *testing.T) {

// test env vars are parsed and created correctly
testTest := os.Getenv("MEMBER_OPERATOR_TEST_KEY")
assert.Equal(t, testTest, "test-value")
assert.Equal(t, "test-value", testTest)
})
}

Expand Down Expand Up @@ -171,7 +171,7 @@ func TestLoadFromSecret(t *testing.T) {
require.NoError(t, err)

// test env vars are parsed and created correctly
assert.Equal(t, 1, len(secretData))
assert.Len(t, secretData, 1)
assert.Equal(t, "test-value", secretData["test.key"])
})
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/spacebinding/spacebindinglister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ func TestNewSpaceBindingLister(t *testing.T) {
// then
spaceBindings, err := spaceBindingLister.ListForSpace(tc.space, []toolchainv1alpha1.SpaceBinding{})
if tc.expectedErr != "" {
assert.EqualError(t, err, tc.expectedErr)
require.EqualError(t, err, tc.expectedErr)
} else {
assert.NoError(t, err)
require.NoError(t, err)
assert.Len(t, spaceBindings, len(tc.expectedSpaceBindings), "invalid number of spacebindings")
for _, expectedSpaceBinding := range tc.expectedSpaceBindings {
found := false
Expand Down Expand Up @@ -398,7 +398,7 @@ func TestNewSpaceBindingLister(t *testing.T) {

// then
spaceBindings, err := spaceBindingLister.ListForSpace(tc.space, []toolchainv1alpha1.SpaceBinding{})
assert.NoError(t, err)
require.NoError(t, err)
assert.Len(t, spaceBindings, len(tc.expectedSpaceBindings), "invalid number of spacebindings for %s", tc.space.GetName())
for _, expectedSpaceBinding := range tc.expectedSpaceBindings {
found := false
Expand Down
11 changes: 5 additions & 6 deletions pkg/status/componentconditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -46,18 +45,18 @@ func TestValidateComponentConditionReady(t *testing.T) {
t.Run("no ready condition", func(t *testing.T) {
err := ValidateComponentConditionReady(conditionOtherType)
require.Error(t, err)
assert.EqualError(t, err, "a ready condition was not found")
require.EqualError(t, err, "a ready condition was not found")
})

t.Run("condition not ready", func(t *testing.T) {
err := ValidateComponentConditionReady(conditionNotReady)
require.Error(t, err)
assert.EqualError(t, err, "deployment has unready status conditions: Available")
require.EqualError(t, err, "deployment has unready status conditions: Available")
})

t.Run("condition ready", func(t *testing.T) {
err := ValidateComponentConditionReady(conditionReady)
assert.NoError(t, err)
require.NoError(t, err)
})
})

Expand All @@ -67,14 +66,14 @@ func TestValidateComponentConditionReady(t *testing.T) {
conditions := []toolchainv1alpha1.Condition{conditionOtherType, conditionOtherType2}
err := ValidateComponentConditionReady(conditions...)
require.Error(t, err)
assert.EqualError(t, err, "a ready condition was not found")
require.EqualError(t, err, "a ready condition was not found")
})

t.Run("multiple - condition not ready", func(t *testing.T) {
conditions := []toolchainv1alpha1.Condition{conditionNotReady, conditionOtherType}
err := ValidateComponentConditionReady(conditions...)
require.Error(t, err)
assert.EqualError(t, err, "deployment has unready status conditions: Available")
require.EqualError(t, err, "deployment has unready status conditions: Available")
})

t.Run("multiple - condition ready", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/status/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const (

// GetDeploymentStatusConditions looks up a deployment with the given name within the given namespace and checks its status
// and finally returns a condition summarizing the status
func GetDeploymentStatusConditions(client client.Client, name, namespace string) []toolchainv1alpha1.Condition {
func GetDeploymentStatusConditions(ctx context.Context, client client.Client, name, namespace string) []toolchainv1alpha1.Condition {
deploymentName := types.NamespacedName{Namespace: namespace, Name: name}
deployment := &appsv1.Deployment{}
err := client.Get(context.TODO(), deploymentName, deployment)
err := client.Get(ctx, deploymentName, deployment)
if err != nil {
err = errs.Wrap(err, ErrMsgCannotGetDeployment)
errCondition := NewComponentErrorCondition(toolchainv1alpha1.ToolchainStatusDeploymentNotFoundReason, err.Error())
Expand Down
9 changes: 5 additions & 4 deletions pkg/status/deployment_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package status

import (
"context"
"testing"

toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"
Expand All @@ -19,7 +20,7 @@ func TestGetDeploymentStatusConditions(t *testing.T) {

t.Run("deployment ready", func(t *testing.T) {
fakeClient := test.NewFakeClient(t, fakeDeploymentReady())
conditions := GetDeploymentStatusConditions(fakeClient, "test-deployment", test.HostOperatorNs)
conditions := GetDeploymentStatusConditions(context.TODO(), fakeClient, "test-deployment", test.HostOperatorNs)
err := ValidateComponentConditionReady(conditions...)
require.NoError(t, err)

Expand All @@ -34,7 +35,7 @@ func TestGetDeploymentStatusConditions(t *testing.T) {

t.Run("deployment does not exist", func(t *testing.T) {
fakeClient := test.NewFakeClient(t)
conditions := GetDeploymentStatusConditions(fakeClient, "test-deployment", test.HostOperatorNs)
conditions := GetDeploymentStatusConditions(context.TODO(), fakeClient, "test-deployment", test.HostOperatorNs)
err := ValidateComponentConditionReady(conditions...)
require.Error(t, err)

Expand All @@ -49,7 +50,7 @@ func TestGetDeploymentStatusConditions(t *testing.T) {

t.Run("deployment not available", func(t *testing.T) {
fakeClient := test.NewFakeClient(t, fakeDeploymentNotAvailable())
conditions := GetDeploymentStatusConditions(fakeClient, "test-deployment", test.HostOperatorNs)
conditions := GetDeploymentStatusConditions(context.TODO(), fakeClient, "test-deployment", test.HostOperatorNs)
err := ValidateComponentConditionReady(conditions...)
require.Error(t, err)

Expand All @@ -64,7 +65,7 @@ func TestGetDeploymentStatusConditions(t *testing.T) {

t.Run("deployment not progressing", func(t *testing.T) {
fakeClient := test.NewFakeClient(t, fakeDeploymentNotProgressing())
conditions := GetDeploymentStatusConditions(fakeClient, "test-deployment", test.HostOperatorNs)
conditions := GetDeploymentStatusConditions(context.TODO(), fakeClient, "test-deployment", test.HostOperatorNs)
err := ValidateComponentConditionReady(conditions...)
require.Error(t, err)

Expand Down
13 changes: 7 additions & 6 deletions pkg/status/toolchaincluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/codeready-toolchain/toolchain-common/pkg/test"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -42,7 +43,7 @@ func TestGetToolchainClusterConditions(t *testing.T) {
err := ValidateComponentConditionReady(conditions...)

// then
assert.NoError(t, err)
require.NoError(t, err)
test.AssertConditionsMatchAndRecentTimestamps(t, conditions, expected)
})

Expand All @@ -66,7 +67,7 @@ func TestGetToolchainClusterConditions(t *testing.T) {
err := ValidateComponentConditionReady(conditions...)

// then
assert.Error(t, err)
require.Error(t, err)
assert.Equal(t, msg, err.Error())
test.AssertConditionsMatchAndRecentTimestamps(t, conditions, expected)
})
Expand All @@ -90,7 +91,7 @@ func TestGetToolchainClusterConditions(t *testing.T) {
err := ValidateComponentConditionReady(conditions...)

// then
assert.Error(t, err)
require.Error(t, err)
assert.Equal(t, fakeToolchainClusterMsg, err.Error())
test.AssertConditionsMatchAndRecentTimestamps(t, conditions, expected)
})
Expand All @@ -115,7 +116,7 @@ func TestGetToolchainClusterConditions(t *testing.T) {
err := ValidateComponentConditionReady(conditions...)

// then
assert.Error(t, err)
require.Error(t, err)
assert.Equal(t, msg, err.Error())
test.AssertConditionsMatchAndRecentTimestamps(t, conditions, expected)
})
Expand All @@ -140,7 +141,7 @@ func TestGetToolchainClusterConditions(t *testing.T) {
err := ValidateComponentConditionReady(conditions...)

// then
assert.Error(t, err)
require.Error(t, err)
assert.Equal(t, msg, err.Error())
test.AssertConditionsMatchAndRecentTimestamps(t, conditions, expected)
})
Expand All @@ -165,7 +166,7 @@ func TestGetToolchainClusterConditions(t *testing.T) {
err := ValidateComponentConditionReady(conditions...)

// then
assert.Error(t, err)
require.Error(t, err)
assert.Contains(t, err.Error(), msg)
test.AssertConditionsMatchAndRecentTimestamps(t, conditions, expected)
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/status/versionchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (m *VersionCheckManager) CheckDeployedVersionIsUpToDate(ctx context.Context
m.LastGHCallsPerRepo[githubRepo.Name] = time.Now()
githubClient := m.GetGithubClientFunc(ctx, accessTokenKey)
// get the latest commit from given repository and branch
latestCommit, commitResponse, err := githubClient.Repositories.GetCommit(context.TODO(), githubRepo.Org, githubRepo.Name, githubRepo.Branch, &github.ListOptions{})
latestCommit, commitResponse, err := githubClient.Repositories.GetCommit(ctx, githubRepo.Org, githubRepo.Name, githubRepo.Branch, &github.ListOptions{})
defer commitResponse.Body.Close()
if err != nil {
errMsg := err.Error()
Expand Down
Loading

0 comments on commit 610c35d

Please sign in to comment.