@@ -20,6 +20,7 @@ import (
2020 "errors"
2121 "math/big"
2222 "reflect"
23+ "runtime"
2324 "testing"
2425
2526 "github.com/agiledragon/gomonkey/v2"
@@ -58,6 +59,10 @@ func TestValidateAuthorizations(t *testing.T) {
5859 })
5960
6061 t .Run ("Invalid signature" , func (t * testing.T ) {
62+ // gomonkey concurrency issue workaround,
63+ // see https://github.com/agiledragon/gomonkey/issues/145
64+ defer runtime .GC ()
65+
6166 patches := gomonkey .NewPatches ()
6267 defer patches .Reset ()
6368 patches .ApplyFunc ((* types .SetCodeAuthorization ).Authority , func (_ * types.SetCodeAuthorization ) (common.Address , error ) {
@@ -72,6 +77,10 @@ func TestValidateAuthorizations(t *testing.T) {
7277 })
7378
7479 t .Run ("Destination has code" , func (t * testing.T ) {
80+ // gomonkey concurrency issue workaround,
81+ // see https://github.com/agiledragon/gomonkey/issues/145
82+ defer runtime .GC ()
83+
7584 patches := gomonkey .NewPatches ()
7685 defer patches .Reset ()
7786 patches .ApplyFunc ((* types .SetCodeAuthorization ).Authority , func (_ * types.SetCodeAuthorization ) (common.Address , error ) {
@@ -92,6 +101,10 @@ func TestValidateAuthorizations(t *testing.T) {
92101 })
93102
94103 t .Run ("Nonce mismatch" , func (t * testing.T ) {
104+ // gomonkey concurrency issue workaround,
105+ // see https://github.com/agiledragon/gomonkey/issues/145
106+ defer runtime .GC ()
107+
95108 patches := gomonkey .NewPatches ()
96109 defer patches .Reset ()
97110 patches .ApplyFunc ((* types .SetCodeAuthorization ).Authority , func (_ * types.SetCodeAuthorization ) (common.Address , error ) {
@@ -118,6 +131,10 @@ func TestValidateAuthorizations(t *testing.T) {
118131 })
119132
120133 t .Run ("Valid authorization" , func (t * testing.T ) {
134+ // gomonkey concurrency issue workaround,
135+ // see https://github.com/agiledragon/gomonkey/issues/145
136+ defer runtime .GC ()
137+
121138 patches := gomonkey .NewPatches ()
122139 defer patches .Reset ()
123140 patches .ApplyFunc ((* types .SetCodeAuthorization ).Authority , func (_ * types.SetCodeAuthorization ) (common.Address , error ) {
0 commit comments