Commit fddaf21
Add Go tests for per-error-type connection retry (isConnectionError)
Implements the Ruby spec coverage missing from the Go test suite:
Ruby: spec/nats_sync/users_sync_spec.rb
context 'with various network errors' do
[ Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT,
Net::OpenTimeout, SocketError ].each do |error_class|
it "retries on #{error_class}"
end
end
The Go implementation gates retries on isConnectionError(), which matches
connection-class errors by substring. The new DescribeTable in
users_sync_test.go covers every string pattern in that function, each
annotated with its Ruby error-class equivalent:
Ruby error class Go error string matched
───────────────────── ────────────────────────
Errno::ECONNREFUSED → "connection refused"
Errno::ECONNRESET → "connection reset by peer"
Errno::ETIMEDOUT → "connection timed out"
Net::OpenTimeout → "i/o timeout", "deadline exceeded"
SocketError → "no such host"
Errno::EHOSTUNREACH → "host is unreachable"
Errno::ENETUNREACH → "network is unreachable"
(Go-specific) → "eof", "unexpected eof"
Negative cases verify that HTTP-level errors (401, 500) and nil do not
trigger retries.
Uses export_test.go to expose isConnectionError to the external test
package without modifying the production API.1 parent 335fcc2 commit fddaf21
2 files changed
Lines changed: 82 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
775 | 776 | | |
776 | 777 | | |
777 | 778 | | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
0 commit comments