swaggest / rest

Web services with OpenAPI and JSON Schema done quick in Go
https://pkg.go.dev/github.com/swaggest/rest
MIT License
362 stars 17 forks source link

Add async expectations to server mock #33

Closed vearutop closed 3 years ago

github-actions[bot] commented 3 years ago

Unit Test Coverage

total: (statements) 81.0%

Coverage diff with base branch ```diff 93c93 < github.com/swaggest/rest/request/decoder.go formDataToURLValues 66.7% --- > github.com/swaggest/rest/request/decoder.go formDataToURLValues 77.8% 159a160 > github.com/swaggest/rest/resttest/server.go ExpectAsync 100.0% 163c164,165 < github.com/swaggest/rest/resttest/server.go ServeHTTP 72.7% --- > github.com/swaggest/rest/resttest/server.go checkAsync 68.8% > github.com/swaggest/rest/resttest/server.go ServeHTTP 75.0% 167c169 < github.com/swaggest/rest/resttest/server.go ExpectationsWereMet 83.3% --- > github.com/swaggest/rest/resttest/server.go ExpectationsWereMet 72.2% 176c178 < total: (statements) 81.2% --- > total: (statements) 81.0% ```
codecov[bot] commented 3 years ago

Codecov Report

Merging #33 (7f99dfc) into master (862b352) will increase coverage by 0.11%. The diff coverage is 43.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #33      +/-   ##
==========================================
+ Coverage   73.27%   73.39%   +0.11%     
==========================================
  Files          26       26              
  Lines        1508     1477      -31     
==========================================
- Hits         1105     1084      -21     
+ Misses        254      251       -3     
+ Partials      149      142       -7     
Flag Coverage Δ
unittests 73.39% <43.47%> (+0.11%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
request/decoder.go 77.14% <ø> (ø)
request/factory.go 82.35% <ø> (ø)
response/encoder.go 63.58% <ø> (ø)
resttest/server.go 61.03% <43.47%> (-1.93%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 862b352...7f99dfc. Read the comment docs.

github-actions[bot] commented 3 years ago

Benchmark Result

Benchmark diff with base branch ``` name old time/op new time/op delta pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 1.65µs ± 2% 1.65µs ± 1% ~ (p=0.743 n=4+4) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 936ns ± 3% 945ns ± 1% ~ (p=0.222 n=5+5) DecoderFunc_Decode-2 2.58µs ± 2% 2.56µs ± 2% ~ (p=0.421 n=5+5) Decoder_Decode_json-2 29.7µs ± 1% 28.5µs ± 1% -3.80% (p=0.008 n=5+5) Decoder_Decode_queryObject-2 6.76µs ± 2% 6.70µs ± 2% ~ (p=0.421 n=5+5) Decoder_Decode_jsonParam-2 2.36µs ± 2% 2.35µs ± 1% ~ (p=0.500 n=5+5) DecoderFactory_SetDecoderFunc-2 2.07µs ± 1% 2.11µs ± 1% +1.99% (p=0.032 n=5+5) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 14.7µs ± 1% 14.7µs ± 1% ~ (p=1.000 n=5+5) Middleware_control-2 3.97µs ± 2% 3.97µs ± 2% ~ (p=1.000 n=5+5) name old alloc/op new alloc/op delta pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 2.50kB ± 0% 2.50kB ± 0% ~ (all equal) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 440B ± 0% 440B ± 0% ~ (all equal) DecoderFunc_Decode-2 1.51kB ± 0% 1.51kB ± 0% ~ (all equal) Decoder_Decode_json-2 12.3kB ± 0% 12.3kB ± 0% ~ (all equal) Decoder_Decode_queryObject-2 2.00kB ± 0% 2.00kB ± 0% ~ (all equal) Decoder_Decode_jsonParam-2 720B ± 0% 720B ± 0% ~ (all equal) DecoderFactory_SetDecoderFunc-2 1.02kB ± 0% 1.02kB ± 0% ~ (all equal) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 1.11kB ± 2% 1.13kB ± 1% +1.65% (p=0.048 n=5+5) Middleware_control-2 11.2kB ± 0% 11.2kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 8.00 ± 0% 8.00 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 4.00 ± 0% 4.00 ± 0% ~ (all equal) DecoderFunc_Decode-2 12.0 ± 0% 12.0 ± 0% ~ (all equal) Decoder_Decode_json-2 169 ± 0% 169 ± 0% ~ (all equal) Decoder_Decode_queryObject-2 36.0 ± 0% 36.0 ± 0% ~ (all equal) Decoder_Decode_jsonParam-2 12.0 ± 0% 12.0 ± 0% ~ (all equal) DecoderFactory_SetDecoderFunc-2 16.0 ± 0% 16.0 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 11.0 ± 0% 11.0 ± 0% ~ (all equal) Middleware_control-2 9.00 ± 0% 9.00 ± 0% ~ (all equal) ```