(t *testing.T)
| 174 | } |
| 175 | |
| 176 | func TestHTTPClientConfiguration(t *testing.T) { |
| 177 | // Setup miniredis |
| 178 | mr, err := miniredis.Run() |
| 179 | if err != nil { |
| 180 | t.Fatalf("an error '%s' occurred when starting miniredis", err) |
| 181 | } |
| 182 | defer mr.Close() |
| 183 | |
| 184 | cnf := &config.Configuration{ |
| 185 | Redis: config.RedisConfig{ |
| 186 | Dns: mr.Addr(), |
| 187 | }, |
| 188 | } |
| 189 | config.ConfigStore.Store(cnf) |
| 190 | |
| 191 | // Create LedgerForge instance |
| 192 | ledgerforge, err := NewLedgerForge(nil) |
| 193 | assert.NoError(t, err) |
| 194 | defer func() { _ = ledgerforge.Close() }() |
| 195 | |
| 196 | // Verify HTTP client is configured properly |
| 197 | assert.NotNil(t, ledgerforge.httpClient, "HTTP client should be initialized") |
| 198 | assert.Equal(t, 30*time.Second, ledgerforge.httpClient.Timeout, "Timeout should be 30 seconds") |
| 199 | |
| 200 | // Verify transport configuration |
| 201 | transport, ok := ledgerforge.httpClient.Transport.(*http.Transport) |
| 202 | assert.True(t, ok, "Transport should be *http.Transport") |
| 203 | assert.Equal(t, 100, transport.MaxIdleConns, "MaxIdleConns should be 100") |
| 204 | assert.Equal(t, 10, transport.MaxIdleConnsPerHost, "MaxIdleConnsPerHost should be 10") |
| 205 | assert.Equal(t, 90*time.Second, transport.IdleConnTimeout, "IdleConnTimeout should be 90 seconds") |
| 206 | } |
| 207 | |
| 208 | func TestProcessWebhookWithReusedClient(t *testing.T) { |
| 209 | // Track that the same client instance is used |
nothing calls this directly
no test coverage detected