Skip to content

Commit

Permalink
fix broken build
Browse files Browse the repository at this point in the history
  • Loading branch information
k15r committed Dec 14, 2023
1 parent 00309fd commit 0772609
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions hack/e2e/common/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ func ConvertSelectorLabelsToString(labels map[string]string) string {
return strings.Join(result, ",")
}

//nolint:goerr113 //TODO: this is ERRORHANDLING NOT a LOGGER!!!!
func AppendMsgToError(err error, msg string) error {
return errors.Join(err, fmt.Errorf("\n==> %s", msg))
}
4 changes: 2 additions & 2 deletions internal/controller/operator/eventing/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,10 @@ func (r *Reconciler) reconcileEventMeshBackend(ctx context.Context, eventing *op
if err != nil {
if kerrors.IsNotFound(err) {
return kctrl.Result{}, r.syncSubManagerStatusWithNATSState(ctx, operatorv1alpha1.StateWarning, eventing,
fmt.Errorf(EventMeshSecretMissingMessage), log)
ErrEventMeshSecretMissing, log)
}
return kctrl.Result{}, r.syncStatusWithSubscriptionManagerErr(ctx, eventing,
fmt.Errorf("failed to get EventMesh secret: %v", err), log)
fmt.Errorf("failed to get EventMesh secret: %w", err), log)
}

// Start the EventMesh subscription controller
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/operator/eventing/eventmesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type oauth2Credentials struct {

const EventMeshSecretMissingMessage = "The specified EventMesh secret is not found. Please provide an existing secret."

var ErrEventMeshSecretMissing = errors.New(EventMeshSecretMissingMessage)

func (r *Reconciler) reconcileEventMeshSubManager(ctx context.Context, eventing *v1alpha1.Eventing,
eventMeshSecret *kcorev1.Secret, log *zap.SugaredLogger,
) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
natstestutils "github.com/kyma-project/nats-manager/testutils"
"github.com/onsi/gomega"
gomegatypes "github.com/onsi/gomega/types"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
kappsv1 "k8s.io/api/apps/v1"
kapiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand All @@ -34,6 +35,8 @@ const (

var testEnvironment *testutilsintegration.TestEnvironment //nolint:gochecknoglobals // used in tests

var ErrPatchApplyFailed = errors.New("patch apply failed")

// TestMain pre-hook and post-hook to run before and after all tests.
func TestMain(m *testing.M) {
// Note: The setup will provision a single K8s env and
Expand Down Expand Up @@ -611,7 +614,7 @@ func Test_CreateEventingCR_EventMesh(t *testing.T) {
wantMatches: gomega.And(
matchers.HaveStatusError(),
matchers.HaveEventMeshSubManagerNotReadyCondition(
"failed to sync Publisher Proxy secret: unexpected error"),
"failed to sync Publisher Proxy secret: patch apply failed"),
matchers.HaveFinalizer(),
),
shouldFailSubManager: true,
Expand Down Expand Up @@ -1113,5 +1116,5 @@ func (mkc *MockKubeClient) GetCRD(ctx context.Context, name string) (*kapiextens
}

func (mkc *MockKubeClient) PatchApply(ctx context.Context, object kctrlclient.Object) error {
return fmt.Errorf("unexpected error")
return ErrPatchApplyFailed
}
2 changes: 1 addition & 1 deletion test/utils/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ func (env TestEnvironment) CreateUnstructuredK8sResource(obj *unstructured.Unstr
}

func (env TestEnvironment) UpdateUnstructuredK8sResource(obj *unstructured.Unstructured) error {
return env.k8sClient.Update(env.Context, obj)
return env.k8sClient.Update(context.Background(), obj)
}

func (env TestEnvironment) EnsureK8sUnStructResourceCreated(t *testing.T, obj *unstructured.Unstructured) {
Expand Down

0 comments on commit 0772609

Please sign in to comment.