From 7209f96ee3ed624e297b150007da1e24757095c6 Mon Sep 17 00:00:00 2001 From: Rein Krul Date: Mon, 11 Dec 2023 13:39:17 +0100 Subject: [PATCH] upgrade to golang 1.21, fix tests --- Dockerfile | 2 +- auth/services/selfsigned/signer_test.go | 14 +++++++------- http/engine_test.go | 2 +- network/network_test.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 34d49092f0..c3994b7794 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # golang alpine -FROM golang:1.20.6-alpine as builder +FROM golang:1.21.5-alpine as builder ARG TARGETARCH ARG TARGETOS diff --git a/auth/services/selfsigned/signer_test.go b/auth/services/selfsigned/signer_test.go index 919b93971e..339601b0dd 100644 --- a/auth/services/selfsigned/signer_test.go +++ b/auth/services/selfsigned/signer_test.go @@ -178,8 +178,8 @@ func TestSessionStore_SigningSessionStatus(t *testing.T) { t.Run("status completed returns VP on SigningSessionResult", func(t *testing.T) { mockContext := newMockContext(t) ss := NewSigner(mockContext.vcr, "").(*signer) - mockContext.issuer.EXPECT().Issue(context.TODO(), gomock.Any(), false, false).Return(&testVC, nil) - mockContext.holder.EXPECT().BuildVP(context.TODO(), gomock.Len(1), gomock.Any(), &employer, true).Return(&testVP, nil) + mockContext.issuer.EXPECT().Issue(context.Background(), gomock.Any(), false, false).Return(&testVC, nil) + mockContext.holder.EXPECT().BuildVP(context.Background(), gomock.Len(1), gomock.Any(), &employer, true).Return(&testVP, nil) sp, err := ss.StartSigningSession(contract.Contract{RawContractText: testContract}, params) require.NoError(t, err) @@ -237,7 +237,7 @@ func TestSessionStore_SigningSessionStatus(t *testing.T) { t.Run("correct VC options are passed to issuer", func(t *testing.T) { mockContext := newMockContext(t) ss := NewSigner(mockContext.vcr, "").(*signer) - mockContext.issuer.EXPECT().Issue(context.TODO(), gomock.Any(), false, false).DoAndReturn( + mockContext.issuer.EXPECT().Issue(context.Background(), gomock.Any(), false, false).DoAndReturn( func(arg0 interface{}, unsignedCredential interface{}, public interface{}, publish interface{}) (*vc.VerifiableCredential, error) { isPublic, ok := public.(bool) isPublished, ok2 := publish.(bool) @@ -265,7 +265,7 @@ func TestSessionStore_SigningSessionStatus(t *testing.T) { return &testVC, nil }) - mockContext.holder.EXPECT().BuildVP(context.TODO(), gomock.Len(1), gomock.Any(), &employer, true).Return(&testVP, nil) + mockContext.holder.EXPECT().BuildVP(context.Background(), gomock.Len(1), gomock.Any(), &employer, true).Return(&testVP, nil) sp, err := ss.StartSigningSession(contract.Contract{RawContractText: testContract}, params) require.NoError(t, err) @@ -287,7 +287,7 @@ func TestSessionStore_SigningSessionStatus(t *testing.T) { t.Run("error on VC issuance", func(t *testing.T) { mockContext := newMockContext(t) ss := NewSigner(mockContext.vcr, "").(*signer) - mockContext.issuer.EXPECT().Issue(context.TODO(), gomock.Any(), false, false).Return(nil, errors.New("error")) + mockContext.issuer.EXPECT().Issue(context.Background(), gomock.Any(), false, false).Return(nil, errors.New("error")) sp, err := ss.StartSigningSession(contract.Contract{RawContractText: testContract}, params) require.NoError(t, err) @@ -302,8 +302,8 @@ func TestSessionStore_SigningSessionStatus(t *testing.T) { t.Run("error on building VP", func(t *testing.T) { mockContext := newMockContext(t) ss := NewSigner(mockContext.vcr, "").(*signer) - mockContext.issuer.EXPECT().Issue(context.TODO(), gomock.Any(), false, false).Return(&testVC, nil) - mockContext.holder.EXPECT().BuildVP(context.TODO(), gomock.Len(1), gomock.Any(), &employer, true).Return(nil, errors.New("error")) + mockContext.issuer.EXPECT().Issue(context.Background(), gomock.Any(), false, false).Return(&testVC, nil) + mockContext.holder.EXPECT().BuildVP(context.Background(), gomock.Len(1), gomock.Any(), &employer, true).Return(nil, errors.New("error")) sp, err := ss.StartSigningSession(contract.Contract{RawContractText: testContract}, params) require.NoError(t, err) diff --git a/http/engine_test.go b/http/engine_test.go index 1e7f244e01..efddf19309 100644 --- a/http/engine_test.go +++ b/http/engine_test.go @@ -163,7 +163,7 @@ func TestEngine_Configure(t *testing.T) { thisTLSConfig := tlsConfig.Clone() thisTLSConfig.Certificates = nil _, err = doHTTPSRequest(thisTLSConfig, engine.config.InterfaceConfig.Address) - assert.ErrorContains(t, err, "tls: bad certificate") + assert.ErrorContains(t, err, "tls: certificate required") err = engine.Shutdown() assert.NoError(t, err) diff --git a/network/network_test.go b/network/network_test.go index 3d4a7162af..d2d4375cdb 100644 --- a/network/network_test.go +++ b/network/network_test.go @@ -1246,7 +1246,7 @@ func TestNetwork_checkHealth(t *testing.T) { result := n.CheckHealth() assert.Equal(t, core.HealthStatusDown, result[healthTLS].Status) - assert.Equal(t, "x509: certificate signed by unknown authority", result[healthTLS].Details) + assert.Contains(t, result[healthTLS].Details, "x509: certificate has expired or is not yet valid") }) })