diff --git a/.golangci.toml b/.golangci.toml index 14581e987..6b48c26fe 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -10,13 +10,11 @@ enable = [ "unconvert", "goimports", "unused", - "vetshadow", "misspell", "nakedret", "errcheck", "revive", "ineffassign", - "vet", "unparam", "gofumpt", "prealloc", @@ -27,6 +25,9 @@ enable = [ # SQL-related linters "rowserrcheck", "sqlclosecheck", + + # Testing + "thelper", ] [issues] @@ -36,6 +37,11 @@ exclude-use-default = false source = "defer .*\\.(Close|Rollback)\\(\\)$" linters = ["errcheck"] +[[issues.exclude-rules]] +source = "tests\\.(Add|Run)\\(" +text = "test helper function should start" +linters = ["thelper"] + [linters-settings.gci] sections = ["standard", "default", "prefix(github.com/go-kivik/kivik)"] skip-generated = false diff --git a/cmd/kivik/cmd/copy_test.go b/cmd/kivik/cmd/copy_test.go index bf446ad14..7ec4ac12f 100644 --- a/cmd/kivik/cmd/copy_test.go +++ b/cmd/kivik/cmd/copy_test.go @@ -46,7 +46,7 @@ func Test_copy_RunE(t *testing.T) { "ETag": {`"2-62e778c9ec09214dd685a981dcc24074"`}, }, Body: io.NopCloser(strings.NewReader(`{"id": "target","ok": true,"rev": "2-62e778c9ec09214dd685a981dcc24074"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != methodCopy { t.Errorf("Unexpected method: %v", req.Method) } @@ -69,7 +69,7 @@ func Test_copy_RunE(t *testing.T) { "ETag": {`"2-62e778c9ec09214dd685a981dcc24074"`}, }, Body: io.NopCloser(strings.NewReader(`{"id": "target","ok": true,"rev": "2-62e778c9ec09214dd685a981dcc24074"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodGet { t.Errorf("Unexpected source method: %v", req.Method) } @@ -82,7 +82,7 @@ func Test_copy_RunE(t *testing.T) { "ETag": {`"2-62e778c9ec09214dd685a981dcc24074"`}, }, Body: io.NopCloser(strings.NewReader(`{"id": "target","ok": true,"rev": "2-62e778c9ec09214dd685a981dcc24074"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPut { t.Errorf("Unexpected target method: %v", req.Method) } @@ -104,7 +104,7 @@ func Test_copy_RunE(t *testing.T) { "ETag": {`"2-62e778c9ec09214dd685a981dcc24074"`}, }, Body: io.NopCloser(strings.NewReader(`{"id": "target","ok": true,"rev": "2-62e778c9ec09214dd685a981dcc24074"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != methodCopy { t.Errorf("Unexpected method: %v", req.Method) } @@ -126,7 +126,7 @@ func Test_copy_RunE(t *testing.T) { "ETag": {`"2-62e778c9ec09214dd685a981dcc24074"`}, }, Body: io.NopCloser(strings.NewReader(`{"id": "target","ok": true,"rev": "2-62e778c9ec09214dd685a981dcc24074"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != methodCopy { t.Errorf("Unexpected method: %v", req.Method) } @@ -149,7 +149,7 @@ func Test_copy_RunE(t *testing.T) { "ETag": {`"2-62e778c9ec09214dd685a981dcc24074"`}, }, Body: io.NopCloser(strings.NewReader(`{"id": "target","ok": true,"rev": "2-62e778c9ec09214dd685a981dcc24074"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodGet { t.Errorf("Unexpected source method: %v", req.Method) } @@ -162,7 +162,7 @@ func Test_copy_RunE(t *testing.T) { "ETag": {`"2-62e778c9ec09214dd685a981dcc24074"`}, }, Body: io.NopCloser(strings.NewReader(`{"id": "target","ok": true,"rev": "2-62e778c9ec09214dd685a981dcc24074"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPut { t.Errorf("Unexpected target method: %v", req.Method) } diff --git a/cmd/kivik/cmd/delete_config_test.go b/cmd/kivik/cmd/delete_config_test.go index 7d10f9204..f58f5941d 100644 --- a/cmd/kivik/cmd/delete_config_test.go +++ b/cmd/kivik/cmd/delete_config_test.go @@ -39,7 +39,7 @@ func Test_delete_config_RunE(t *testing.T) { "Content-Type": []string{"application/json"}, }, Body: io.NopCloser(strings.NewReader(`"foo"`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodDelete { t.Errorf("Unexpected method: %s", req.Method) } diff --git a/cmd/kivik/cmd/get_config_test.go b/cmd/kivik/cmd/get_config_test.go index ec167096f..cf155191c 100644 --- a/cmd/kivik/cmd/get_config_test.go +++ b/cmd/kivik/cmd/get_config_test.go @@ -33,7 +33,7 @@ func Test_get_config_RunE(t *testing.T) { "ETag": []string{"1-xxx"}, }, Body: io.NopCloser(strings.NewReader(`{"uuids":{"algorithm":"sequential","max_count":"1000"},"cluster":{"n":"1","q":"8"},"cors":{"credentials":"false"},"chttpd":{"backlog":"512","bind_address":"0.0.0.0","docroot":"./share/www","max_db_number_for_dbs_info_req":"100","port":"5984","prefer_minimal":"Cache-Control, Content-Length, Content-Range, Content-Type, ETag, Server, Transfer-Encoding, Vary","require_valid_user":"false","server_options":"[{recbuf, undefined}]","socket_options":"[{sndbuf, 262144}, {nodelay, true}]"},"attachments":{"compressible_types":"text/*, application/javascript, application/json, application/xml","compression_level":"8"},"query_server_config":{"os_process_limit":"100","reduce_limit":"true"},"vendor":{"name":"The Apache Software Foundation"},"replicator":{"connection_timeout":"30000","http_connections":"20","interval":"60000","max_churn":"20","max_jobs":"500","retries_per_request":"5","socket_options":"[{keepalive, true}, {nodelay, false}]","ssl_certificate_max_depth":"3","startup_jitter":"5000","verify_ssl_certificates":"false","worker_batch_size":"500","worker_processes":"4"},"ssl":{"port":"6984"},"log":{"file":"/var/log/couchdb/couchdb.log","level":"info","writer":"file"},"indexers":{"couch_mrview":"true"},"view_compaction":{"keyvalue_buffer_size":"2097152"},"features":{"pluggable-storage-engines":"true","scheduler":"true"},"couch_peruser":{"database_prefix":"userdb-","delete_dbs":"false","enable":"false"},"httpd":{"allow_jsonp":"false","authentication_handlers":"{couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}","bind_address":"127.0.0.1","enable_cors":"false","enable_xframe_options":"false","max_http_request_size":"4294967296","port":"5986","secure_rewrites":"true","socket_options":"[{sndbuf, 262144}]"},"database_compaction":{"checkpoint_after":"5242880","doc_buffer_size":"524288"},"csp":{"enable":"true"},"couch_httpd_auth":{"allow_persistent_cookies":"true","auth_cache_size":"50","authentication_db":"_users","authentication_redirect":"/_utils/session.html","iterations":"10","require_valid_user":"false","timeout":"600"},"couchdb_engines":{"couch":"couch_bt_engine"},"couchdb":{"attachment_stream_buffer_size":"4096","changes_doc_ids_optimization_threshold":"100","database_dir":"./data","default_engine":"couch","default_security":"admin_local","delayed_commits":"false","file_compression":"snappy","max_dbs_open":"500","os_process_timeout":"5000","uuid":"0ae5d1a72d60e4e1370a444f1cf7ce7c","view_index_dir":"./data"},"compactions":{"_default":"[{db_fragmentation, \"70%\"}, {view_fragmentation, \"60%\"}]"},"compaction_daemon":{"check_interval":"3600","min_file_size":"131072"}}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.URL.Path != "/_node/_local/_config" { t.Errorf("unexpected path: %s", req.URL.Path) } @@ -51,7 +51,7 @@ func Test_get_config_RunE(t *testing.T) { "ETag": []string{"1-xxx"}, }, Body: io.NopCloser(strings.NewReader(`{}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.URL.Path != "/_node/foo/_config" { t.Errorf("unexpected path: %s", req.URL.Path) } @@ -69,7 +69,7 @@ func Test_get_config_RunE(t *testing.T) { "ETag": []string{"1-xxx"}, }, Body: io.NopCloser(strings.NewReader(`{"max_db_number_for_dbs_info_req":"100","port":"5984","prefer_minimal":"Cache-Control, Content-Length, Content-Range, Content-Type, ETag, Server, Transfer-Encoding, Vary","backlog":"512","docroot":"./share/www","socket_options":"[{sndbuf, 262144}, {nodelay, true}]","require_valid_user":"false","server_options":"[{recbuf, undefined}]","bind_address":"0.0.0.0"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.URL.Path != "/_node/_local/_config/chttpd" { t.Errorf("unexpected path: %s", req.URL.Path) } @@ -87,7 +87,7 @@ func Test_get_config_RunE(t *testing.T) { "ETag": []string{"1-xxx"}, }, Body: io.NopCloser(strings.NewReader(`"512"`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.URL.Path != "/_node/_local/_config/chttpd/backlog" { t.Errorf("unexpected path: %s", req.URL.Path) } diff --git a/cmd/kivik/cmd/get_test.go b/cmd/kivik/cmd/get_test.go index b4649aa5d..af07bdf1f 100644 --- a/cmd/kivik/cmd/get_test.go +++ b/cmd/kivik/cmd/get_test.go @@ -188,7 +188,7 @@ func Test_get_RunE(t *testing.T) { "ETag": []string{"1-xxx"}, }, Body: io.NopCloser(strings.NewReader(`"512"`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.URL.Path != "/_node/_local/_config/chttpd/backlog" { t.Errorf("unexpected path: %s", req.URL.Path) } @@ -206,7 +206,7 @@ func Test_get_RunE(t *testing.T) { "ETag": []string{"1-xxx"}, }, Body: io.NopCloser(strings.NewReader(`{"admins":{"names":["bob"]}}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.URL.Path != "/foo/_security" { t.Errorf("unexpected path: %s", req.URL.Path) } @@ -225,7 +225,7 @@ func Test_get_RunE(t *testing.T) { }, Body: io.NopCloser(strings.NewReader(`{"state":"cluster_enabled"} }`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.URL.Path != clusterPath { t.Errorf("unexpected path: %s", req.URL.Path) } diff --git a/cmd/kivik/cmd/post_cluster_setup_test.go b/cmd/kivik/cmd/post_cluster_setup_test.go index 4b38a776e..ada137bc5 100644 --- a/cmd/kivik/cmd/post_cluster_setup_test.go +++ b/cmd/kivik/cmd/post_cluster_setup_test.go @@ -46,7 +46,7 @@ func Test_post_cluster_setup_RunE(t *testing.T) { "Content-Type": []string{"application/json"}, }, Body: io.NopCloser(strings.NewReader(`"old"`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/post_compact_test.go b/cmd/kivik/cmd/post_compact_test.go index e69843eeb..4f837b1eb 100644 --- a/cmd/kivik/cmd/post_compact_test.go +++ b/cmd/kivik/cmd/post_compact_test.go @@ -33,7 +33,7 @@ func Test_post_compact_RunE(t *testing.T) { tests.Add("success", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/post_compact_views_test.go b/cmd/kivik/cmd/post_compact_views_test.go index 7e7054313..bceaba912 100644 --- a/cmd/kivik/cmd/post_compact_views_test.go +++ b/cmd/kivik/cmd/post_compact_views_test.go @@ -33,7 +33,7 @@ func Test_post_compact_views_RunE(t *testing.T) { tests.Add("success", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } @@ -49,7 +49,7 @@ func Test_post_compact_views_RunE(t *testing.T) { tests.Add("success ddoc", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/post_doc_test.go b/cmd/kivik/cmd/post_doc_test.go index 377689a91..ad01eb7b2 100644 --- a/cmd/kivik/cmd/post_doc_test.go +++ b/cmd/kivik/cmd/post_doc_test.go @@ -41,7 +41,7 @@ func Test_post_doc_RunE(t *testing.T) { tests.Add("json data string", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"id":"random","rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -55,7 +55,7 @@ func Test_post_doc_RunE(t *testing.T) { tests.Add("json data stdin", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"id":"random","rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -70,7 +70,7 @@ func Test_post_doc_RunE(t *testing.T) { tests.Add("json data file", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"id":"random","rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -84,7 +84,7 @@ func Test_post_doc_RunE(t *testing.T) { tests.Add("yaml data string", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"id":"random","rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) diff --git a/cmd/kivik/cmd/post_flush_test.go b/cmd/kivik/cmd/post_flush_test.go index bd9607eda..b0273c127 100644 --- a/cmd/kivik/cmd/post_flush_test.go +++ b/cmd/kivik/cmd/post_flush_test.go @@ -33,7 +33,7 @@ func Test_post_flush_RunE(t *testing.T) { tests.Add("success", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/post_purge_test.go b/cmd/kivik/cmd/post_purge_test.go index 79f5ab34e..5345f8999 100644 --- a/cmd/kivik/cmd/post_purge_test.go +++ b/cmd/kivik/cmd/post_purge_test.go @@ -33,7 +33,7 @@ func Test_post_purge_RunE(t *testing.T) { tests.Add("one rev", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } @@ -52,7 +52,7 @@ func Test_post_purge_RunE(t *testing.T) { tests.Add("two revs", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } @@ -71,7 +71,7 @@ func Test_post_purge_RunE(t *testing.T) { tests.Add("from --data", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/post_test.go b/cmd/kivik/cmd/post_test.go index 21331dbdf..e2d74fac7 100644 --- a/cmd/kivik/cmd/post_test.go +++ b/cmd/kivik/cmd/post_test.go @@ -55,7 +55,7 @@ func Test_post_RunE(t *testing.T) { tests.Add("auto create doc", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"id":"random","rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -69,7 +69,7 @@ func Test_post_RunE(t *testing.T) { tests.Add("auto view cleanup", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"id":"random","rev":"1-xxx"}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %s", req.Method) } @@ -82,7 +82,7 @@ func Test_post_RunE(t *testing.T) { tests.Add("auto flush", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } @@ -98,7 +98,7 @@ func Test_post_RunE(t *testing.T) { tests.Add("auto compact", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } @@ -114,7 +114,7 @@ func Test_post_RunE(t *testing.T) { tests.Add("auto compact views", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } @@ -130,7 +130,7 @@ func Test_post_RunE(t *testing.T) { tests.Add("auto purge", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } @@ -174,7 +174,7 @@ func Test_post_RunE(t *testing.T) { "Content-Type": []string{"application/json"}, }, Body: io.NopCloser(strings.NewReader(`"old"`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/post_view_cleanup_test.go b/cmd/kivik/cmd/post_view_cleanup_test.go index 3fcfe719d..3e97520ae 100644 --- a/cmd/kivik/cmd/post_view_cleanup_test.go +++ b/cmd/kivik/cmd/post_view_cleanup_test.go @@ -33,7 +33,7 @@ func Test_post_view_cleanup_RunE(t *testing.T) { tests.Add("success", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true}`)), - }, func(t *testing.T, req *http.Request) { + }, func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPost { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/put_config_test.go b/cmd/kivik/cmd/put_config_test.go index 394867cbe..f112fb2af 100644 --- a/cmd/kivik/cmd/put_config_test.go +++ b/cmd/kivik/cmd/put_config_test.go @@ -39,7 +39,7 @@ func Test_put_config_RunE(t *testing.T) { "Content-Type": []string{"application/json"}, }, Body: io.NopCloser(strings.NewReader(`"old"`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper content, _ := io.ReadAll(req.Body) if string(content) != `"baz"` { t.Errorf("Unexpected request body: %s", string(content)) diff --git a/cmd/kivik/cmd/put_doc_test.go b/cmd/kivik/cmd/put_doc_test.go index ec5e1494a..514d5ef3f 100644 --- a/cmd/kivik/cmd/put_doc_test.go +++ b/cmd/kivik/cmd/put_doc_test.go @@ -37,7 +37,7 @@ func Test_put_doc_RunE(t *testing.T) { tests.Add("json data string", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -51,7 +51,7 @@ func Test_put_doc_RunE(t *testing.T) { tests.Add("json data stdin", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -66,7 +66,7 @@ func Test_put_doc_RunE(t *testing.T) { tests.Add("json data file", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -80,7 +80,7 @@ func Test_put_doc_RunE(t *testing.T) { tests.Add("yaml data string", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) diff --git a/cmd/kivik/cmd/put_security_test.go b/cmd/kivik/cmd/put_security_test.go index 5f05bc8cf..4ed6c9fa5 100644 --- a/cmd/kivik/cmd/put_security_test.go +++ b/cmd/kivik/cmd/put_security_test.go @@ -40,7 +40,7 @@ func Test_put_security_RunE(t *testing.T) { "Content-Type": []string{"application/json"}, }, Body: io.NopCloser(strings.NewReader(`"old"`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPut { t.Errorf("Unexpected method: %v", req.Method) } diff --git a/cmd/kivik/cmd/put_test.go b/cmd/kivik/cmd/put_test.go index 1b8a7cf3f..6709cdd15 100644 --- a/cmd/kivik/cmd/put_test.go +++ b/cmd/kivik/cmd/put_test.go @@ -38,7 +38,7 @@ func Test_put_RunE(t *testing.T) { tests.Add("json data string", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -52,7 +52,7 @@ func Test_put_RunE(t *testing.T) { tests.Add("json data stdin", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -67,7 +67,7 @@ func Test_put_RunE(t *testing.T) { tests.Add("json data file", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"ok":true,"rev":"1-xxx"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -82,7 +82,7 @@ func Test_put_RunE(t *testing.T) { tests.Add("yaml data string", func(t *testing.T) interface{} { s := testy.ServeResponseValidator(t, &http.Response{ Body: io.NopCloser(strings.NewReader(`{"status":"ok"}`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper defer req.Body.Close() // nolint:errcheck if d := testy.DiffAsJSON(testy.Snapshot(t), req.Body); d != nil { t.Error(d) @@ -100,7 +100,7 @@ func Test_put_RunE(t *testing.T) { "Content-Type": []string{"application/json"}, }, Body: io.NopCloser(strings.NewReader(`"old"`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper content, _ := io.ReadAll(req.Body) if string(content) != `"baz"` { t.Errorf("Unexpected request body: %s", string(content)) @@ -124,7 +124,7 @@ func Test_put_RunE(t *testing.T) { "Content-Type": []string{"application/json"}, }, Body: io.NopCloser(strings.NewReader(`"old"`)), - }, gunzip(func(t *testing.T, req *http.Request) { + }, gunzip(func(t *testing.T, req *http.Request) { //nolint:thelper // Not a helper if req.Method != http.MethodPut { t.Errorf("Unexpected method: %s", req.Method) } diff --git a/cmd/kivik/log/log.go b/cmd/kivik/log/log.go index fd5a27d6d..fe6556a11 100644 --- a/cmd/kivik/log/log.go +++ b/cmd/kivik/log/log.go @@ -63,11 +63,11 @@ func (l *logger) SetErr(err io.Writer) { l.stderr = err } func (l *logger) SetDebug(debug bool) { l.debug = debug } func (l *logger) err(line string) { - fmt.Fprintln(l.stderr, strings.TrimSpace(line)) + _, _ = fmt.Fprintln(l.stderr, strings.TrimSpace(line)) } func (l *logger) out(line string) { - fmt.Fprintln(l.stdout, strings.TrimSpace(line)) + _, _ = fmt.Fprintln(l.stdout, strings.TrimSpace(line)) } func (l *logger) Debug(args ...interface{}) { diff --git a/common_test.go b/common_test.go index 866964a50..82237e27d 100644 --- a/common_test.go +++ b/common_test.go @@ -23,6 +23,7 @@ import ( var testOptions = map[string]interface{}{"foo": 123} func parseTime(t *testing.T, str string) time.Time { + t.Helper() ts, err := time.Parse(time.RFC3339, str) if err != nil { t.Fatal(err) diff --git a/couchdb/attachments_test.go b/couchdb/attachments_test.go index e6da5fc8e..e62e46a4b 100644 --- a/couchdb/attachments_test.go +++ b/couchdb/attachments_test.go @@ -237,7 +237,7 @@ func TestPutAttachment(t *testing.T) { }, status: http.StatusBadGateway, err: "success", - final: func(t *testing.T) { + final: func(t *testing.T) { //nolint:thelper // Not a helper if !body.closed { t.Fatal("body wasn't closed") } diff --git a/couchdb/auth_test.go b/couchdb/auth_test.go index b319058c9..f5746f061 100644 --- a/couchdb/auth_test.go +++ b/couchdb/auth_test.go @@ -35,7 +35,7 @@ func TestAuthenticationOptions(t *testing.T) { tests := testy.NewTable() tests.Add("BasicAuth", test{ - handler: func(t *testing.T) http.Handler { + handler: func(t *testing.T) http.Handler { //nolint:thelper // Not a helper return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if h := r.Header.Get("Authorization"); h != "Basic Ym9iOmFiYzEyMw==" { t.Errorf("Unexpected Auth header: %s\n", h) @@ -47,7 +47,7 @@ func TestAuthenticationOptions(t *testing.T) { options: BasicAuth("bob", "abc123"), }) tests.Add("CookieAuth", test{ - handler: func(t *testing.T) http.Handler { + handler: func(t *testing.T) http.Handler { //nolint:thelper // Not a helper expectedPaths := []string{"/_session", "/"} i := -1 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -62,7 +62,7 @@ func TestAuthenticationOptions(t *testing.T) { options: CookieAuth("bob", "abc123"), }) tests.Add("ProxyAuth", test{ - handler: func(t *testing.T) http.Handler { + handler: func(t *testing.T) http.Handler { //nolint:thelper // Not a helper return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if h := r.Header.Get("X-Auth-CouchDB-UserName"); h != "bob" { t.Errorf("Unexpected X-Auth-CouchDB-UserName header: %s", h) @@ -85,7 +85,7 @@ func TestAuthenticationOptions(t *testing.T) { ), }) tests.Add("JWTAuth", test{ - handler: func(t *testing.T) http.Handler { + handler: func(t *testing.T) http.Handler { //nolint:thelper // Not a helper return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if h := r.Header.Get("Authorization"); h != "Bearer tokentoken" { t.Errorf("Unexpected Auth header: %s\n", h) diff --git a/couchdb/chttp/chttp_test.go b/couchdb/chttp/chttp_test.go index bd0706d76..91da371c7 100644 --- a/couchdb/chttp/chttp_test.go +++ b/couchdb/chttp/chttp_test.go @@ -715,7 +715,7 @@ func TestDoReq(t *testing.T) { err: `Put "?http://example.com/foo"?: bad request`, }) tests.Add("response trace", tt{ - trace: func(t *testing.T, success *bool) *ClientTrace { + trace: func(t *testing.T, success *bool) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPResponse: func(r *http.Response) { *success = true @@ -735,7 +735,7 @@ func TestDoReq(t *testing.T) { // response body trace }) tests.Add("response body trace", tt{ - trace: func(t *testing.T, success *bool) *ClientTrace { + trace: func(t *testing.T, success *bool) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPResponseBody: func(r *http.Response) { *success = true @@ -758,7 +758,7 @@ func TestDoReq(t *testing.T) { // response trace }) tests.Add("request trace", tt{ - trace: func(t *testing.T, success *bool) *ClientTrace { + trace: func(t *testing.T, success *bool) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPRequest: func(r *http.Request) { *success = true @@ -785,7 +785,7 @@ func TestDoReq(t *testing.T) { // request trace }) tests.Add("request body trace", tt{ - trace: func(t *testing.T, success *bool) *ClientTrace { + trace: func(t *testing.T, success *bool) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPRequestBody: func(r *http.Request) { *success = true diff --git a/couchdb/chttp/trace_test.go b/couchdb/chttp/trace_test.go index fc66a0bf7..07dd3e0a5 100644 --- a/couchdb/chttp/trace_test.go +++ b/couchdb/chttp/trace_test.go @@ -38,7 +38,7 @@ func TestHTTPResponse(t *testing.T) { }, { name: "HTTPResponseBody/cloned response", - trace: func(t *testing.T) *ClientTrace { + trace: func(t *testing.T) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPResponseBody: func(r *http.Response) { if r.StatusCode != 200 { @@ -57,7 +57,7 @@ func TestHTTPResponse(t *testing.T) { }, { name: "HTTPResponse/cloned response", - trace: func(t *testing.T) *ClientTrace { + trace: func(t *testing.T) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPResponse: func(r *http.Response) { if r.StatusCode != 200 { @@ -101,7 +101,7 @@ func TestHTTPRequest(t *testing.T) { }, { name: "HTTPRequestBody/cloned response", - trace: func(t *testing.T) *ClientTrace { + trace: func(t *testing.T) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPRequestBody: func(r *http.Request) { if r.Method != "PUT" { @@ -120,7 +120,7 @@ func TestHTTPRequest(t *testing.T) { }, { name: "HTTPRequest/cloned response", - trace: func(t *testing.T) *ClientTrace { + trace: func(t *testing.T) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPRequest: func(r *http.Request) { if r.Method != "PUT" { @@ -138,7 +138,7 @@ func TestHTTPRequest(t *testing.T) { }, { name: "HTTPRequestBody/no body", - trace: func(t *testing.T) *ClientTrace { + trace: func(t *testing.T) *ClientTrace { //nolint:thelper // Not a helper return &ClientTrace{ HTTPRequestBody: func(r *http.Request) { if r.Method != "GET" { diff --git a/couchdb/db_test.go b/couchdb/db_test.go index 4c9971c40..6d81fd145 100644 --- a/couchdb/db_test.go +++ b/couchdb/db_test.go @@ -427,6 +427,7 @@ Content-Length: 86 } func rowAttachments(t *testing.T, atts driver.Attachments) []*Attachment { + t.Helper() var attachments []*Attachment if atts != nil { att := new(driver.Attachment) diff --git a/couchdb/mock_test.go b/couchdb/mock_test.go index 68cd0b5ac..5d261bd17 100644 --- a/couchdb/mock_test.go +++ b/couchdb/mock_test.go @@ -82,6 +82,7 @@ func Body(str string) io.ReadCloser { } func parseTime(t *testing.T, str string) time.Time { + t.Helper() ts, err := time.Parse(time.RFC3339, str) if err != nil { t.Fatal(err) @@ -133,6 +134,7 @@ func realDB(t *testing.T) *db { } func realDBConnect(t *testing.T) (*db, error) { + t.Helper() driver := &couch{} c, err := driver.NewClient(kt.DSN3(t), OptionNoRequestCompression()) if err != nil { diff --git a/db_test.go b/db_test.go index f74a2daa9..8a5c05911 100644 --- a/db_test.go +++ b/db_test.go @@ -2930,7 +2930,7 @@ func TestDBClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, db *DB) { + work: func(t *testing.T, db *DB) { //nolint:thelper // Not a helper u := db.AllDocs(context.Background()) for u.Next() { //nolint:revive // intentional empty block } @@ -2946,7 +2946,7 @@ func TestDBClose(t *testing.T) { return []driver.BulkResult{}, nil }, }, - work: func(t *testing.T, db *DB) { + work: func(t *testing.T, db *DB) { //nolint:thelper // Not a helper _, err := db.BulkDocs(context.Background(), []interface{}{ map[string]string{"_id": "foo"}, }) diff --git a/kivik_test.go b/kivik_test.go index f630cbcb4..ff7dd170b 100644 --- a/kivik_test.go +++ b/kivik_test.go @@ -839,7 +839,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DBUpdates(context.Background()) if err := u.Err(); err != nil { t.Fatal(err) @@ -866,7 +866,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").AllDocs(context.Background()) for u.Next() { //nolint:revive // intentional empty block } @@ -886,7 +886,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").BulkDocs(context.Background(), []interface{}{ map[string]string{"_id": "foo"}, }) @@ -910,7 +910,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").BulkGet(context.Background(), []BulkGetReference{}) for u.Next() { //nolint:revive // intentional empty block } @@ -934,7 +934,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").Changes(context.Background()) if err := u.Err(); err != nil { t.Fatal(err) @@ -961,7 +961,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").DesignDocs(context.Background()) for u.Next() { //nolint:revive // intentional empty block } @@ -985,7 +985,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").LocalDocs(context.Background()) for u.Next() { //nolint:revive // intentional empty block } @@ -1009,7 +1009,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").Query(context.Background(), "", "") for u.Next() { //nolint:revive // intentional empty block } @@ -1033,7 +1033,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").Find(context.Background(), nil) for u.Next() { //nolint:revive // intentional empty block } @@ -1053,7 +1053,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").Get(context.Background(), "") if u.Err() != nil { t.Fatal(u.Err()) @@ -1075,7 +1075,7 @@ func TestClientClose(t *testing.T) { }, nil }, }, - work: func(t *testing.T, c *Client) { + work: func(t *testing.T, c *Client) { //nolint:thelper // Not a helper u := c.DB("foo").RevsDiff(context.Background(), "") for u.Next() { //nolint:revive // intentional empty block } diff --git a/kiviktest/client/alldbs.go b/kiviktest/client/alldbs.go index 47f786c40..a5327547a 100644 --- a/kiviktest/client/alldbs.go +++ b/kiviktest/client/alldbs.go @@ -43,7 +43,6 @@ func allDBs(ctx *kt.Context) { func testAllDBsRW(ctx *kt.Context) { dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) expected := append(ctx.StringSlice("expected"), dbName) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { diff --git a/kiviktest/client/createdb.go b/kiviktest/client/createdb.go index bc69d61f3..be36eaf0b 100644 --- a/kiviktest/client/createdb.go +++ b/kiviktest/client/createdb.go @@ -37,7 +37,7 @@ func createDB(ctx *kt.Context) { func testCreateDB(ctx *kt.Context, client *kivik.Client) { ctx.Parallel() dbName := ctx.TestDBName() - defer ctx.DestroyDB(dbName) + ctx.T.Cleanup(func() { ctx.DestroyDB(dbName) }) err := client.CreateDB(context.Background(), dbName, ctx.Options("db")) if !ctx.IsExpectedSuccess(err) { return diff --git a/kiviktest/client/dbexists.go b/kiviktest/client/dbexists.go index c67b49d4e..e2caed92a 100644 --- a/kiviktest/client/dbexists.go +++ b/kiviktest/client/dbexists.go @@ -36,7 +36,6 @@ func dbExists(ctx *kt.Context) { }) ctx.RunRW(func(ctx *kt.Context) { dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { checkDBExists(ctx, ctx.Admin, dbName) diff --git a/kiviktest/client/destroydb.go b/kiviktest/client/destroydb.go index 5473f77db..a83d0d5ea 100644 --- a/kiviktest/client/destroydb.go +++ b/kiviktest/client/destroydb.go @@ -41,7 +41,6 @@ func testDestroy(ctx *kt.Context, client *kivik.Client) { ctx.Run("ExistingDB", func(ctx *kt.Context) { ctx.Parallel() dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) ctx.CheckError(client.DestroyDB(context.Background(), dbName, ctx.Options("db"))) }) ctx.Run("NonExistantDB", func(ctx *kt.Context) { diff --git a/kiviktest/client/replicate.go b/kiviktest/client/replicate.go index 4de2c461d..74f0e3e22 100644 --- a/kiviktest/client/replicate.go +++ b/kiviktest/client/replicate.go @@ -61,10 +61,6 @@ func testReplication(ctx *kt.Context, client *kivik.Client) { prefix = "" } targetDB, sourceDB := ctx.TestDB(), ctx.TestDB() - defer func() { - ctx.DestroyDB(targetDB) - ctx.DestroyDB(sourceDB) - }() dbtarget := prefix + targetDB dbsource := prefix + sourceDB @@ -116,7 +112,7 @@ func testReplication(ctx *kt.Context, client *kivik.Client) { if !ctx.IsExpectedSuccess(err) { return } - defer rep.Delete(context.Background()) // nolint: errcheck + ctx.T.Cleanup(func() { _ = rep.Delete(context.Background()) }) timeout := time.Duration(ctx.MustInt("timeoutSeconds")) * time.Second cx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -157,7 +153,7 @@ func doReplicationTest(ctx *kt.Context, client *kivik.Client, dbtarget, dbsource if !ctx.IsExpectedSuccess(err) { return success } - defer rep.Delete(context.Background()) // nolint: errcheck + ctx.T.Cleanup(func() { _ = rep.Delete(context.Background()) }) timeout := time.Duration(ctx.MustInt("timeoutSeconds")) * time.Second cx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() @@ -220,6 +216,7 @@ func doReplicationTest(ctx *kt.Context, client *kivik.Client, dbtarget, dbsource } func checkReplicationURL(t *testing.T, name, want, got string) { + t.Helper() wantURL, err := url.Parse(want) if err != nil { t.Fatal(err) diff --git a/kiviktest/client/updates.go b/kiviktest/client/updates.go index fa293da06..72b614498 100644 --- a/kiviktest/client/updates.go +++ b/kiviktest/client/updates.go @@ -63,7 +63,7 @@ func testUpdates(ctx *kt.Context, client *kivik.Client) { eventErrors <- updates.Err() close(eventErrors) }() - defer ctx.DestroyDB(dbname) + ctx.T.Cleanup(func() { ctx.DestroyDB(dbname) }) if err := ctx.Admin.CreateDB(context.Background(), dbname, ctx.Options("db")); err != nil { ctx.Fatalf("Failed to create db: %s", err) } diff --git a/kiviktest/db/alldocs.go b/kiviktest/db/alldocs.go index 1ef01c5cf..9ec57cfec 100644 --- a/kiviktest/db/alldocs.go +++ b/kiviktest/db/alldocs.go @@ -49,7 +49,6 @@ func testAllDocsRW(ctx *kt.Context) { if err != nil { ctx.Errorf("Failed to set up temp db: %s", err) } - defer ctx.DestroyDB(dbName) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { doTest(ctx, ctx.Admin, dbName, 0, expected, true) diff --git a/kiviktest/db/bulk.go b/kiviktest/db/bulk.go index aa8cf4e36..6744d6112 100644 --- a/kiviktest/db/bulk.go +++ b/kiviktest/db/bulk.go @@ -39,7 +39,6 @@ func bulkDocs(ctx *kt.Context) { func testBulkDocs(ctx *kt.Context, client *kivik.Client) { // nolint: gocyclo ctx.Parallel() dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) adb := ctx.Admin.DB(dbname, ctx.Options("db")) if err := adb.Err(); err != nil { ctx.Fatalf("Failed to connect to db as admin: %s", err) diff --git a/kiviktest/db/changes.go b/kiviktest/db/changes.go index 1c9dd1621..675d39d0e 100644 --- a/kiviktest/db/changes.go +++ b/kiviktest/db/changes.go @@ -65,7 +65,6 @@ type cDoc struct { func testContinuousChanges(ctx *kt.Context, client *kivik.Client) { ctx.Parallel() dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := client.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("failed to connect to db: %s", err) @@ -148,7 +147,6 @@ func testContinuousChanges(ctx *kt.Context, client *kivik.Client) { func testNormalChanges(ctx *kt.Context, client *kivik.Client) { ctx.Parallel() dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := client.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("failed to connect to db: %s", err) diff --git a/kiviktest/db/compact.go b/kiviktest/db/compact.go index e4d471d7e..90cfdd797 100644 --- a/kiviktest/db/compact.go +++ b/kiviktest/db/compact.go @@ -38,7 +38,6 @@ func compact(ctx *kt.Context) { func testCompact(ctx *kt.Context, client *kivik.Client) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := client.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to connect to db: %s", err) diff --git a/kiviktest/db/copy.go b/kiviktest/db/copy.go index 2cb05b1ee..72f2753ec 100644 --- a/kiviktest/db/copy.go +++ b/kiviktest/db/copy.go @@ -26,7 +26,6 @@ func init() { func _copy(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := ctx.Admin.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to open db: %s", err) diff --git a/kiviktest/db/createIndex.go b/kiviktest/db/createIndex.go index 7a080d665..1854727f0 100644 --- a/kiviktest/db/createIndex.go +++ b/kiviktest/db/createIndex.go @@ -38,7 +38,6 @@ func createIndex(ctx *kt.Context) { func testCreateIndex(ctx *kt.Context, client *kivik.Client) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := client.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to open db: %s", err) diff --git a/kiviktest/db/createdoc.go b/kiviktest/db/createdoc.go index 4aee92bfe..12aed8d95 100644 --- a/kiviktest/db/createdoc.go +++ b/kiviktest/db/createdoc.go @@ -26,7 +26,6 @@ func init() { func createDoc(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { ctx.Parallel() diff --git a/kiviktest/db/delattachment.go b/kiviktest/db/delattachment.go index 87f555243..3ad84c48e 100644 --- a/kiviktest/db/delattachment.go +++ b/kiviktest/db/delattachment.go @@ -26,7 +26,6 @@ func init() { func delAttachment(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { ctx.Parallel() diff --git a/kiviktest/db/delete.go b/kiviktest/db/delete.go index 6eb25789b..7be2fdf43 100644 --- a/kiviktest/db/delete.go +++ b/kiviktest/db/delete.go @@ -43,7 +43,6 @@ type deleteDoc struct { func testDelete(ctx *kt.Context, client *kivik.Client) { ctx.Parallel() dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) admdb := ctx.Admin.DB(dbName, ctx.Options("db")) if err := admdb.Err(); err != nil { ctx.Errorf("Failed to connect to db as admin: %s", err) diff --git a/kiviktest/db/delindex.go b/kiviktest/db/delindex.go index d523869a7..0c5b283b7 100644 --- a/kiviktest/db/delindex.go +++ b/kiviktest/db/delindex.go @@ -38,7 +38,7 @@ func delindex(ctx *kt.Context) { func testDelIndex(ctx *kt.Context, client *kivik.Client) { dbname := ctx.TestDB() - defer ctx.Admin.DestroyDB(context.Background(), dbname, ctx.Options("db")) // nolint: errcheck + // ctx.T.Cleanup(func() { ctx.Admin.DestroyDB(context.Background(), dbname, ctx.Options("db")) }) // nolint: errcheck dba := ctx.Admin.DB(dbname, ctx.Options("db")) if err := dba.Err(); err != nil { ctx.Fatalf("Failed to open db as admin: %s", err) diff --git a/kiviktest/db/explain.go b/kiviktest/db/explain.go index b5d831df6..a0d3a241e 100644 --- a/kiviktest/db/explain.go +++ b/kiviktest/db/explain.go @@ -43,7 +43,6 @@ func testExplainRW(ctx *kt.Context) { return } dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { doExplainTest(ctx, ctx.Admin, dbName) diff --git a/kiviktest/db/find.go b/kiviktest/db/find.go index 7284d659a..e62213915 100644 --- a/kiviktest/db/find.go +++ b/kiviktest/db/find.go @@ -48,7 +48,6 @@ func testFindRW(ctx *kt.Context) { if err != nil { ctx.Errorf("Failed to set up temp db: %s", err) } - defer ctx.DestroyDB(dbName) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { doFindTest(ctx, ctx.Admin, dbName, 0, expected) diff --git a/kiviktest/db/get.go b/kiviktest/db/get.go index 23a4149fd..a653efe88 100644 --- a/kiviktest/db/get.go +++ b/kiviktest/db/get.go @@ -36,7 +36,6 @@ func get(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { const age = 32 dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) db := ctx.Admin.DB(dbName, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to connect to test db: %s", err) diff --git a/kiviktest/db/getRev.go b/kiviktest/db/getRev.go index cd079250b..e53a0fbb2 100644 --- a/kiviktest/db/getRev.go +++ b/kiviktest/db/getRev.go @@ -27,7 +27,6 @@ func init() { func getRev(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) db := ctx.Admin.DB(dbName, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to connect to test db: %s", err) diff --git a/kiviktest/db/getattachment.go b/kiviktest/db/getattachment.go index 762ca7b98..525ff1542 100644 --- a/kiviktest/db/getattachment.go +++ b/kiviktest/db/getattachment.go @@ -26,7 +26,6 @@ func init() { func getAttachment(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) adb := ctx.Admin.DB(dbname, ctx.Options("db")) if err := adb.Err(); err != nil { ctx.Fatalf("Failed to open db: %s", err) diff --git a/kiviktest/db/getattachmentmeta.go b/kiviktest/db/getattachmentmeta.go index c2fec0a6d..54813160e 100644 --- a/kiviktest/db/getattachmentmeta.go +++ b/kiviktest/db/getattachmentmeta.go @@ -26,7 +26,6 @@ func init() { func getAttachmentMeta(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) adb := ctx.Admin.DB(dbname, ctx.Options("db")) if err := adb.Err(); err != nil { ctx.Fatalf("Failed to open db: %s", err) diff --git a/kiviktest/db/getindexes.go b/kiviktest/db/getindexes.go index d3f9d25a2..ed8b73cd3 100644 --- a/kiviktest/db/getindexes.go +++ b/kiviktest/db/getindexes.go @@ -60,7 +60,6 @@ func roGetIndexesTests(ctx *kt.Context, client *kivik.Client) { func rwGetIndexesTests(ctx *kt.Context, client *kivik.Client) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) dba := ctx.Admin.DB(dbname, ctx.Options("db")) if err := dba.Err(); err != nil { ctx.Fatalf("Failed to open db as admin: %s", err) diff --git a/kiviktest/db/put.go b/kiviktest/db/put.go index 97def29eb..42c465397 100644 --- a/kiviktest/db/put.go +++ b/kiviktest/db/put.go @@ -37,7 +37,6 @@ func put(ctx *kt.Context) { func testPut(ctx *kt.Context, client *kivik.Client) { ctx.Parallel() dbName := ctx.TestDB() - defer ctx.DestroyDB(dbName) db := client.DB(dbName, ctx.Options("db")) if err := db.Err(); !ctx.IsExpectedSuccess(err) { return diff --git a/kiviktest/db/putattachment.go b/kiviktest/db/putattachment.go index 5b1282d08..bdff3dc51 100644 --- a/kiviktest/db/putattachment.go +++ b/kiviktest/db/putattachment.go @@ -28,7 +28,6 @@ func init() { func putAttachment(ctx *kt.Context) { ctx.RunRW(func(ctx *kt.Context) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { ctx.Parallel() diff --git a/kiviktest/db/query.go b/kiviktest/db/query.go index 421a388a0..a5573873b 100644 --- a/kiviktest/db/query.go +++ b/kiviktest/db/query.go @@ -42,7 +42,6 @@ func testQueryRW(ctx *kt.Context) { if err != nil { ctx.Errorf("Failed to set up temp db: %s", err) } - defer ctx.DestroyDB(dbName) ctx.Run("group", func(ctx *kt.Context) { ctx.RunAdmin(func(ctx *kt.Context) { doQueryTest(ctx, ctx.Admin, dbName, 0, expected) diff --git a/kiviktest/db/security.go b/kiviktest/db/security.go index 10621fb9b..4485c574c 100644 --- a/kiviktest/db/security.go +++ b/kiviktest/db/security.go @@ -60,7 +60,6 @@ func security(ctx *kt.Context) { }) ctx.RunRW(func(ctx *kt.Context) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := ctx.Admin.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to open db: %s", err) @@ -99,7 +98,6 @@ func testSetSecurityTests(ctx *kt.Context, client *kivik.Client) { ctx.Run("Exists", func(ctx *kt.Context) { ctx.Parallel() dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) testSetSecurity(ctx, client, dbname) }) ctx.Run("NotExists", func(ctx *kt.Context) { diff --git a/kiviktest/db/stats.go b/kiviktest/db/stats.go index 425db4608..bb2ba038d 100644 --- a/kiviktest/db/stats.go +++ b/kiviktest/db/stats.go @@ -48,7 +48,6 @@ func stats(ctx *kt.Context) { func rwTests(ctx *kt.Context, client *kivik.Client) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := ctx.Admin.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to connect to db: %s", err) diff --git a/kiviktest/db/viewcleanup.go b/kiviktest/db/viewcleanup.go index b5e08f5fc..20a0b11fd 100644 --- a/kiviktest/db/viewcleanup.go +++ b/kiviktest/db/viewcleanup.go @@ -38,7 +38,6 @@ func viewCleanup(ctx *kt.Context) { func testViewCleanup(ctx *kt.Context, client *kivik.Client) { dbname := ctx.TestDB() - defer ctx.DestroyDB(dbname) db := client.DB(dbname, ctx.Options("db")) if err := db.Err(); err != nil { ctx.Fatalf("Failed to connect to db: %s", err) diff --git a/kiviktest/kt/config.go b/kiviktest/kt/config.go index 8d2b8ce8f..275654d66 100644 --- a/kiviktest/kt/config.go +++ b/kiviktest/kt/config.go @@ -29,6 +29,7 @@ var AllDocsIndex = kivik.Index{ type SuiteConfig map[string]interface{} func name(t *testing.T) string { + t.Helper() name := t.Name() return name[strings.Index(name, "/")+1:] } @@ -58,17 +59,20 @@ func (c SuiteConfig) get(name, key string) interface{} { // Interface returns the configuration value as an interface{}. func (c SuiteConfig) Interface(t *testing.T, key string) interface{} { + t.Helper() return c.get(name(t), key) } // Bool returns the boolean value of the key. func (c SuiteConfig) Bool(t *testing.T, key string) bool { + t.Helper() b, _ := c.Interface(t, key).(bool) return b } // Skip will skip the currently running test if configuration dictates. func (c SuiteConfig) Skip(t *testing.T) { + t.Helper() if c.Bool(t, "skip") { t.Skip("Test skipped by suite configuration") } @@ -76,18 +80,21 @@ func (c SuiteConfig) Skip(t *testing.T) { // StringSlice returns a string slice. func (c SuiteConfig) StringSlice(t *testing.T, key string) []string { + t.Helper() v, _ := c.Interface(t, key).([]string) return v } // Int returns an int. func (c SuiteConfig) Int(t *testing.T, key string) int { + t.Helper() v, _ := c.Interface(t, key).(int) return v } // String returns a string. func (c SuiteConfig) String(t *testing.T, key string) string { + t.Helper() v, _ := c.Interface(t, key).(string) return v } diff --git a/kiviktest/kt/connect.go b/kiviktest/kt/connect.go index 580b47be5..b724f8b91 100644 --- a/kiviktest/kt/connect.go +++ b/kiviktest/kt/connect.go @@ -50,7 +50,7 @@ func NoAuthDSN(t *testing.T) string { return parsed.String() } -func connect(dsn string, t *testing.T) *kivik.Client { +func connect(t *testing.T, dsn string) *kivik.Client { t.Helper() client, err := kivik.New("couch", dsn) if err != nil { @@ -62,11 +62,11 @@ func connect(dsn string, t *testing.T) *kivik.Client { // GetClient returns a connection to a CouchDB client, for testing. func GetClient(t *testing.T) *kivik.Client { t.Helper() - return connect(DSN3(t), t) + return connect(t, DSN3(t)) } // GetNoAuthClient returns an unauthenticated connection to a CouchDB client, for testing. func GetNoAuthClient(t *testing.T) *kivik.Client { t.Helper() - return connect(NoAuthDSN(t), t) + return connect(t, NoAuthDSN(t)) } diff --git a/kiviktest/kt/kt.go b/kiviktest/kt/kt.go index dc941039c..fa918e66c 100644 --- a/kiviktest/kt/kt.go +++ b/kiviktest/kt/kt.go @@ -49,6 +49,7 @@ type Context struct { // Child returns a shallow copy of itself with a new t. func (c *Context) Child(t *testing.T) *Context { + t.Helper() return &Context{ RW: c.RW, Admin: c.Admin, @@ -233,7 +234,8 @@ func init() { // TestDBPrefix is used to prefix temporary database names during tests. const TestDBPrefix = "kivik$" -// TestDB creates a test database and returns its name. +// TestDB creates a test database, regesters a cleanup function to destroy it, +// and returns its name. func (c *Context) TestDB() string { c.T.Helper() dbname := c.TestDBName() @@ -243,6 +245,7 @@ func (c *Context) TestDB() string { if err != nil { c.Fatalf("Failed to create database: %s", err) } + c.T.Cleanup(func() { c.DestroyDB(dbname) }) return dbname } @@ -262,8 +265,8 @@ func TestDBName(t *testing.T) string { id = id[strings.Index(id, "/")+1:] id = strings.ReplaceAll(id, "/", "_") + "$" rndMU.Lock() - defer rndMU.Unlock() dbname := fmt.Sprintf("%s%s%016x", TestDBPrefix, id, rnd.Int63()) + rndMU.Unlock() return dbname } diff --git a/kiviktest/test.go b/kiviktest/test.go index f1776d766..6ad845b58 100644 --- a/kiviktest/test.go +++ b/kiviktest/test.go @@ -319,7 +319,7 @@ func RunTests(opts Options) { tests := []testing.InternalTest{ { Name: "MainTest", - F: func(t *testing.T) { + F: func(t *testing.T) { //nolint:thelper // Not a helper Test(t, opts.Driver, opts.DSN, opts.Suites, opts.RW) }, }, @@ -399,6 +399,7 @@ func detectCompatibility(client *kivik.Client) ([]string, error) { // ConnectClients connects clients. func ConnectClients(t *testing.T, driverName, dsn string, opts kivik.Option) (*kt.Context, error) { + t.Helper() var noAuthDSN string if parsed, err := url.Parse(dsn); err == nil { if parsed.User == nil { @@ -427,7 +428,7 @@ func ConnectClients(t *testing.T, driverName, dsn string, opts kivik.Option) (*k } // DoTest runs a suite of tests. -func DoTest(t *testing.T, suite, envName string) { +func DoTest(t *testing.T, suite, envName string) { //nolint:thelper // Not a helper opts, _ := suites[suite].Interface(t, "Options").(kivik.Option) dsn := os.Getenv(envName) diff --git a/mockdb/client_test.go b/mockdb/client_test.go index 5d9fc30b2..bde8d23cb 100644 --- a/mockdb/client_test.go +++ b/mockdb/client_test.go @@ -58,7 +58,7 @@ func TestCloseClient(t *testing.T) { setup: func(m *Client) { m.ExpectClose().WillReturnError(errors.New("close failed")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // not a helper err := c.Close() if !testy.ErrorMatches("close failed", err) { t.Errorf("unexpected error: %s", err) @@ -67,7 +67,7 @@ func TestCloseClient(t *testing.T) { err: "", }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // not a helper err := c.Close() const want = "call to Close() was not expected, all expectations already fulfilled" if !testy.ErrorMatches(want, err) { @@ -81,7 +81,7 @@ func TestCloseClient(t *testing.T) { return errors.New("custom error") }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.Close() if !testy.ErrorMatches("custom error", err) { t.Errorf("Unexpected error: %s", err) @@ -97,7 +97,7 @@ func TestAllDBs(t *testing.T) { setup: func(m *Client) { m.ExpectAllDBs().WillReturnError(fmt.Errorf("AllDBs failed")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.AllDBs(context.TODO()) if !testy.ErrorMatches("AllDBs failed", err) { t.Errorf("unexpected error: %s", err) @@ -105,7 +105,7 @@ func TestAllDBs(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.AllDBs(context.TODO()) if !testy.ErrorMatches("call to AllDBs() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -118,7 +118,7 @@ func TestAllDBs(t *testing.T) { setup: func(m *Client) { m.ExpectAllDBs().WillReturn(expected) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.AllDBs(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -133,7 +133,7 @@ func TestAllDBs(t *testing.T) { setup: func(m *Client) { m.ExpectAllDBs().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.AllDBs(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -144,7 +144,7 @@ func TestAllDBs(t *testing.T) { setup: func(m *Client) { m.ExpectAllDBs().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.AllDBs(context.TODO(), kivik.Param("foo", 123)) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -157,7 +157,7 @@ func TestAllDBs(t *testing.T) { return nil, errors.New("custom error") }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.AllDBs(context.TODO()) if !testy.ErrorMatches("custom error", err) { t.Errorf("Unexpected error: %s", err) @@ -173,7 +173,7 @@ func TestClusterSetup(t *testing.T) { setup: func(m *Client) { m.ExpectClusterSetup().WillReturnError(errors.New("setup error")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.ClusterSetup(context.TODO(), 123) if !testy.ErrorMatches("setup error", err) { t.Errorf("Unexpected error: %s", err) @@ -184,7 +184,7 @@ func TestClusterSetup(t *testing.T) { setup: func(m *Client) { m.ExpectClusterSetup().WithAction(123) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.ClusterSetup(context.TODO(), 123) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -195,7 +195,7 @@ func TestClusterSetup(t *testing.T) { setup: func(m *Client) { m.ExpectClusterSetup().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.ClusterSetup(newCanceledContext(), 123) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -203,7 +203,7 @@ func TestClusterSetup(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.ClusterSetup(context.TODO(), 123) if !testy.ErrorMatches("call to ClusterSetup() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -216,7 +216,7 @@ func TestClusterSetup(t *testing.T) { return errors.New("custom error") }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.ClusterSetup(context.TODO(), 123) if !testy.ErrorMatches("custom error", err) { t.Errorf("Unexpected error: %s", err) @@ -232,7 +232,7 @@ func TestClusterStatus(t *testing.T) { setup: func(m *Client) { m.ExpectClusterStatus().WillReturnError(errors.New("status error")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ClusterStatus(context.TODO()) if !testy.ErrorMatches("status error", err) { t.Errorf("Unexpected error: %s", err) @@ -243,7 +243,7 @@ func TestClusterStatus(t *testing.T) { setup: func(m *Client) { m.ExpectClusterStatus().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ClusterStatus(context.TODO()) if !testy.ErrorMatchesRE(`map\[foo:123]`, err) { t.Errorf("Unexpected error: %s", err) @@ -257,7 +257,7 @@ func TestClusterStatus(t *testing.T) { setup: func(m *Client) { m.ExpectClusterStatus().WillReturn(expected) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.ClusterStatus(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -272,7 +272,7 @@ func TestClusterStatus(t *testing.T) { setup: func(m *Client) { m.ExpectClusterStatus().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ClusterStatus(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -285,7 +285,7 @@ func TestClusterStatus(t *testing.T) { m.ExpectClusterStatus() m.MatchExpectationsInOrder(false) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ClusterStatus(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -298,7 +298,7 @@ func TestClusterStatus(t *testing.T) { m.ExpectClose() m.MatchExpectationsInOrder(false) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ClusterStatus(context.TODO()) if !testy.ErrorMatches("call to ClusterStatus(ctx, [?]) was not expected", err) { t.Errorf("Unexpected error: %s", err) @@ -312,7 +312,7 @@ func TestClusterStatus(t *testing.T) { return "", errors.New("custom error") }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ClusterStatus(newCanceledContext()) if !testy.ErrorMatches("custom error", err) { t.Errorf("Unexpected error: %s", err) @@ -328,7 +328,7 @@ func TestDBExists(t *testing.T) { setup: func(m *Client) { m.ExpectDBExists().WillReturnError(errors.New("existence error")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DBExists(context.TODO(), "foo") if !testy.ErrorMatches("existence error", err) { t.Errorf("Unexpected error: %s", err) @@ -339,7 +339,7 @@ func TestDBExists(t *testing.T) { setup: func(m *Client) { m.ExpectDBExists().WithName("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper exists, err := c.DBExists(context.TODO(), "foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -353,7 +353,7 @@ func TestDBExists(t *testing.T) { setup: func(m *Client) { m.ExpectDBExists().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DBExists(context.TODO(), "foo") if !testy.ErrorMatchesRE(`map\[foo:123]`, err) { t.Errorf("Unexpected error: %s", err) @@ -365,7 +365,7 @@ func TestDBExists(t *testing.T) { setup: func(m *Client) { m.ExpectDBExists().WillReturn(true) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper exists, err := c.DBExists(context.TODO(), "foo") if !testy.ErrorMatchesRE("", err) { t.Errorf("Unexpected error: %s", err) @@ -379,7 +379,7 @@ func TestDBExists(t *testing.T) { setup: func(m *Client) { m.ExpectDBExists().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DBExists(newCanceledContext(), "foo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -395,7 +395,7 @@ func TestDestroyDB(t *testing.T) { setup: func(m *Client) { m.ExpectDestroyDB().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DestroyDB(newCanceledContext(), "foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -406,7 +406,7 @@ func TestDestroyDB(t *testing.T) { setup: func(m *Client) { m.ExpectDestroyDB().WithName("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DestroyDB(newCanceledContext(), "foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -417,7 +417,7 @@ func TestDestroyDB(t *testing.T) { setup: func(m *Client) { m.ExpectDestroyDB().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DestroyDB(newCanceledContext(), "foo") if !testy.ErrorMatchesRE(`map\[foo:123]`, err) { t.Errorf("Unexpected error: %s", err) @@ -429,7 +429,7 @@ func TestDestroyDB(t *testing.T) { setup: func(m *Client) { m.ExpectDestroyDB().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DestroyDB(newCanceledContext(), "foo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -445,7 +445,7 @@ func TestDBsStats(t *testing.T) { setup: func(m *Client) { m.ExpectDBsStats().WillReturnError(errors.New("stats error")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DBsStats(context.TODO(), []string{"foo"}) if !testy.ErrorMatches("stats error", err) { t.Errorf("Unexpected error: %s", err) @@ -456,7 +456,7 @@ func TestDBsStats(t *testing.T) { setup: func(m *Client) { m.ExpectDBsStats().WithNames([]string{"a", "b"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DBsStats(context.TODO(), []string{"foo"}) if !testy.ErrorMatchesRE("[a b]", err) { t.Errorf("Unexpected error: %s", err) @@ -472,7 +472,7 @@ func TestDBsStats(t *testing.T) { {Name: "bar"}, }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.DBsStats(context.TODO(), []string{"foo", "bar"}) if !testy.ErrorMatchesRE("", err) { t.Errorf("Unexpected error: %s", err) @@ -491,7 +491,7 @@ func TestDBsStats(t *testing.T) { setup: func(m *Client) { m.ExpectDBsStats().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DBsStats(newCanceledContext(), []string{"foo"}) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -507,7 +507,7 @@ func TestPing(t *testing.T) { setup: func(m *Client) { m.ExpectPing() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper reachable, err := c.Ping(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -521,7 +521,7 @@ func TestPing(t *testing.T) { setup: func(m *Client) { m.ExpectPing().WillReturn(true) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper reachable, err := c.Ping(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -535,7 +535,7 @@ func TestPing(t *testing.T) { setup: func(m *Client) { m.ExpectPing().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Ping(context.TODO()) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -543,7 +543,7 @@ func TestPing(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Ping(context.TODO()) if !testy.ErrorMatches("call to Ping() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -554,7 +554,7 @@ func TestPing(t *testing.T) { setup: func(m *Client) { m.ExpectPing().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Ping(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -573,7 +573,7 @@ func TestSession(t *testing.T) { Name: "bob", }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper session, err := c.Session(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -588,7 +588,7 @@ func TestSession(t *testing.T) { } }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Session(context.TODO()) if !testy.ErrorMatches("call to Session() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -599,7 +599,7 @@ func TestSession(t *testing.T) { setup: func(m *Client) { m.ExpectSession().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Session(context.TODO()) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -610,7 +610,7 @@ func TestSession(t *testing.T) { setup: func(m *Client) { m.ExpectSession().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Session(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -627,7 +627,7 @@ func TestVersion(t *testing.T) { setup: func(m *Client) { m.ExpectVersion().WillReturn(&driver.Version{Version: "1.2"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper session, err := c.Version(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -640,7 +640,7 @@ func TestVersion(t *testing.T) { } }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Version(context.TODO()) if !testy.ErrorMatches("call to Version() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -651,7 +651,7 @@ func TestVersion(t *testing.T) { setup: func(m *Client) { m.ExpectVersion().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Version(context.TODO()) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -662,7 +662,7 @@ func TestVersion(t *testing.T) { setup: func(m *Client) { m.ExpectVersion().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Version(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -678,7 +678,7 @@ func TestDB(t *testing.T) { setup: func(m *Client) { m.ExpectDB().WithName("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Err() if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -686,7 +686,7 @@ func TestDB(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Err() if !testy.ErrorMatches("call to DB() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -697,7 +697,7 @@ func TestDB(t *testing.T) { setup: func(m *Client) { m.ExpectDB().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo", kivik.Param("foo", 123)).Err() if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -708,7 +708,7 @@ func TestDB(t *testing.T) { setup: func(m *Client) { m.ExpectDB().WillReturn(m.NewDB()) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("asd") err := db.Err() if !testy.ErrorMatches("", err) { @@ -728,7 +728,7 @@ func TestCreateDB(t *testing.T) { setup: func(m *Client) { m.ExpectCreateDB().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(context.TODO(), "foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -739,7 +739,7 @@ func TestCreateDB(t *testing.T) { setup: func(m *Client) { m.ExpectCreateDB().WithName("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(context.TODO(), "foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -747,7 +747,7 @@ func TestCreateDB(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(context.TODO(), "foo") if !testy.ErrorMatches("call to CreateDB() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -758,7 +758,7 @@ func TestCreateDB(t *testing.T) { setup: func(m *Client) { m.ExpectCreateDB().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(context.TODO(), "foo", kivik.Param("foo", 123)) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -769,7 +769,7 @@ func TestCreateDB(t *testing.T) { setup: func(m *Client) { m.ExpectCreateDB() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(context.TODO(), "foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -780,7 +780,7 @@ func TestCreateDB(t *testing.T) { setup: func(m *Client) { m.ExpectCreateDB().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(newCanceledContext(), "foo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -791,7 +791,7 @@ func TestCreateDB(t *testing.T) { setup: func(m *Client) { m.ExpectCreateDB().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(context.TODO(), "foo") if err == nil { t.Fatal("expected error") @@ -804,7 +804,7 @@ func TestCreateDB(t *testing.T) { return errors.New("custom error") }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.CreateDB(context.TODO(), "foo") if !testy.ErrorMatches("custom error", err) { t.Errorf("Unexpected error: %s", err) @@ -820,7 +820,7 @@ func TestDBUpdates(t *testing.T) { setup: func(m *Client) { m.ExpectDBUpdates().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DBUpdates(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -828,7 +828,7 @@ func TestDBUpdates(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DBUpdates(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("call to DBUpdates() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -839,7 +839,7 @@ func TestDBUpdates(t *testing.T) { setup: func(m *Client) { m.ExpectDBUpdates().WillReturn(NewDBUpdates().CloseError(errors.New("bar err"))) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DBUpdates(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -856,7 +856,7 @@ func TestDBUpdates(t *testing.T) { AddUpdate(&driver.DBUpdate{DBName: "bar"}). AddUpdate(&driver.DBUpdate{DBName: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DBUpdates(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -877,7 +877,7 @@ func TestDBUpdates(t *testing.T) { AddUpdate(&driver.DBUpdate{DBName: "foo"}). AddUpdateError(errors.New("foo err"))) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DBUpdates(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -899,7 +899,7 @@ func TestDBUpdates(t *testing.T) { setup: func(m *Client) { m.ExpectDBUpdates().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DBUpdates(newCanceledContext()) if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -914,7 +914,7 @@ func TestDBUpdates(t *testing.T) { AddDelay(time.Second). AddUpdate(&driver.DBUpdate{DBName: "bar"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond) defer cancel() rows := c.DBUpdates(ctx) @@ -943,7 +943,7 @@ func TestConfig(t *testing.T) { setup: func(m *Client) { m.ExpectConfig().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Config(context.TODO(), "local") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -951,7 +951,7 @@ func TestConfig(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Config(context.TODO(), "local") if !testy.ErrorMatches("call to Config() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -962,7 +962,7 @@ func TestConfig(t *testing.T) { setup: func(m *Client) { m.ExpectConfig().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Config(newCanceledContext(), "local") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -977,7 +977,7 @@ func TestConfig(t *testing.T) { WithNode("local"). WillReturn(driver.Config{"foo": driver.ConfigSection{"bar": "baz"}}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.Config(newCanceledContext(), "local") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -998,7 +998,7 @@ func TestConfigSection(t *testing.T) { setup: func(m *Client) { m.ExpectConfigSection().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ConfigSection(context.TODO(), "local", "foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1006,7 +1006,7 @@ func TestConfigSection(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ConfigSection(context.TODO(), "local", "foo") if !testy.ErrorMatches("call to ConfigSection() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1017,7 +1017,7 @@ func TestConfigSection(t *testing.T) { setup: func(m *Client) { m.ExpectConfigSection().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ConfigSection(newCanceledContext(), "local", "foo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1033,7 +1033,7 @@ func TestConfigSection(t *testing.T) { WithSection("foo"). WillReturn(driver.ConfigSection{"bar": "baz"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.ConfigSection(newCanceledContext(), "local", "foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1054,7 +1054,7 @@ func TestConfigValue(t *testing.T) { setup: func(m *Client) { m.ExpectConfigValue().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ConfigValue(context.TODO(), "local", "foo", "bar") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1062,7 +1062,7 @@ func TestConfigValue(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ConfigValue(context.TODO(), "local", "foo", "bar") if !testy.ErrorMatches("call to ConfigValue() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1073,7 +1073,7 @@ func TestConfigValue(t *testing.T) { setup: func(m *Client) { m.ExpectConfigValue().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.ConfigValue(newCanceledContext(), "local", "foo", "bar") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1090,7 +1090,7 @@ func TestConfigValue(t *testing.T) { WithKey("bar"). WillReturn("baz") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.ConfigValue(newCanceledContext(), "local", "foo", "bar") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1111,7 +1111,7 @@ func TestSetConfigValue(t *testing.T) { setup: func(m *Client) { m.ExpectSetConfigValue().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.SetConfigValue(context.TODO(), "local", "foo", "bar", "baz") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1119,7 +1119,7 @@ func TestSetConfigValue(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.SetConfigValue(context.TODO(), "local", "foo", "bar", "baz") if !testy.ErrorMatches("call to SetConfigValue() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1130,7 +1130,7 @@ func TestSetConfigValue(t *testing.T) { setup: func(m *Client) { m.ExpectSetConfigValue().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.SetConfigValue(newCanceledContext(), "local", "foo", "bar", "baz") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1148,7 +1148,7 @@ func TestSetConfigValue(t *testing.T) { WithValue("baz"). WillReturn("old") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.SetConfigValue(newCanceledContext(), "local", "foo", "bar", "baz") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1169,7 +1169,7 @@ func TestDeleteConfigKey(t *testing.T) { setup: func(m *Client) { m.ExpectDeleteConfigKey().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DeleteConfigKey(context.TODO(), "local", "foo", "bar") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1177,7 +1177,7 @@ func TestDeleteConfigKey(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DeleteConfigKey(context.TODO(), "local", "foo", "bar") if !testy.ErrorMatches("call to DeleteConfigKey() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1188,7 +1188,7 @@ func TestDeleteConfigKey(t *testing.T) { setup: func(m *Client) { m.ExpectDeleteConfigKey().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DeleteConfigKey(newCanceledContext(), "local", "foo", "bar") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1205,7 +1205,7 @@ func TestDeleteConfigKey(t *testing.T) { WithKey("bar"). WillReturn("old") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.DeleteConfigKey(newCanceledContext(), "local", "foo", "bar") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1226,7 +1226,7 @@ func TestReplicate(t *testing.T) { setup: func(m *Client) { m.ExpectReplicate().WillReturnError(errors.New("replicate failed")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Replicate(context.TODO(), "foo", "bar") if !testy.ErrorMatches("replicate failed", err) { t.Errorf("Unexpected error: %s", err) @@ -1234,7 +1234,7 @@ func TestReplicate(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Replicate(context.TODO(), "foo", "bar") if !testy.ErrorMatches("call to Replicate() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1248,7 +1248,7 @@ func TestReplicate(t *testing.T) { WithTarget("foo"). WillReturnError(errors.New("expected")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Replicate(context.TODO(), "foo", "bar") if !testy.ErrorMatches("expected", err) { t.Errorf("Unexpected error: %s", err) @@ -1261,7 +1261,7 @@ func TestReplicate(t *testing.T) { m.ExpectReplicate(). WillReturn(r) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rep, err := c.Replicate(context.TODO(), "foo", "bar") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1275,7 +1275,7 @@ func TestReplicate(t *testing.T) { setup: func(m *Client) { m.ExpectReplicate().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.Replicate(newCanceledContext(), "foo", "bar") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1291,7 +1291,7 @@ func TestGetReplications(t *testing.T) { setup: func(m *Client) { m.ExpectGetReplications().WillReturnError(errors.New("get replications failed")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.GetReplications(context.TODO()) if !testy.ErrorMatches("get replications failed", err) { t.Errorf("Unexpected error: %s", err) @@ -1299,7 +1299,7 @@ func TestGetReplications(t *testing.T) { }, }) tests.Add("unexpected", mockTest{ - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.GetReplications(context.TODO()) if !testy.ErrorMatches("call to GetReplications() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1314,7 +1314,7 @@ func TestGetReplications(t *testing.T) { m.NewReplication().ID("ccc"), }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper reps, err := c.GetReplications(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1331,7 +1331,7 @@ func TestGetReplications(t *testing.T) { setup: func(m *Client) { m.ExpectGetReplications().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.GetReplications(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) diff --git a/mockdb/db_test.go b/mockdb/db_test.go index 805682dee..1ae6493e4 100644 --- a/mockdb/db_test.go +++ b/mockdb/db_test.go @@ -33,7 +33,7 @@ func TestCloseDB(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectClose().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Close() if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -46,7 +46,7 @@ func TestCloseDB(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Close() if !testy.ErrorMatches("call to DB.Close() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -62,7 +62,7 @@ func TestCloseDB(t *testing.T) { bar.ExpectClose() foo.ExpectClose() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") err := foo.Close() @@ -80,7 +80,7 @@ func TestCloseDB(t *testing.T) { return errors.New("custom error") }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Close() if !testy.ErrorMatches("custom error", err) { t.Errorf("Unexpected error: %s", err) @@ -99,7 +99,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -112,7 +112,7 @@ func TestAllDocs(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("call to DB.AllDocs() was not expected, all expectations already fulfilled", err) { @@ -126,7 +126,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WillReturn(NewRows().CloseError(errors.New("bar err"))) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -143,7 +143,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WillReturn(NewRows().Offset(123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) for rows.Next() { @@ -164,7 +164,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WillReturn(NewRows().TotalRows(123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) for rows.Next() { @@ -185,7 +185,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WillReturn(NewRows().UpdateSeq("1-xxx")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) for rows.Next() { @@ -206,7 +206,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WillReturn(NewRows().Warning("Caution!")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) for rows.Next() { @@ -230,7 +230,7 @@ func TestAllDocs(t *testing.T) { AddRow(&driver.Row{ID: "bar"}). AddRow(&driver.Row{ID: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -255,7 +255,7 @@ func TestAllDocs(t *testing.T) { AddRow(&driver.Row{ID: "foo"}). AddRowError(errors.New("foo err"))) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -281,7 +281,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatchesRE(`map\[foo:123]`, err) { @@ -296,7 +296,7 @@ func TestAllDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectAllDocs().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.AllDocs(newCanceledContext()) if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { @@ -314,7 +314,7 @@ func TestAllDocs(t *testing.T) { AddDelay(time.Second). AddRow(&driver.Row{ID: "bar"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond) defer cancel() rows := c.DB("foo").AllDocs(ctx) @@ -344,7 +344,7 @@ func TestAllDocs(t *testing.T) { bar.ExpectAllDocs() foo.ExpectAllDocs() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.AllDocs(context.TODO()) @@ -365,7 +365,7 @@ func TestBulkGet(t *testing.T) { // nolint: gocyclo m.ExpectDB().WillReturn(db) db.ExpectBulkGet().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.BulkGet(context.TODO(), []kivik.BulkGetReference{}) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -378,7 +378,7 @@ func TestBulkGet(t *testing.T) { // nolint: gocyclo db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.BulkGet(context.TODO(), []kivik.BulkGetReference{}) if err := rows.Err(); !testy.ErrorMatches("call to DB.BulkGet() was not expected, all expectations already fulfilled", err) { @@ -395,7 +395,7 @@ func TestBulkGet(t *testing.T) { // nolint: gocyclo AddRow(&driver.Row{ID: "bar"}). AddRow(&driver.Row{ID: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.BulkGet(context.TODO(), []kivik.BulkGetReference{}) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -418,7 +418,7 @@ func TestBulkGet(t *testing.T) { // nolint: gocyclo m.ExpectDB().WillReturn(db) db.ExpectBulkGet().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.BulkGet(context.TODO(), []kivik.BulkGetReference{}) if err := rows.Err(); !testy.ErrorMatchesRE(`map\[foo:123]`, err) { @@ -433,7 +433,7 @@ func TestBulkGet(t *testing.T) { // nolint: gocyclo m.ExpectDB().WillReturn(db) db.ExpectBulkGet().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.BulkGet(newCanceledContext(), []kivik.BulkGetReference{}) if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { @@ -450,7 +450,7 @@ func TestBulkGet(t *testing.T) { // nolint: gocyclo bar.ExpectBulkGet() foo.ExpectBulkGet() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.BulkGet(context.TODO(), []kivik.BulkGetReference{}) @@ -471,7 +471,7 @@ func TestFind(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectFind().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Find(context.TODO(), nil) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -485,7 +485,7 @@ func TestFind(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectFind().WithQuery(123) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Find(context.TODO(), map[string]interface{}{"selector": map[string]interface{}{"foo": "123"}}) if err := rows.Err(); !testy.ErrorMatchesRE("has query: 123", err) { @@ -503,7 +503,7 @@ func TestFind(t *testing.T) { AddRow(&driver.Row{ID: "bar"}). AddRow(&driver.Row{ID: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Find(context.TODO(), map[string]interface{}{}) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -526,7 +526,7 @@ func TestFind(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectFind().WithQuery(map[string]interface{}{"foo": "123"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Find(context.TODO(), map[string]string{"foo": "123"}) if err := rows.Err(); !testy.ErrorMatchesRE("", err) { @@ -541,7 +541,7 @@ func TestFind(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectFind().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Find(newCanceledContext(), map[string]interface{}{}) if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { @@ -558,7 +558,7 @@ func TestFind(t *testing.T) { bar.ExpectFind() foo.ExpectFind() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.Find(context.TODO(), map[string]interface{}{}) @@ -579,7 +579,7 @@ func TestCreateIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateIndex().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CreateIndex(context.TODO(), "foo", "bar", 123) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -592,7 +592,7 @@ func TestCreateIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateIndex().WithIndex(321) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CreateIndex(context.TODO(), "foo", "bar", 123) if !testy.ErrorMatchesRE("has index: 321", err) { t.Errorf("Unexpected error: %s", err) @@ -606,7 +606,7 @@ func TestCreateIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateIndex().WithDDocID("moo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CreateIndex(context.TODO(), "foo", "bar", 123) if !testy.ErrorMatchesRE("has ddoc: moo", err) { t.Errorf("Unexpected error: %s", err) @@ -620,7 +620,7 @@ func TestCreateIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateIndex().WithName("moo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CreateIndex(context.TODO(), "foo", "bar", 123) if !testy.ErrorMatchesRE("has name: moo", err) { t.Errorf("Unexpected error: %s", err) @@ -634,7 +634,7 @@ func TestCreateIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateIndex().WithIndex("moo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CreateIndex(context.TODO(), "foo", "bar", "moo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -647,7 +647,7 @@ func TestCreateIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateIndex().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CreateIndex(newCanceledContext(), "foo", "bar", "moo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -663,7 +663,7 @@ func TestCreateIndex(t *testing.T) { bar.ExpectCreateIndex() foo.ExpectCreateIndex() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") err := foo.CreateIndex(context.TODO(), "foo", "bar", 123) @@ -684,7 +684,7 @@ func TestGetIndexes(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetIndexes().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetIndexes(context.TODO()) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -700,7 +700,7 @@ func TestGetIndexes(t *testing.T) { {Name: "bar"}, }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper indexes, err := c.DB("foo").GetIndexes(context.TODO()) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -719,7 +719,7 @@ func TestGetIndexes(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetIndexes(context.TODO()) if !testy.ErrorMatches("call to DB.GetIndexes() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -732,7 +732,7 @@ func TestGetIndexes(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetIndexes().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetIndexes(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -748,7 +748,7 @@ func TestGetIndexes(t *testing.T) { bar.ExpectGetIndexes() foo.ExpectGetIndexes() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.GetIndexes(context.TODO()) @@ -769,7 +769,7 @@ func TestDeleteIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteIndex().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").DeleteIndex(context.TODO(), "foo", "bar") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -782,7 +782,7 @@ func TestDeleteIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteIndex().WithDDoc("oink") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").DeleteIndex(context.TODO(), "foo", "bar") if !testy.ErrorMatchesRE("has ddoc: oink", err) { t.Errorf("Unexpected error: %s", err) @@ -796,7 +796,7 @@ func TestDeleteIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteIndex().WithName("oink") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").DeleteIndex(context.TODO(), "foo", "bar") if !testy.ErrorMatchesRE("has name: oink", err) { t.Errorf("Unexpected error: %s", err) @@ -810,7 +810,7 @@ func TestDeleteIndex(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteIndex().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").DeleteIndex(newCanceledContext(), "foo", "bar") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -826,7 +826,7 @@ func TestDeleteIndex(t *testing.T) { bar.ExpectDeleteIndex() foo.ExpectDeleteIndex() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") err := foo.DeleteIndex(context.TODO(), "foo", "bar") @@ -847,7 +847,7 @@ func TestExplain(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectExplain().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Explain(context.TODO(), "foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -859,7 +859,7 @@ func TestExplain(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Explain(context.TODO(), "foo") if !testy.ErrorMatches("call to DB.Explain() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -872,7 +872,7 @@ func TestExplain(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectExplain().WithQuery(map[string]string{"foo": "bar"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Explain(context.TODO(), map[string]interface{}{"foo": "bar"}) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -885,7 +885,7 @@ func TestExplain(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectExplain().WillReturn(&driver.QueryPlan{DBName: "foo"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper plan, err := c.DB("foo").Explain(context.TODO(), map[string]interface{}{"foo": "bar"}) if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -902,7 +902,7 @@ func TestExplain(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectExplain().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Explain(newCanceledContext(), 123) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -918,7 +918,7 @@ func TestExplain(t *testing.T) { bar.ExpectExplain() foo.ExpectExplain() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.Explain(context.TODO(), 123) @@ -939,7 +939,7 @@ func TestCreateDoc(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateDoc().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, _, err := c.DB("foo").CreateDoc(context.TODO(), "foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -954,7 +954,7 @@ func TestCreateDoc(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateDoc().WillReturn(docID, rev) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper i, r, err := c.DB("foo").CreateDoc(context.TODO(), "foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -971,7 +971,7 @@ func TestCreateDoc(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateDoc().WithDoc("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, _, err := c.DB("foo").CreateDoc(context.TODO(), "bar") if !testy.ErrorMatchesRE(`has doc: "foo"`, err) { t.Errorf("Unexpected error: %s", err) @@ -985,7 +985,7 @@ func TestCreateDoc(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateDoc().WithOptions(kivik.Param("foo", "bar")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, _, err := c.DB("foo").CreateDoc(context.TODO(), "bar", kivik.Params(nil)) if !testy.ErrorMatchesRE(`has options: map\[foo:bar]`, err) { t.Errorf("Unexpected error: %s", err) @@ -999,7 +999,7 @@ func TestCreateDoc(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCreateDoc().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, _, err := c.DB("foo").CreateDoc(newCanceledContext(), 123) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1015,7 +1015,7 @@ func TestCreateDoc(t *testing.T) { bar.ExpectCreateDoc() foo.ExpectCreateDoc() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, _, err := foo.CreateDoc(context.TODO(), 123) @@ -1036,7 +1036,7 @@ func TestCompact(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCompact().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Compact(context.TODO()) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1049,7 +1049,7 @@ func TestCompact(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCompact().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Compact(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1061,7 +1061,7 @@ func TestCompact(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Compact(context.TODO()) if !testy.ErrorMatches("call to DB.Compact() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1079,7 +1079,7 @@ func TestCompactView(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCompactView().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CompactView(context.TODO(), "foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1092,7 +1092,7 @@ func TestCompactView(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCompactView().WithDDoc("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CompactView(context.TODO(), "foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1105,7 +1105,7 @@ func TestCompactView(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCompactView().WithDDoc("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CompactView(context.TODO(), "bar") if !testy.ErrorMatchesRE("has ddocID: foo", err) { t.Errorf("Unexpected error: %s", err) @@ -1119,7 +1119,7 @@ func TestCompactView(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCompactView().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").CompactView(newCanceledContext(), "foo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1135,7 +1135,7 @@ func TestCompactView(t *testing.T) { bar.ExpectCompactView() foo.ExpectCompactView() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") err := foo.CompactView(context.TODO(), "foo") @@ -1156,7 +1156,7 @@ func TestViewCleanup(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectViewCleanup().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").ViewCleanup(context.TODO()) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1169,7 +1169,7 @@ func TestViewCleanup(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectViewCleanup().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").ViewCleanup(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1181,7 +1181,7 @@ func TestViewCleanup(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").ViewCleanup(context.TODO()) if !testy.ErrorMatches("call to DB.ViewCleanup() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1199,7 +1199,7 @@ func TestPut(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPut().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Put(context.TODO(), "foo", 123) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1212,7 +1212,7 @@ func TestPut(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPut().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Put(newCanceledContext(), "foo", 123) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1224,7 +1224,7 @@ func TestPut(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Put(context.TODO(), "foo", 123) if !testy.ErrorMatches("call to DB.Put() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1240,7 +1240,7 @@ func TestPut(t *testing.T) { bar.ExpectPut() foo.ExpectPut() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.Put(context.TODO(), "foo", 123) @@ -1256,7 +1256,7 @@ func TestPut(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPut().WithDocID("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Put(context.TODO(), "bar", 123) if !testy.ErrorMatchesRE("has docID: foo", err) { t.Errorf("Unexpected error: %s", err) @@ -1270,7 +1270,7 @@ func TestPut(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPut().WithDoc(map[string]string{"foo": "bar"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Put(context.TODO(), "foo", 123) if !testy.ErrorMatchesRE("has docID: foo", err) { t.Errorf("Unexpected error: %s", err) @@ -1284,7 +1284,7 @@ func TestPut(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPut().WithOptions(kivik.Param("foo", "bar")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Put(context.TODO(), "foo", 123, kivik.Param("foo", 123)) if !testy.ErrorMatchesRE("has docID: foo", err) { t.Errorf("Unexpected error: %s", err) @@ -1298,7 +1298,7 @@ func TestPut(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPut().WillReturn("oink") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.DB("foo").Put(context.TODO(), "foo", 123) if !testy.ErrorMatchesRE("", err) { t.Errorf("Unexpected error: %s", err) @@ -1319,7 +1319,7 @@ func TestGetRev(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetRev().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetRev(context.TODO(), "foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1332,7 +1332,7 @@ func TestGetRev(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetRev().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetRev(newCanceledContext(), "foo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1344,7 +1344,7 @@ func TestGetRev(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetRev(context.TODO(), "foo") if !testy.ErrorMatches("call to DB.GetRev() was not expected, all expectations already fulfilled", err) { t.Errorf("Unexpected error: %s", err) @@ -1360,7 +1360,7 @@ func TestGetRev(t *testing.T) { bar.ExpectGetRev() foo.ExpectGetRev() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.GetRev(context.TODO(), "foo") @@ -1376,7 +1376,7 @@ func TestGetRev(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetRev().WithDocID("foo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetRev(context.TODO(), "bar") if !testy.ErrorMatchesRE("has docID: foo", err) { t.Errorf("Unexpected error: %s", err) @@ -1390,7 +1390,7 @@ func TestGetRev(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetRev().WithOptions(kivik.Param("foo", "bar")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetRev(context.TODO(), "foo", kivik.Param("foo", 123)) if !testy.ErrorMatchesRE("has docID: foo", err) { t.Errorf("Unexpected error: %s", err) @@ -1404,7 +1404,7 @@ func TestGetRev(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetRev().WillReturn("1-oink") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rev, err := c.DB("foo").GetRev(context.TODO(), "foo") if !testy.ErrorMatchesRE("", err) { t.Errorf("Unexpected error: %s", err) @@ -1425,7 +1425,7 @@ func TestFlush(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectFlush().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Flush(context.TODO()) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1438,7 +1438,7 @@ func TestFlush(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectFlush().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper err := c.DB("foo").Flush(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1454,7 +1454,7 @@ func TestFlush(t *testing.T) { bar.ExpectFlush() foo.ExpectFlush() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") err := foo.Flush(context.TODO()) @@ -1475,7 +1475,7 @@ func TestDeleteAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteAttachment().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").DeleteAttachment(context.TODO(), "foo", "1-foo", "foo.txt") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1488,7 +1488,7 @@ func TestDeleteAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteAttachment().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").DeleteAttachment(newCanceledContext(), "foo", "1-foo", "foo.txt") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1504,7 +1504,7 @@ func TestDeleteAttachment(t *testing.T) { bar.ExpectDeleteAttachment() foo.ExpectDeleteAttachment() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.DeleteAttachment(context.TODO(), "foo", "1-foo", "foo.txt") @@ -1520,7 +1520,7 @@ func TestDeleteAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteAttachment().WithDocID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").DeleteAttachment(context.TODO(), "foo", "1-foo", "foo.txt") if !testy.ErrorMatchesRE("has docID: bar", err) { t.Errorf("Unexpected error: %s", err) @@ -1534,7 +1534,7 @@ func TestDeleteAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteAttachment().WithOptions(kivik.Rev("2-asd")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").DeleteAttachment(context.TODO(), "foo", "1-foo", "foo.txt") if !testy.ErrorMatchesRE(`has options: map\[rev:1-foo\]`, err) { t.Errorf("Unexpected error: %s", err) @@ -1548,7 +1548,7 @@ func TestDeleteAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteAttachment().WithFilename("bar.txt") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").DeleteAttachment(context.TODO(), "foo", "1-foo", "foo.txt") if !testy.ErrorMatchesRE("has filename: bar.txt", err) { t.Errorf("Unexpected error: %s", err) @@ -1562,7 +1562,7 @@ func TestDeleteAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteAttachment().WithOptions(kivik.Param("foo", "baz")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").DeleteAttachment(context.TODO(), "foo", "1-foo", "foo.txt") if !testy.ErrorMatchesRE(`has options: map\[foo:baz]`, err) { t.Errorf("Unexpected error: %s", err) @@ -1576,7 +1576,7 @@ func TestDeleteAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDeleteAttachment().WillReturn("2-fds") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rev, err := c.DB("foo").DeleteAttachment(context.TODO(), "foo", "1-foo", "foo.txt") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1597,7 +1597,7 @@ func TestDelete(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDelete().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Delete(context.TODO(), "foo", "1-foo") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1610,7 +1610,7 @@ func TestDelete(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDelete().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Delete(newCanceledContext(), "foo", "1-foo") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1626,7 +1626,7 @@ func TestDelete(t *testing.T) { bar.ExpectDelete() foo.ExpectDelete() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.Delete(context.TODO(), "foo", "1-foo") @@ -1642,7 +1642,7 @@ func TestDelete(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDelete().WithDocID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Delete(context.TODO(), "foo", "1-foo") if !testy.ErrorMatchesRE("has docID: bar", err) { t.Errorf("Unexpected error: %s", err) @@ -1656,7 +1656,7 @@ func TestDelete(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDelete().WithOptions(kivik.Rev("2-lkj")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Delete(context.TODO(), "foo", "1-foo") if !testy.ErrorMatchesRE(`has options: map\[rev:2-lkj\]`, err) { t.Errorf("Unexpected error: %s", err) @@ -1670,7 +1670,7 @@ func TestDelete(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDelete().WithOptions(kivik.Param("foo", "baz")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Delete(context.TODO(), "foo", "1-foo") if !testy.ErrorMatchesRE(`has options: map\[foo:baz]`, err) { t.Errorf("Unexpected error: %s", err) @@ -1684,7 +1684,7 @@ func TestDelete(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDelete().WillReturn("2-uio") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rev, err := c.DB("foo").Delete(context.TODO(), "foo", "1-foo") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1705,7 +1705,7 @@ func TestCopy(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCopy().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Copy(context.TODO(), "foo", "bar") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1718,7 +1718,7 @@ func TestCopy(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCopy().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Copy(newCanceledContext(), "foo", "bar") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1734,7 +1734,7 @@ func TestCopy(t *testing.T) { bar.ExpectCopy() foo.ExpectCopy() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.Copy(context.TODO(), "foo", "1-foo") @@ -1750,7 +1750,7 @@ func TestCopy(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCopy().WithTargetID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Copy(context.TODO(), "foo", "bar") if !testy.ErrorMatchesRE("has targetID: bar", err) { t.Errorf("Unexpected error: %s", err) @@ -1764,7 +1764,7 @@ func TestCopy(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCopy().WithSourceID("baz") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Copy(context.TODO(), "foo", "bar") if !testy.ErrorMatchesRE("has sourceID: baz", err) { t.Errorf("Unexpected error: %s", err) @@ -1778,7 +1778,7 @@ func TestCopy(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCopy().WithOptions(kivik.Param("foo", "baz")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").Copy(context.TODO(), "foo", "bar") if !testy.ErrorMatchesRE(`has options: map\[foo:baz]`, err) { t.Errorf("Unexpected error: %s", err) @@ -1792,7 +1792,7 @@ func TestCopy(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectCopy().WillReturn("2-oiu") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rev, err := c.DB("foo").Copy(context.TODO(), "foo", "bar") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -1813,7 +1813,7 @@ func TestGet(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGet().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DB("foo").Get(context.TODO(), "foo") err := rows.Err() if !testy.ErrorMatches("foo err", err) { @@ -1827,7 +1827,7 @@ func TestGet(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGet().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DB("foo").Get(newCanceledContext(), "foo") err := rows.Err() if !testy.ErrorMatches("context canceled", err) { @@ -1844,7 +1844,7 @@ func TestGet(t *testing.T) { bar.ExpectGet() foo.ExpectGet() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.Get(context.TODO(), "foo") @@ -1861,7 +1861,7 @@ func TestGet(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGet().WithDocID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DB("foo").Get(context.TODO(), "foo") err := rows.Err() if !testy.ErrorMatchesRE("has docID: bar", err) { @@ -1876,7 +1876,7 @@ func TestGet(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGet().WithOptions(kivik.Param("foo", "baz")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DB("foo").Get(context.TODO(), "foo") err := rows.Err() if !testy.ErrorMatchesRE(`has options: map\[foo:baz]`, err) { @@ -1891,7 +1891,7 @@ func TestGet(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGet().WillReturn(&driver.Document{Rev: "2-bar"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper rows := c.DB("foo").Get(context.TODO(), "foo") rev, err := rows.Rev() if !testy.ErrorMatches("", err) { @@ -1913,7 +1913,7 @@ func TestGetAttachmentMeta(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachmentMeta().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachmentMeta(context.TODO(), "foo", "foo.txt") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -1926,7 +1926,7 @@ func TestGetAttachmentMeta(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachmentMeta().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachmentMeta(newCanceledContext(), "foo", "foo.txt") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -1942,7 +1942,7 @@ func TestGetAttachmentMeta(t *testing.T) { bar.ExpectGetAttachmentMeta() foo.ExpectGetAttachmentMeta() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.GetAttachmentMeta(context.TODO(), "foo", "foo.txt") @@ -1958,7 +1958,7 @@ func TestGetAttachmentMeta(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachmentMeta().WithDocID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachmentMeta(context.TODO(), "foo", "foo.txt") if !testy.ErrorMatchesRE("has docID: bar", err) { t.Errorf("Unexpected error: %s", err) @@ -1972,7 +1972,7 @@ func TestGetAttachmentMeta(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachmentMeta().WithFilename("bar.jpg") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachmentMeta(context.TODO(), "foo", "foo.txt") if !testy.ErrorMatchesRE("has filename: bar.jpg", err) { t.Errorf("Unexpected error: %s", err) @@ -1986,7 +1986,7 @@ func TestGetAttachmentMeta(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachmentMeta().WithOptions(kivik.Param("foo", "baz")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachmentMeta(context.TODO(), "foo", "foo.txt") if !testy.ErrorMatchesRE(`has options: map\[foo:baz]`, err) { t.Errorf("Unexpected error: %s", err) @@ -2000,7 +2000,7 @@ func TestGetAttachmentMeta(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachmentMeta().WillReturn(&driver.Attachment{Filename: "foo.txt"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper att, err := c.DB("foo").GetAttachmentMeta(context.TODO(), "foo", "foo.txt") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -2021,7 +2021,7 @@ func TestLocalDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectLocalDocs().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.LocalDocs(context.TODO(), nil) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -2038,7 +2038,7 @@ func TestLocalDocs(t *testing.T) { AddRow(&driver.Row{ID: "bar"}). AddRow(&driver.Row{ID: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.LocalDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -2061,7 +2061,7 @@ func TestLocalDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectLocalDocs().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.LocalDocs(newCanceledContext()) if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { @@ -2078,7 +2078,7 @@ func TestLocalDocs(t *testing.T) { bar.ExpectLocalDocs() foo.ExpectLocalDocs() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.LocalDocs(context.TODO()) @@ -2099,7 +2099,7 @@ func TestPurge(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPurge().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.Purge(context.TODO(), nil) if !testy.ErrorMatches("foo err", err) { @@ -2113,7 +2113,7 @@ func TestPurge(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPurge().WillReturn(&driver.PurgeResult{Seq: 123}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") result, err := db.Purge(context.TODO(), nil) if !testy.ErrorMatches("", err) { @@ -2130,7 +2130,7 @@ func TestPurge(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPurge().WithDocRevMap(map[string][]string{"foo": {"a", "b"}}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.Purge(context.TODO(), nil) if !testy.ErrorMatchesRE("has docRevMap: map", err) { @@ -2145,7 +2145,7 @@ func TestPurge(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPurge().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.Purge(newCanceledContext(), nil) if !testy.ErrorMatches("context canceled", err) { @@ -2162,7 +2162,7 @@ func TestPurge(t *testing.T) { bar.ExpectPurge() foo.ExpectPurge() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.Purge(context.TODO(), nil) @@ -2183,7 +2183,7 @@ func TestPutAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPutAttachment().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").PutAttachment(context.TODO(), "foo", &kivik.Attachment{Filename: "foo.txt"}) if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -2196,7 +2196,7 @@ func TestPutAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPutAttachment().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").PutAttachment(newCanceledContext(), "foo", &kivik.Attachment{Filename: "foo.txt"}) if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -2212,7 +2212,7 @@ func TestPutAttachment(t *testing.T) { bar.ExpectPutAttachment() foo.ExpectPutAttachment() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.PutAttachment(context.TODO(), "foo", &kivik.Attachment{Filename: "foo.txt"}) @@ -2228,7 +2228,7 @@ func TestPutAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPutAttachment().WithDocID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").PutAttachment(context.TODO(), "foo", &kivik.Attachment{Filename: "foo.txt"}) if !testy.ErrorMatchesRE("has docID: bar", err) { t.Errorf("Unexpected error: %s", err) @@ -2242,7 +2242,7 @@ func TestPutAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPutAttachment().WithOptions(kivik.Rev("2-bar")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").PutAttachment(context.TODO(), "foo", &kivik.Attachment{Filename: "foo.txt"}) if !testy.ErrorMatchesRE(`has options: map\[rev:2-bar\]`, err) { t.Errorf("Unexpected error: %s", err) @@ -2256,7 +2256,7 @@ func TestPutAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPutAttachment().WithAttachment(&driver.Attachment{Filename: "bar.jpg"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").PutAttachment(context.TODO(), "foo", &kivik.Attachment{Filename: "foo.txt"}) if !testy.ErrorMatchesRE("has attachment: bar.jpg", err) { t.Errorf("Unexpected error: %s", err) @@ -2270,7 +2270,7 @@ func TestPutAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPutAttachment().WithOptions(kivik.Param("foo", "bar")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").PutAttachment(context.TODO(), "foo", &kivik.Attachment{Filename: "foo.txt"}, kivik.Param("foo", 123)) if !testy.ErrorMatchesRE("has docID: foo", err) { t.Errorf("Unexpected error: %s", err) @@ -2284,7 +2284,7 @@ func TestPutAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPutAttachment().WillReturn("2-boo") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper result, err := c.DB("foo").PutAttachment(context.TODO(), "foo", &kivik.Attachment{Filename: "foo.txt"}) if !testy.ErrorMatchesRE("", err) { t.Errorf("Unexpected error: %s", err) @@ -2306,7 +2306,7 @@ func TestQuery(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectQuery().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Query(context.TODO(), "foo", "bar") if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -2323,7 +2323,7 @@ func TestQuery(t *testing.T) { AddRow(&driver.Row{ID: "bar"}). AddRow(&driver.Row{ID: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Query(context.TODO(), "foo", "bar") if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -2346,7 +2346,7 @@ func TestQuery(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectQuery().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Query(newCanceledContext(), "foo", "bar") if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { @@ -2363,7 +2363,7 @@ func TestQuery(t *testing.T) { bar.ExpectQuery() foo.ExpectQuery() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.Query(context.TODO(), "foo", "bar") @@ -2379,7 +2379,7 @@ func TestQuery(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectQuery().WithDDocID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Query(context.TODO(), "foo", "bar") if err := rows.Err(); !testy.ErrorMatchesRE("has ddocID: bar", err) { @@ -2394,7 +2394,7 @@ func TestQuery(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectQuery().WithView("baz") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Query(context.TODO(), "foo", "bar") if err := rows.Err(); !testy.ErrorMatchesRE("has view: baz", err) { @@ -2419,7 +2419,7 @@ func TestSecurity(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectSecurity().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.Security(context.TODO()) if !testy.ErrorMatches("foo err", err) { @@ -2433,7 +2433,7 @@ func TestSecurity(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectSecurity().WillReturn(driverSec) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") result, err := db.Security(context.TODO()) if !testy.ErrorMatches("", err) { @@ -2450,7 +2450,7 @@ func TestSecurity(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectSecurity().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.Security(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { @@ -2467,7 +2467,7 @@ func TestSecurity(t *testing.T) { bar.ExpectSecurity() foo.ExpectSecurity() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.Security(context.TODO()) @@ -2488,7 +2488,7 @@ func TestSetSecurity(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectSetSecurity().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") err := db.SetSecurity(context.TODO(), clientSec) if !testy.ErrorMatches("foo err", err) { @@ -2502,7 +2502,7 @@ func TestSetSecurity(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectSetSecurity().WithSecurity(driverSec) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") err := db.SetSecurity(context.TODO(), clientSec) if !testy.ErrorMatches("", err) { @@ -2516,7 +2516,7 @@ func TestSetSecurity(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectSetSecurity().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") err := db.SetSecurity(newCanceledContext(), clientSec) if !testy.ErrorMatches("context canceled", err) { @@ -2533,7 +2533,7 @@ func TestSetSecurity(t *testing.T) { bar.ExpectSetSecurity() foo.ExpectSetSecurity() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") err := foo.SetSecurity(context.TODO(), clientSec) @@ -2554,7 +2554,7 @@ func TestStats(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectStats().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.Stats(context.TODO()) if !testy.ErrorMatches("foo err", err) { @@ -2568,7 +2568,7 @@ func TestStats(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectStats().WillReturn(&driver.DBStats{Name: "foo"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") result, err := db.Stats(context.TODO()) if !testy.ErrorMatches("", err) { @@ -2586,7 +2586,7 @@ func TestStats(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectStats().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.Stats(newCanceledContext()) if !testy.ErrorMatches("context canceled", err) { @@ -2603,7 +2603,7 @@ func TestStats(t *testing.T) { bar.ExpectStats() foo.ExpectStats() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.Stats(context.TODO()) @@ -2624,7 +2624,7 @@ func TestBulkDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectBulkDocs().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.BulkDocs(context.TODO(), []interface{}{1}) if !testy.ErrorMatches("foo err", err) { @@ -2637,7 +2637,7 @@ func TestBulkDocs(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.BulkDocs(context.TODO(), []interface{}{1}) if !testy.ErrorMatches("call to DB.BulkDocs() was not expected, all expectations already fulfilled", err) { @@ -2655,7 +2655,7 @@ func TestBulkDocs(t *testing.T) { {ID: "baz"}, }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows, err := db.BulkDocs(context.TODO(), []interface{}{1}) if !testy.ErrorMatches("", err) { @@ -2680,7 +2680,7 @@ func TestBulkDocs(t *testing.T) { {Error: errors.New("foo err")}, }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows, err := db.BulkDocs(context.TODO(), []interface{}{1}) if !testy.ErrorMatches("", err) { @@ -2710,7 +2710,7 @@ func TestBulkDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectBulkDocs().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.BulkDocs(context.TODO(), []interface{}{1}) if !testy.ErrorMatchesRE(`map\[foo:123]`, err) { @@ -2725,7 +2725,7 @@ func TestBulkDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectBulkDocs().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.BulkDocs(newCanceledContext(), []interface{}{1}) if !testy.ErrorMatches("context canceled", err) { @@ -2742,7 +2742,7 @@ func TestBulkDocs(t *testing.T) { bar.ExpectBulkDocs() foo.ExpectBulkDocs() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.BulkDocs(context.TODO(), []interface{}{1}) @@ -2763,7 +2763,7 @@ func TestGetAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachment().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachment(context.TODO(), "foo", "bar") if !testy.ErrorMatches("foo err", err) { t.Errorf("Unexpected error: %s", err) @@ -2776,7 +2776,7 @@ func TestGetAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachment().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachment(newCanceledContext(), "foo", "bar") if !testy.ErrorMatches("context canceled", err) { t.Errorf("Unexpected error: %s", err) @@ -2792,7 +2792,7 @@ func TestGetAttachment(t *testing.T) { bar.ExpectGetAttachment() foo.ExpectGetAttachment() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") _, err := foo.GetAttachment(context.TODO(), "foo", "bar") @@ -2808,7 +2808,7 @@ func TestGetAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachment().WithDocID("bar") }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper _, err := c.DB("foo").GetAttachment(context.TODO(), "foo", "bar") if !testy.ErrorMatchesRE("has docID: bar", err) { t.Errorf("Unexpected error: %s", err) @@ -2822,7 +2822,7 @@ func TestGetAttachment(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectGetAttachment().WillReturn(&driver.Attachment{Filename: "foo.txt"}) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper att, err := c.DB("foo").GetAttachment(context.TODO(), "foo", "bar") if !testy.ErrorMatches("", err) { t.Errorf("Unexpected error: %s", err) @@ -2843,7 +2843,7 @@ func TestDesignDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDesignDocs().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.DesignDocs(context.TODO(), nil) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -2860,7 +2860,7 @@ func TestDesignDocs(t *testing.T) { AddRow(&driver.Row{ID: "bar"}). AddRow(&driver.Row{ID: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.DesignDocs(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -2883,7 +2883,7 @@ func TestDesignDocs(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectDesignDocs().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.DesignDocs(newCanceledContext()) if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { @@ -2900,7 +2900,7 @@ func TestDesignDocs(t *testing.T) { bar.ExpectDesignDocs() foo.ExpectDesignDocs() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.DesignDocs(context.TODO()) @@ -2922,7 +2922,7 @@ func TestChanges(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectChanges().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -2935,7 +2935,7 @@ func TestChanges(t *testing.T) { db := m.NewDB() m.ExpectDB().WillReturn(db) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("call to DB.Changes() was not expected, all expectations already fulfilled", err) { @@ -2949,7 +2949,7 @@ func TestChanges(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectChanges().WillReturn(NewChanges().CloseError(errors.New("bar err"))) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -2969,7 +2969,7 @@ func TestChanges(t *testing.T) { AddChange(&driver.Change{ID: "bar"}). AddChange(&driver.Change{ID: "baz"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -2993,7 +2993,7 @@ func TestChanges(t *testing.T) { AddChange(&driver.Change{ID: "foo"}). AddChangeError(errors.New("foo err"))) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -3018,7 +3018,7 @@ func TestChanges(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectChanges().WithOptions(kivik.Param("foo", 123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatchesRE(`map\[foo:123]`, err) { @@ -3033,7 +3033,7 @@ func TestChanges(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectChanges().WillDelay(time.Second) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(newCanceledContext()) if err := rows.Err(); !testy.ErrorMatches("context canceled", err) { @@ -3051,7 +3051,7 @@ func TestChanges(t *testing.T) { AddDelay(time.Second). AddChange(&driver.Change{ID: "bar"})) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond) defer cancel() rows := c.DB("foo").Changes(ctx) @@ -3080,7 +3080,7 @@ func TestChanges(t *testing.T) { bar.ExpectChanges() foo.ExpectChanges() }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper foo := c.DB("foo") _ = c.DB("bar") rows := foo.Changes(context.TODO()) @@ -3096,7 +3096,7 @@ func TestChanges(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectChanges().WillReturn(NewChanges().LastSeq("1-asdf")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -3118,7 +3118,7 @@ func TestChanges(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectChanges().WillReturn(NewChanges().Pending(123)) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -3140,7 +3140,7 @@ func TestChanges(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectChanges().WillReturn(NewChanges().ETag("etag-foo")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.Changes(context.TODO()) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -3164,7 +3164,7 @@ func TestRevsDiff(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectRevsDiff().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.RevsDiff(context.TODO(), revMap) if err := rows.Err(); !testy.ErrorMatches("foo err", err) { @@ -3188,7 +3188,7 @@ func TestRevsDiff(t *testing.T) { Value: strings.NewReader(`{"missing":["x"]}`), })) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") rows := db.RevsDiff(context.TODO(), revMap) if err := rows.Err(); !testy.ErrorMatches("", err) { @@ -3220,7 +3220,7 @@ func TestPartitionStats(t *testing.T) { m.ExpectDB().WillReturn(db) db.ExpectPartitionStats().WillReturnError(errors.New("foo err")) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") _, err := db.PartitionStats(context.TODO(), "foo") if !testy.ErrorMatches("foo err", err) { @@ -3239,7 +3239,7 @@ func TestPartitionStats(t *testing.T) { Partition: "foo", }) }, - test: func(t *testing.T, c *kivik.Client) { + test: func(t *testing.T, c *kivik.Client) { //nolint:thelper // Not a helper db := c.DB("foo") stats, err := db.PartitionStats(context.TODO(), "foo") if !testy.ErrorMatches("", err) { diff --git a/mockdb/method_test.go b/mockdb/method_test.go index 2f91b21bd..dbda8d944 100644 --- a/mockdb/method_test.go +++ b/mockdb/method_test.go @@ -25,6 +25,7 @@ type methodTest struct { } func testMethod(t *testing.T, test methodTest) { + t.Helper() result := test.input.method(false) if result != test.standard { t.Errorf("Unexpected method(false) output.\nWant: %s\n Got: %s\n", test.standard, result) diff --git a/replicate_live_test.go b/replicate_live_test.go index 480df7fd4..a39320ecb 100644 --- a/replicate_live_test.go +++ b/replicate_live_test.go @@ -397,6 +397,7 @@ func verifyDoc(ctx context.Context, t *testing.T, target, source *kivik.DB, docI } func verifySec(ctx context.Context, t *testing.T, target *kivik.DB) { + t.Helper() sec, err := target.Security(ctx) if err != nil { t.Fatal(err) diff --git a/x/kivikd/logger/logger.go b/x/kivikd/logger/logger.go index 5bf1ac2d9..875595c51 100644 --- a/x/kivikd/logger/logger.go +++ b/x/kivikd/logger/logger.go @@ -91,7 +91,7 @@ func New(w io.Writer) RequestLogger { var DefaultLogger = New(os.Stderr) func (l *logger) Log(req *http.Request, status int, fields Fields) { - fmt.Fprintf(l.w, `%s %s [%s] (%s) "%s %s %s" %d %d "%s" "%s"%c`, + _, _ = fmt.Fprintf(l.w, `%s %s [%s] (%s) "%s %s %s" %d %d "%s" "%s"%c`, req.RemoteAddr[0:strings.LastIndex(req.RemoteAddr, ":")], fields.GetString(FieldUsername), fields.GetTime(FieldTimestamp).Format("2006-01-02 15:04:05Z07:00"), diff --git a/x/kivikd/test/test.go b/x/kivikd/test/test.go index 4f744e7a0..81986abaf 100644 --- a/x/kivikd/test/test.go +++ b/x/kivikd/test/test.go @@ -148,6 +148,7 @@ func (cd customDriver) NewClient(string, driver.Options) (driver.Client, error) // ServerTest tests the kivikd server func ServerTest(t *testing.T) { + t.Helper() memClient, err := kivik.New("memory", "") if err != nil { t.Fatalf("Failed to connect to memory driver: %s", err) diff --git a/x/memorydb/alldocs_test.go b/x/memorydb/alldocs_test.go index 30a20e7bf..ab87a75aa 100644 --- a/x/memorydb/alldocs_test.go +++ b/x/memorydb/alldocs_test.go @@ -104,6 +104,7 @@ func TestAllDocs(t *testing.T) { } func checkRows(t *testing.T, rows driver.Rows, expectedIDs []string, rowsErr string) { + t.Helper() var row driver.Row var ids []string msg := "" diff --git a/x/memorydb/db_test.go b/x/memorydb/db_test.go index 0a61bdacc..7f5b74aa9 100644 --- a/x/memorydb/db_test.go +++ b/x/memorydb/db_test.go @@ -74,6 +74,7 @@ func TestStats(t *testing.T) { } func setupDB(t *testing.T) *db { + t.Helper() c := setup(t, nil) if err := c.CreateDB(context.Background(), "foo", nil); err != nil { t.Fatal(err) diff --git a/x/memorydb/memory_test.go b/x/memorydb/memory_test.go index 8163ed1f2..0ca0c48ef 100644 --- a/x/memorydb/memory_test.go +++ b/x/memorydb/memory_test.go @@ -25,6 +25,7 @@ import ( var d = &memDriver{} func setup(t *testing.T, setup func(driver.Client)) driver.Client { + t.Helper() c, err := d.NewClient("foo", nil) if err != nil { t.Fatal(err) diff --git a/x/memorydb/test/test.go b/x/memorydb/test/test.go index 929aee24d..97a82e133 100644 --- a/x/memorydb/test/test.go +++ b/x/memorydb/test/test.go @@ -107,10 +107,10 @@ func RegisterMemoryDBSuite() { // MemoryTest runs the integration tests for the Memory driver. func MemoryTest(t *testing.T) { + t.Helper() client, err := kivik.New("memory", "") if err != nil { - t.Errorf("Failed to connect to memory driver: %s\n", err) - return + t.Fatalf("Failed to connect to memory driver: %s\n", err) } clients := &kt.Context{ RW: true, diff --git a/x/server/server_test.go b/x/server/server_test.go index 5d2f5d6d3..f56157624 100644 --- a/x/server/server_test.go +++ b/x/server/server_test.go @@ -703,7 +703,7 @@ func TestServer(t *testing.T) { { name: "post document", driver: "memory", - init: func(t *testing.T, client *kivik.Client) { + init: func(t *testing.T, client *kivik.Client) { //nolint:thelper // not a helper if err := client.CreateDB(context.Background(), "db1", nil); err != nil { t.Fatal(err) } @@ -818,7 +818,7 @@ func TestServer(t *testing.T) { wantJSON: map[string]interface{}{ "ok": true, }, - check: func(t *testing.T, client *kivik.Client) { + check: func(t *testing.T, client *kivik.Client) { //nolint:thelper // Not a helper sec, err := client.DB("db2").Security(context.Background()) if err != nil { t.Fatal(err)