From f762961dacb382aedc0b8df963ab1b13628c9ef2 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Wed, 25 Oct 2023 11:36:56 -0400 Subject: [PATCH] Removed goleak pkg --- best_quote_test.go | 18 ------------------ fastest_quote_test.go | 18 ------------------ fee_quote_test.go | 12 ------------ go.mod | 1 - go.sum | 2 -- policy_quote_test.go | 9 --------- submit_transaction_test.go | 11 ----------- 7 files changed, 71 deletions(-) diff --git a/best_quote_test.go b/best_quote_test.go index 16ef75f..f53a974 100644 --- a/best_quote_test.go +++ b/best_quote_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tonicpow/go-minercraft/v2/apis/mapi" - "go.uber.org/goleak" ) // mockHTTPValidBestQuote for mocking requests @@ -149,8 +148,6 @@ func TestClient_BestQuote(t *testing.T) { t.Run("get a valid best quote", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidBestQuote{}) @@ -168,8 +165,6 @@ func TestClient_BestQuote(t *testing.T) { }) t.Run("http error", func(t *testing.T) { - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPError{}) response, err := client.BestQuote(context.Background(), mapi.FeeCategoryMining, mapi.FeeTypeData) require.Error(t, err) @@ -177,8 +172,6 @@ func TestClient_BestQuote(t *testing.T) { }) t.Run("bad request", func(t *testing.T) { - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPBadRequest{}) response, err := client.BestQuote(context.Background(), mapi.FeeCategoryMining, mapi.FeeTypeData) require.Error(t, err) @@ -186,8 +179,6 @@ func TestClient_BestQuote(t *testing.T) { }) t.Run("invalid JSON", func(t *testing.T) { - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPInvalidJSON{}) response, err := client.BestQuote(context.Background(), mapi.FeeCategoryMining, mapi.FeeTypeData) require.Error(t, err) @@ -195,8 +186,6 @@ func TestClient_BestQuote(t *testing.T) { }) t.Run("invalid category", func(t *testing.T) { - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPValidBestQuote{}) response, err := client.BestQuote(context.Background(), "invalid", mapi.FeeTypeData) require.Error(t, err) @@ -209,8 +198,6 @@ func TestClient_BestQuote(t *testing.T) { }) t.Run("better rate", func(t *testing.T) { - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPBetterRate{}) response, err := client.BestQuote(context.Background(), mapi.FeeCategoryRelay, mapi.FeeTypeData) require.NoError(t, err) @@ -230,8 +217,6 @@ func TestClient_BestQuote(t *testing.T) { }) t.Run("bad rate", func(t *testing.T) { - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPBadRate{}) response, err := client.BestQuote(context.Background(), mapi.FeeCategoryRelay, mapi.FeeTypeData) require.Error(t, err) @@ -240,7 +225,6 @@ func TestClient_BestQuote(t *testing.T) { // TODO: Verify this test case for Arc API // t.Run("best quote - two failed", func(t *testing.T) { - // defer goleak.VerifyNone(t) // // Create a client // client := newTestClient(&mockHTTPBestQuoteTwoFailed{}) @@ -261,8 +245,6 @@ func TestClient_BestQuote(t *testing.T) { t.Run("best quote - all failed", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPBestQuoteAllFailed{}) diff --git a/fastest_quote_test.go b/fastest_quote_test.go index a5750c9..5819312 100644 --- a/fastest_quote_test.go +++ b/fastest_quote_test.go @@ -10,7 +10,6 @@ import ( "time" "github.com/stretchr/testify/assert" - "go.uber.org/goleak" ) // mockHTTPValidFastestQuote for mocking requests @@ -118,8 +117,6 @@ func TestClient_FastestQuote(t *testing.T) { t.Run("get a valid fastest quote", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidFastestQuote{}) @@ -139,8 +136,6 @@ func TestClient_FastestQuote(t *testing.T) { // todo: this timeout is not working as expected t.Run("valid quote - quick timeout", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidFastestQuoteSlow{}) @@ -160,8 +155,6 @@ func TestClient_FastestQuote(t *testing.T) { t.Run("valid quote - no timeout", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidFastestQuoteSlow{}) @@ -179,9 +172,6 @@ func TestClient_FastestQuote(t *testing.T) { }) t.Run("http error", func(t *testing.T) { - - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPError{}) response, err := client.FastestQuote(context.Background(), defaultFastQuoteTimeout) assert.Error(t, err) @@ -189,9 +179,6 @@ func TestClient_FastestQuote(t *testing.T) { }) t.Run("bad request", func(t *testing.T) { - - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPBadRequest{}) response, err := client.FastestQuote(context.Background(), defaultFastQuoteTimeout) assert.Error(t, err) @@ -199,9 +186,6 @@ func TestClient_FastestQuote(t *testing.T) { }) t.Run("invalid JSON", func(t *testing.T) { - - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPInvalidJSON{}) response, err := client.FastestQuote(context.Background(), defaultFastQuoteTimeout) assert.Error(t, err) @@ -211,8 +195,6 @@ func TestClient_FastestQuote(t *testing.T) { // TODO: Vetify this test case for Arc and mAPI // t.Run("two bad quote responses, one good", func(t *testing.T) { - // defer goleak.VerifyNone(t) - // // Create a client // client := newTestClient(&mockHTTPFastestQuoteTwoFailed{}) diff --git a/fee_quote_test.go b/fee_quote_test.go index fb81987..e1353dc 100644 --- a/fee_quote_test.go +++ b/fee_quote_test.go @@ -12,7 +12,6 @@ import ( "github.com/libsv/go-bt/v2" "github.com/stretchr/testify/assert" "github.com/tonicpow/go-minercraft/v2/apis/mapi" - "go.uber.org/goleak" ) const feeTestSignature = "3045022100eed49f6bf75d8f975f581271e3df658fbe8ec67e6301ea8fc25a72d18c92e30e022056af253f0d24db6a8fde4e2c1ee95e7a5ecf2c7cdc93246f8328c9e0ca582fc4" @@ -284,8 +283,6 @@ func TestClient_FeeQuote(t *testing.T) { t.Run("get a valid fee quote", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidFeeQuote{}) @@ -306,8 +303,6 @@ func TestClient_FeeQuote(t *testing.T) { t.Run("valid parse values", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidFeeQuote{}) @@ -329,8 +324,6 @@ func TestClient_FeeQuote(t *testing.T) { t.Run("get actual rates", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidFeeQuote{}) @@ -352,7 +345,6 @@ func TestClient_FeeQuote(t *testing.T) { }) t.Run("invalid miner", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPValidFeeQuote{}) response, err := client.FeeQuote(context.Background(), nil) assert.Error(t, err) @@ -360,7 +352,6 @@ func TestClient_FeeQuote(t *testing.T) { }) t.Run("http error", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPError{}) response, err := client.FeeQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) @@ -368,7 +359,6 @@ func TestClient_FeeQuote(t *testing.T) { }) t.Run("bad request", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPBadRequest{}) response, err := client.FeeQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) @@ -376,7 +366,6 @@ func TestClient_FeeQuote(t *testing.T) { }) t.Run("invalid JSON", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPInvalidJSON{}) response, err := client.FeeQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) @@ -384,7 +373,6 @@ func TestClient_FeeQuote(t *testing.T) { }) t.Run("missing fees", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPMissingFees{}) response, err := client.FeeQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) diff --git a/go.mod b/go.mod index e791cfe..a7d8a96 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/libsv/go-bk v0.1.6 github.com/libsv/go-bt/v2 v2.2.5 github.com/stretchr/testify v1.8.4 - go.uber.org/goleak v1.3.0 ) require ( diff --git a/go.sum b/go.sum index 1658123..1586aea 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,6 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= diff --git a/policy_quote_test.go b/policy_quote_test.go index fd014e2..f3c1301 100644 --- a/policy_quote_test.go +++ b/policy_quote_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/tonicpow/go-minercraft/v2/apis/mapi" - "go.uber.org/goleak" ) // mockHTTPValidPolicyQuote for mocking requests @@ -46,8 +45,6 @@ func TestClient_PolicyQuote(t *testing.T) { t.Run("get a valid policy quote", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidPolicyQuote{}) @@ -81,7 +78,6 @@ func TestClient_PolicyQuote(t *testing.T) { }) t.Run("invalid miner", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPValidPolicyQuote{}) response, err := client.PolicyQuote(context.Background(), nil) assert.Error(t, err) @@ -89,7 +85,6 @@ func TestClient_PolicyQuote(t *testing.T) { }) t.Run("http error", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPError{}) response, err := client.PolicyQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) @@ -97,7 +92,6 @@ func TestClient_PolicyQuote(t *testing.T) { }) t.Run("bad request", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPBadRequest{}) response, err := client.PolicyQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) @@ -105,7 +99,6 @@ func TestClient_PolicyQuote(t *testing.T) { }) t.Run("invalid JSON", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPInvalidJSON{}) response, err := client.PolicyQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) @@ -113,7 +106,6 @@ func TestClient_PolicyQuote(t *testing.T) { }) t.Run("invalid signature", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPInvalidSignature{}) response, err := client.PolicyQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) @@ -121,7 +113,6 @@ func TestClient_PolicyQuote(t *testing.T) { }) t.Run("missing fees", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPMissingFees{}) response, err := client.PolicyQuote(context.Background(), client.MinerByName(MinerTaal)) assert.Error(t, err) diff --git a/submit_transaction_test.go b/submit_transaction_test.go index a7d1c76..b8213d0 100644 --- a/submit_transaction_test.go +++ b/submit_transaction_test.go @@ -10,7 +10,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "go.uber.org/goleak" ) const submitTestSignature = "3045022100f65ae83b20bc60e7a5f0e9c1bd9aceb2b26962ad0ee35472264e83e059f4b9be022010ca2334ff088d6e085eb3c2118306e61ec97781e8e1544e75224533dcc32379" @@ -76,8 +75,6 @@ func TestClient_SubmitTransaction(t *testing.T) { t.Run("submit a valid transaction", func(t *testing.T) { - defer goleak.VerifyNone(t) - // Create a client client := newTestClient(&mockHTTPValidSubmission{}) @@ -96,8 +93,6 @@ func TestClient_SubmitTransaction(t *testing.T) { t.Run("validate parsed values", func(t *testing.T) { - defer goleak.VerifyNone(t) - client := newTestClient(&mockHTTPValidSubmission{}) response, err := client.SubmitTransaction(context.Background(), client.MinerByName(MinerGorillaPool), tx) assert.NoError(t, err) @@ -113,7 +108,6 @@ func TestClient_SubmitTransaction(t *testing.T) { }) t.Run("invalid miner", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPValidSubmission{}) response, err := client.SubmitTransaction(context.Background(), nil, tx) assert.Error(t, err) @@ -121,7 +115,6 @@ func TestClient_SubmitTransaction(t *testing.T) { }) t.Run("http error", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPError{}) response, err := client.SubmitTransaction(context.Background(), client.MinerByName(MinerGorillaPool), tx) assert.Error(t, err) @@ -129,7 +122,6 @@ func TestClient_SubmitTransaction(t *testing.T) { }) t.Run("bad request", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPBadRequest{}) response, err := client.SubmitTransaction(context.Background(), client.MinerByName(MinerGorillaPool), tx) assert.Error(t, err) @@ -137,7 +129,6 @@ func TestClient_SubmitTransaction(t *testing.T) { }) t.Run("invalid JSON", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPInvalidJSON{}) response, err := client.SubmitTransaction(context.Background(), client.MinerByName(MinerGorillaPool), tx) assert.Error(t, err) @@ -145,7 +136,6 @@ func TestClient_SubmitTransaction(t *testing.T) { }) t.Run("invalid signature", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPInvalidSignature{}) response, err := client.SubmitTransaction(context.Background(), client.MinerByName(MinerGorillaPool), tx) assert.Error(t, err) @@ -153,7 +143,6 @@ func TestClient_SubmitTransaction(t *testing.T) { }) t.Run("bad submission", func(t *testing.T) { - defer goleak.VerifyNone(t) client := newTestClient(&mockHTTPBadSubmission{}) response, err := client.SubmitTransaction(context.Background(), client.MinerByName(MinerGorillaPool), tx) assert.Error(t, err)