From 2c657f594e96278531db4889b4a9f3260bbf7bef Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Thu, 29 Apr 2021 20:56:41 +0300 Subject: [PATCH] satellite/metainfo: don't rely on exact error name Change-Id: I7975a00c32891a43b4f1e6dc4f5847201844f2ec --- satellite/metainfo/metainfo_test.go | 9 ++++++--- storagenode/trust/excluder_test.go | 2 ++ storagenode/trust/satellite_url_test.go | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/satellite/metainfo/metainfo_test.go b/satellite/metainfo/metainfo_test.go index 6685a4caa..1b8b0a900 100644 --- a/satellite/metainfo/metainfo_test.go +++ b/satellite/metainfo/metainfo_test.go @@ -49,7 +49,8 @@ func TestMaxOutBuckets(t *testing.T) { require.NoError(t, err) } err := planet.Uplinks[0].CreateBucket(ctx, planet.Satellites[0], fmt.Sprintf("test%d", limit+1)) - require.EqualError(t, err, fmt.Sprintf("uplink: bucket: metainfo error: number of allocated buckets (%d) exceeded", limit)) + require.Error(t, err) + require.Contains(t, err.Error(), fmt.Sprintf("number of allocated buckets (%d) exceeded", limit)) }) } @@ -1764,7 +1765,8 @@ func TestMultipartObjectDownloadRejection(t *testing.T) { Index: -1, }, }) - require.EqualError(t, err, "metainfo error: Used uplink version cannot download multipart objects.") + require.Error(t, err) + require.Contains(t, err.Error(), "Used uplink version cannot download multipart objects.") objects, err = planet.Satellites[0].Metainfo.Metabase.TestingAllCommittedObjects(ctx, planet.Uplinks[0].Projects[0].ID, "pip-third") require.NoError(t, err) @@ -1782,7 +1784,8 @@ func TestMultipartObjectDownloadRejection(t *testing.T) { Index: -1, }, }) - require.EqualError(t, err, "metainfo error: Used uplink version cannot download multipart objects.") + require.Error(t, err) + require.Contains(t, err.Error(), "Used uplink version cannot download multipart objects.") }) } diff --git a/storagenode/trust/excluder_test.go b/storagenode/trust/excluder_test.go index d5c8bcfbb..f30c4a5b0 100644 --- a/storagenode/trust/excluder_test.go +++ b/storagenode/trust/excluder_test.go @@ -25,6 +25,8 @@ func TestNewExcluderFailure(t *testing.T) { errs: []string{ `exclusion: node URL error: parse ://: missing protocol scheme`, `exclusion: node URL error: parse "://": missing protocol scheme`, + `exclusion: node URL: parse ://: missing protocol scheme`, + `exclusion: node URL: parse "://": missing protocol scheme`, }, }, { diff --git a/storagenode/trust/satellite_url_test.go b/storagenode/trust/satellite_url_test.go index 2a6f07f75..84ed193e3 100644 --- a/storagenode/trust/satellite_url_test.go +++ b/storagenode/trust/satellite_url_test.go @@ -86,6 +86,8 @@ func TestParseSatelliteURL_Invalid(t *testing.T) { errs: []string{ `invalid satellite URL: node URL error: parse ://: missing protocol scheme`, `invalid satellite URL: node URL error: parse "://": missing protocol scheme`, + `invalid satellite URL: node URL: parse ://: missing protocol scheme`, + `invalid satellite URL: node URL: parse "://": missing protocol scheme`, }, }, { @@ -96,7 +98,10 @@ func TestParseSatelliteURL_Invalid(t *testing.T) { { name: "short ID", url: "121RTSDpy@127.0.0.1:7777", - errs: []string{"invalid satellite URL: node URL error: node ID error: checksum error"}, + errs: []string{ + "invalid satellite URL: node URL error: node ID error: checksum error", + "invalid satellite URL: node URL: node ID error: checksum error", + }, }, { name: "missing host:port",