Skip to content

Commit

Permalink
Merge pull request #1040 from go-kivik/ktCleanup
Browse files Browse the repository at this point in the history
Move DB cleanup to t.Cleanup
  • Loading branch information
flimzy authored Jul 27, 2024
2 parents 8f5c345 + 5f01484 commit f10e42a
Show file tree
Hide file tree
Showing 71 changed files with 407 additions and 410 deletions.
10 changes: 8 additions & 2 deletions .golangci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ enable = [
"unconvert",
"goimports",
"unused",
"vetshadow",
"misspell",
"nakedret",
"errcheck",
"revive",
"ineffassign",
"vet",
"unparam",
"gofumpt",
"prealloc",
Expand All @@ -27,6 +25,9 @@ enable = [
# SQL-related linters
"rowserrcheck",
"sqlclosecheck",

# Testing
"thelper",
]

[issues]
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions cmd/kivik/cmd/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kivik/cmd/delete_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/kivik/cmd/get_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/kivik/cmd/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kivik/cmd/post_cluster_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kivik/cmd/post_compact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/kivik/cmd/post_compact_views_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/kivik/cmd/post_doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kivik/cmd/post_flush_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/kivik/cmd/post_purge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
14 changes: 7 additions & 7 deletions cmd/kivik/cmd/post_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kivik/cmd/post_view_cleanup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kivik/cmd/put_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Loading

0 comments on commit f10e42a

Please sign in to comment.