Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
chore: upgrade to Go 1.19 (#3382)
Browse files Browse the repository at this point in the history
Update some tests due to changes of new 1.19 SDK

Signed-off-by: Abdulbois <[email protected]>

Signed-off-by: Abdulbois <[email protected]>
Co-authored-by: Troy Ronda <[email protected]>
  • Loading branch information
Abdulbois and troyronda authored Sep 27, 2022
1 parent 52cdf1a commit 3045fc6
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 55 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
os: [ubuntu-18.04, macOS-10.15]
steps:

- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
id: go

- uses: actions/checkout@v3
Expand All @@ -49,10 +49,10 @@ jobs:
image: ghcr.io/hyperledger/ursa-wrapper-go/uwg-build # a container with libursa installed
timeout-minutes: 15
steps:
- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
id: go

- uses: actions/checkout@v3
Expand All @@ -67,10 +67,10 @@ jobs:
timeout-minutes: 15
steps:

- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
id: go

- uses: actions/checkout@v3
Expand All @@ -85,10 +85,10 @@ jobs:
timeout-minutes: 10
steps:

- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
id: go

- uses: actions/checkout@v3
Expand All @@ -103,10 +103,10 @@ jobs:
timeout-minutes: 45
steps:

- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
id: go

- name: Setup Node.js
Expand Down Expand Up @@ -142,10 +142,10 @@ jobs:
timeout-minutes: 10
runs-on: ubuntu-18.04
steps:
- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19

- uses: actions/checkout@v3

Expand All @@ -160,10 +160,10 @@ jobs:
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
id: go

- name: Setup Node.js
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
timeout-minutes: 10
steps:

- name: Setup Go 1.17
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
id: go

- name: Setup node
Expand Down
2 changes: 1 addition & 1 deletion cmd/aries-agent-mobile/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/cmd/aries-agent-mobile

go 1.17
go 1.19

require (
github.com/google/uuid v1.3.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/aries-agent-rest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/cmd/aries-agent-rest

go 1.17
go 1.19

require (
github.com/cenkalti/backoff/v4 v4.1.2
Expand Down
2 changes: 1 addition & 1 deletion cmd/aries-js-worker/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/cmd/aries-js-worker

go 1.17
go 1.19

require (
github.com/google/uuid v1.3.0
Expand Down
2 changes: 1 addition & 1 deletion component/storage/edv/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/component/storage/edv

go 1.17
go 1.19

require (
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
Expand Down
2 changes: 1 addition & 1 deletion component/storage/indexeddb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/component/storage/indexeddb

go 1.17
go 1.19

require (
github.com/google/uuid v1.1.2
Expand Down
2 changes: 1 addition & 1 deletion component/storage/leveldb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/component/storage/leveldb

go 1.17
go 1.19

require (
github.com/google/uuid v1.1.2
Expand Down
2 changes: 1 addition & 1 deletion component/storageutil/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/component/storageutil

go 1.17
go 1.19

require (
github.com/google/uuid v1.1.2
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

go 1.17
go 1.19
59 changes: 33 additions & 26 deletions pkg/crypto/webkms/remotecrypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"net"
"net/http"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -84,8 +85,8 @@ func TestEncryptDecrypt(t *testing.T) {
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, _, err = tmpCrypto.Encrypt(plaintext, aad, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting Encrypt plaintext failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+encryptURI, defaultKeyURL+encryptURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting Encrypt plaintext failed [%s, Post \"%s\": %s",
defaultKeyURL+encryptURI, defaultKeyURL+encryptURI, getCertsErrorSubText()))

badURL := "``#$%"
_, _, err = tmpCrypto.Encrypt(plaintext, aad, badURL)
Expand All @@ -99,8 +100,8 @@ func TestEncryptDecrypt(t *testing.T) {
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, err = tmpCrypto.Decrypt(nil, aad, nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting Decrypt ciphertext failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+decryptURI, defaultKeyURL+decryptURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting Decrypt ciphertext failed [%s, Post \"%s\": %s",
defaultKeyURL+decryptURI, defaultKeyURL+decryptURI, getCertsErrorSubText()))
})

t.Run("Encrypt json marshal failure", func(t *testing.T) {
Expand Down Expand Up @@ -299,17 +300,17 @@ func TestSignVerify(t *testing.T) {
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, err = tmpCrypto.Sign(nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting Sign message failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+signURI, defaultKeyURL+signURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting Sign message failed [%s, Post \"%s\": %s",
defaultKeyURL+signURI, defaultKeyURL+signURI, getCertsErrorSubText()))
})

t.Run("Verify Post request failure", func(t *testing.T) {
blankClient := &http.Client{}
tmpCrypto := New(defaultKeystoreURL, blankClient)

err = tmpCrypto.Verify(nil, nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting Verify signature failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+verifyURI, defaultKeyURL+verifyURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting Verify signature failed [%s, Post \"%s\": %s",
defaultKeyURL+verifyURI, defaultKeyURL+verifyURI, getCertsErrorSubText()))
})

t.Run("Sign json marshal failure", func(t *testing.T) {
Expand Down Expand Up @@ -472,17 +473,17 @@ func TestComputeVerifyMAC(t *testing.T) {
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, err = tmpCrypto.ComputeMAC(nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting ComputeMAC request failed [%s, Post \"%s\": x509: certificate"+
" signed by unknown authority", defaultKeyURL+computeMACURI, defaultKeyURL+computeMACURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting ComputeMAC request failed [%s, Post \"%s\": %s",
defaultKeyURL+computeMACURI, defaultKeyURL+computeMACURI, getCertsErrorSubText()))
})

t.Run("VerifyMAC Post request failure", func(t *testing.T) {
blankClient := &http.Client{}
tmpCrypto := New(defaultKeystoreURL, blankClient)

err = tmpCrypto.VerifyMAC(nil, nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting VerifyMAC request failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+verifyMACURI, defaultKeyURL+verifyMACURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting VerifyMAC request failed [%s, Post \"%s\": %s",
defaultKeyURL+verifyMACURI, defaultKeyURL+verifyMACURI, getCertsErrorSubText()))
})

t.Run("ComputeMAC json marshal failure", func(t *testing.T) {
Expand Down Expand Up @@ -645,17 +646,17 @@ func TestWrapUnWrapKey(t *testing.T) {
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, err = tmpCrypto.WrapKey(cek, apu, apv, recipentPubKey)
require.Contains(t, err.Error(), fmt.Sprintf("posting WrapKey failed [%s, Post \"%s\": x509: certificate"+
" signed by unknown authority", defaultKeystoreURL+wrapURI, defaultKeystoreURL+wrapURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting WrapKey failed [%s, Post \"%s\": %s",
defaultKeystoreURL+wrapURI, defaultKeystoreURL+wrapURI, getCertsErrorSubText()))
})

t.Run("UnwrapKey Post request failure", func(t *testing.T) {
blankClient := &http.Client{}
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, err = tmpCrypto.UnwrapKey(wKey, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting UnwrapKey failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+unwrapURI, defaultKeyURL+unwrapURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting UnwrapKey failed [%s, Post \"%s\": %s",
defaultKeyURL+unwrapURI, defaultKeyURL+unwrapURI, getCertsErrorSubText()))
})

t.Run("WrapKey json marshal failure", func(t *testing.T) {
Expand Down Expand Up @@ -1000,37 +1001,35 @@ func TestBBSSignVerify_DeriveProofVerifyProof(t *testing.T) {
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, err = tmpCrypto.SignMulti(nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Sign message failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+signMultiURI, defaultKeyURL+signMultiURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Sign message failed [%s, Post \"%s\": %s",
defaultKeyURL+signMultiURI, defaultKeyURL+signMultiURI, getCertsErrorSubText()))
})

t.Run("BBS+ Verify Post request failure", func(t *testing.T) {
blankClient := &http.Client{}
tmpCrypto := New(defaultKeystoreURL, blankClient)

err = tmpCrypto.VerifyMulti(nil, nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Verify signature failed [%s, Post \"%s\": x509: "+
"certificate signed by unknown authority", defaultKeyURL+verifyMultiURI, defaultKeyURL+verifyMultiURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Verify signature failed [%s, Post \"%s\": %s",
defaultKeyURL+verifyMultiURI, defaultKeyURL+verifyMultiURI, getCertsErrorSubText()))
})

t.Run("BBS+ Derive Proof Post request failure", func(t *testing.T) {
blankClient := &http.Client{}
tmpCrypto := New(defaultKeystoreURL, blankClient)

_, err = tmpCrypto.DeriveProof(nil, nil, nil, nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Derive proof message failed [%s, Post \"%s\": "+
"x509: certificate signed by unknown authority", defaultKeyURL+deriveProofURI,
defaultKeyURL+deriveProofURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Derive proof message failed [%s, Post \"%s\": %s",
defaultKeyURL+deriveProofURI, defaultKeyURL+deriveProofURI, getCertsErrorSubText()))
})

t.Run("BBS+ Verify Proof Post request failure", func(t *testing.T) {
blankClient := &http.Client{}
tmpCrypto := New(defaultKeystoreURL, blankClient)

err = tmpCrypto.VerifyProof(nil, nil, nil, defaultKeyURL)
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Verify proof failed [%s, Post \"%s\": "+
"x509: certificate signed by unknown authority", defaultKeyURL+verifyProofURI,
defaultKeyURL+verifyProofURI))
require.Contains(t, err.Error(), fmt.Sprintf("posting BBS+ Verify proof failed [%s, Post \"%s\": %s",
defaultKeyURL+verifyProofURI, defaultKeyURL+verifyProofURI, getCertsErrorSubText()))
})

t.Run("BBS+ Sign json marshal failure", func(t *testing.T) {
Expand Down Expand Up @@ -1593,3 +1592,11 @@ func mockAddHeadersFuncError(_ *http.Request) (*http.Header, error) {
func matchPath(r *http.Request, uri string) bool {
return strings.LastIndex(r.URL.Path, uri) == len(r.URL.Path)-len(uri)
}

func getCertsErrorSubText() string {
if runtime.GOOS == "darwin" {
return "x509: “*.example.com” certificate is not trusted"
}

return "x509: certificate signed by unknown authority"
}
2 changes: 1 addition & 1 deletion pkg/doc/verifiable/credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ func TestDownloadCustomSchema(t *testing.T) {

customSchema, err := getJSONSchema(testServer.URL, noCacheOpts)
require.Error(t, err)
require.Contains(t, err.Error(), "load credential schema")
require.Contains(t, err.Error(), "credential schema endpoint HTTP failure")
require.Nil(t, customSchema)
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/vdr/httpbinding/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func TestRead_HTTPGetFailed(t *testing.T) {
require.NoError(t, err)
_, err = resolver.Read("did:example:334455")
require.Error(t, err)
require.Contains(t, err.Error(), "HTTP Get request failed")
require.Contains(t, err.Error(), "unsupported response from DID resolver")
}

func TestDIDResolver_Accept(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion spi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

module github.com/hyperledger/aries-framework-go/spi

go 1.17
go 1.19
2 changes: 1 addition & 1 deletion test/bdd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/test/bdd

go 1.17
go 1.19

require (
github.com/btcsuite/btcd v0.22.0-beta
Expand Down
2 changes: 1 addition & 1 deletion test/component/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module github.com/hyperledger/aries-framework-go/test/component

go 1.17
go 1.19

require (
github.com/google/uuid v1.1.2
Expand Down

0 comments on commit 3045fc6

Please sign in to comment.