diff options
Diffstat (limited to 'internal/cryptomarket/client_test.go')
| -rw-r--r-- | internal/cryptomarket/client_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/cryptomarket/client_test.go b/internal/cryptomarket/client_test.go index 39367fc..ab77b24 100644 --- a/internal/cryptomarket/client_test.go +++ b/internal/cryptomarket/client_test.go @@ -214,3 +214,24 @@ func TestClientCancellationDoesNotPoisonSharedBackoff(t *testing.T) { t.Fatalf("cancelled fetch poisoned the shared client: %v", e) } } + +func TestHaltedSymbolIsFreshAfterAttempt(t *testing.T) { + c, calls := mockKraken(t, "halted") + if s, e := c.Fetch(context.Background(), []string{"BTC"}); e != nil { + t.Fatal(e) + } else if _, ok := s.Quotes["BTC"]; ok { + t.Fatal("halted symbol unexpectedly quoted") + } + first := calls.Load() + if first != 4 { + t.Fatalf("first fetch calls = %d, want 4", first) + } + // A halted/delisted pair has no quote, but the attempt must be cached so + // the next command does not re-run the full request chain forever. + if _, e := c.Fetch(context.Background(), []string{"BTC"}); e != nil { + t.Fatal(e) + } + if calls.Load() != first { + t.Fatalf("halted symbol re-fetched: %d -> %d", first, calls.Load()) + } +} |
