Skip to content

test: major overhaul of unit tests#33

Merged
mccutchen merged 24 commits intomainfrom
chasing-coverage
Jan 31, 2025
Merged

test: major overhaul of unit tests#33
mccutchen merged 24 commits intomainfrom
chasing-coverage

Conversation

@mccutchen
Copy link
Owner

@mccutchen mccutchen commented Jan 28, 2025

A major update to unit tests. Because these tests now provide more coverage than autobahn, we can move the autobahn CI tests to a parallel job and get code coverage results faster.

In addition, this adds a few API changes driven by writing more tests:

  • NewClientKey() and NewMaskingKey() promoted from internal helpers
  • Explicit ServerMode and ClientMode to determine frame masking behavior
  • A number of new errors

@github-actions
Copy link

github-actions bot commented Jan 28, 2025

🔥 Run benchmarks comparing 56a6c4a against main:

gh workflow run bench.yaml -f pr_number=33

Note: this comment will update with each new commit.

@codecov
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 89.79592% with 5 lines in your changes missing coverage. Please review.

Project coverage is 83.82%. Comparing base (4e63a4d) to head (56a6c4a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
proto.go 87.09% 2 Missing and 2 partials ⚠️
websocket.go 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   79.62%   83.82%   +4.19%     
==========================================
  Files           3        3              
  Lines         432      445      +13     
==========================================
+ Hits          344      373      +29     
+ Misses         64       53      -11     
+ Partials       24       19       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mccutchen mccutchen changed the title test/refactor: additional unit testing, better error handling test: major overhaul of unit tests Jan 31, 2025
@mccutchen mccutchen merged commit decf7e3 into main Jan 31, 2025
9 checks passed
@mccutchen mccutchen deleted the chasing-coverage branch January 31, 2025 05:55
@github-actions
Copy link

benchstats: 4e63a4d...56a6c4a

View full benchmark output on the workflow summary.

goos: linux
goarch: amd64
pkg: github.com/mccutchen/websocket
cpu: AMD EPYC 7763 64-Core Processor                
                       │ ./baseline/bench-results.txt │      ./head/bench-results.txt       │
                       │            sec/op            │   sec/op     vs base                │
ReadFrame/1KiB-4                          1.026µ ± 0%   1.097µ ± 3%   +6.97% (p=0.000 n=10)
ReadFrame/1MiB-4                          921.6µ ± 1%   999.2µ ± 1%   +8.41% (p=0.000 n=10)
ReadFrame/8MiB-4                          7.103m ± 1%   7.762m ± 1%   +9.27% (p=0.000 n=10)
ReadFrame/16MiB-4                         14.36m ± 1%   15.46m ± 1%   +7.60% (p=0.000 n=10)
ReadMessage/1MiB/1-4                      1.080m ± 0%   1.133m ± 1%   +4.88% (p=0.000 n=10)
ReadMessage/8MiB/1-4                      7.878m ± 1%   8.693m ± 1%  +10.34% (p=0.000 n=10)
ReadMessage/16MiB/1-4                     15.73m ± 1%   17.06m ± 1%   +8.48% (p=0.000 n=10)
ReadMessage/1MiB/4-4                      1.554m ± 1%   1.729m ± 4%  +11.26% (p=0.000 n=10)
ReadMessage/8MiB/4-4                      11.15m ± 6%   11.50m ± 4%        ~ (p=0.143 n=10)
ReadMessage/16MiB/4-4                     19.61m ± 1%   22.52m ± 4%  +14.83% (p=0.000 n=10)
ReadMessage/1MiB/16-4                     2.585m ± 5%   2.827m ± 3%   +9.36% (p=0.000 n=10)
ReadMessage/8MiB/16-4                     16.67m ± 5%   16.86m ± 5%        ~ (p=0.280 n=10)
ReadMessage/16MiB/16-4                    24.37m ± 3%   25.42m ± 4%   +4.32% (p=0.009 n=10)
geomean                                   3.255m        3.504m        +7.64%

                       │ ./baseline/bench-results.txt │       ./head/bench-results.txt        │
                       │             B/op             │     B/op      vs base                 │
ReadFrame/1KiB-4                         1.055Ki ± 0%   1.055Ki ± 0%       ~ (p=1.000 n=10) ¹
ReadFrame/1MiB-4                         1.000Mi ± 0%   1.000Mi ± 0%       ~ (p=0.966 n=10)
ReadFrame/8MiB-4                         8.000Mi ± 0%   8.000Mi ± 0%  +0.00% (p=0.046 n=10)
ReadFrame/16MiB-4                        16.00Mi ± 0%   16.00Mi ± 0%       ~ (p=0.752 n=10)
ReadMessage/1MiB/1-4                     1.000Mi ± 0%   1.000Mi ± 0%       ~ (p=0.691 n=10)
ReadMessage/8MiB/1-4                     8.000Mi ± 0%   8.000Mi ± 0%       ~ (p=0.562 n=10)
ReadMessage/16MiB/1-4                    16.00Mi ± 0%   16.00Mi ± 0%       ~ (p=0.647 n=10)
ReadMessage/1MiB/4-4                     3.602Mi ± 0%   3.602Mi ± 0%  -0.00% (p=0.003 n=10)
ReadMessage/8MiB/4-4                     28.57Mi ± 0%   28.57Mi ± 0%       ~ (p=0.753 n=10)
ReadMessage/16MiB/4-4                    57.09Mi ± 0%   57.09Mi ± 0%       ~ (p=0.958 n=10)
ReadMessage/1MiB/16-4                    5.407Mi ± 0%   5.407Mi ± 0%  -0.00% (p=0.042 n=10)
ReadMessage/8MiB/16-4                    47.22Mi ± 0%   47.22Mi ± 0%  +0.00% (p=0.030 n=10)
ReadMessage/16MiB/16-4                   93.81Mi ± 0%   93.81Mi ± 0%       ~ (p=0.868 n=10)
geomean                                  5.263Mi        5.263Mi       -0.00%
¹ all samples are equal

                       │ ./baseline/bench-results.txt │      ./head/bench-results.txt       │
                       │          allocs/op           │ allocs/op   vs base                 │
ReadFrame/1KiB-4                           5.000 ± 0%   5.000 ± 0%       ~ (p=1.000 n=10) ¹
ReadFrame/1MiB-4                           5.000 ± 0%   5.000 ± 0%       ~ (p=1.000 n=10) ¹
ReadFrame/8MiB-4                           5.000 ± 0%   5.000 ± 0%       ~ (p=1.000 n=10) ¹
ReadFrame/16MiB-4                          5.000 ± 0%   5.000 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/1MiB/1-4                       6.000 ± 0%   6.000 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/8MiB/1-4                       6.000 ± 0%   6.000 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/16MiB/1-4                      6.000 ± 0%   6.000 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/1MiB/4-4                       24.00 ± 0%   24.00 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/8MiB/4-4                       24.00 ± 0%   24.00 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/16MiB/4-4                      24.00 ± 0%   24.00 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/1MiB/16-4                      90.00 ± 0%   90.00 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/8MiB/16-4                      90.00 ± 0%   90.00 ± 0%       ~ (p=1.000 n=10) ¹
ReadMessage/16MiB/16-4                     90.00 ± 0%   90.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                    14.59        14.59       +0.00%
¹ all samples are equal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant