@@ -16,7 +16,6 @@ import (
1616 "fmt"
1717 "math/big"
1818 mrand "math/rand/v2"
19- "os"
2019 "regexp"
2120 "strconv"
2221 "strings"
@@ -40,7 +39,6 @@ import (
4039
4140 akamaipb "github.com/letsencrypt/boulder/akamai/proto"
4241 capb "github.com/letsencrypt/boulder/ca/proto"
43- "github.com/letsencrypt/boulder/cmd"
4442 "github.com/letsencrypt/boulder/config"
4543 "github.com/letsencrypt/boulder/core"
4644 corepb "github.com/letsencrypt/boulder/core/proto"
@@ -60,7 +58,6 @@ import (
6058 rapb "github.com/letsencrypt/boulder/ra/proto"
6159 "github.com/letsencrypt/boulder/ratelimit"
6260 "github.com/letsencrypt/boulder/ratelimits"
63- bredis "github.com/letsencrypt/boulder/redis"
6461 "github.com/letsencrypt/boulder/sa"
6562 sapb "github.com/letsencrypt/boulder/sa/proto"
6663 "github.com/letsencrypt/boulder/test"
@@ -283,7 +280,7 @@ func newAcctKey(t *testing.T) []byte {
283280 return acctKey
284281}
285282
286- func initAuthorities (t * testing.T ) (* DummyValidationAuthority , sapb.StorageAuthorityClient , * RegistrationAuthorityImpl , * ratelimits.RedisSource , clock.FakeClock , func ()) {
283+ func initAuthorities (t * testing.T ) (* DummyValidationAuthority , sapb.StorageAuthorityClient , * RegistrationAuthorityImpl , ratelimits.Source , clock.FakeClock , func ()) {
287284 err := json .Unmarshal (AccountKeyJSONA , & AccountKeyA )
288285 test .AssertNotError (t , err , "Failed to unmarshal public JWK" )
289286 err = json .Unmarshal (AccountKeyJSONB , & AccountKeyB )
@@ -352,39 +349,11 @@ func initAuthorities(t *testing.T) (*DummyValidationAuthority, sapb.StorageAutho
352349 },
353350 }, nil , nil , 0 , log , metrics .NoopRegisterer )
354351
355- var source * ratelimits.RedisSource
356- var limiter * ratelimits.Limiter
357- var txnBuilder * ratelimits.TransactionBuilder
358- if strings .Contains (os .Getenv ("BOULDER_CONFIG_DIR" ), "test/config-next" ) {
359- rc := bredis.Config {
360- Username : "unittest-rw" ,
361- TLS : cmd.TLSConfig {
362- CACertFile : "../test/certs/ipki/minica.pem" ,
363- CertFile : "../test/certs/ipki/localhost/cert.pem" ,
364- KeyFile : "../test/certs/ipki/localhost/key.pem" ,
365- },
366- Lookups : []cmd.ServiceDomain {
367- {
368- Service : "redisratelimits" ,
369- Domain : "service.consul" ,
370- },
371- },
372- LookupDNSAuthority : "consul.service.consul" ,
373- }
374- rc .PasswordConfig = cmd.PasswordConfig {
375- PasswordFile : "../test/secrets/ratelimits_redis_password" ,
376- }
377- ring , err := bredis .NewRingFromConfig (rc , stats , log )
378- test .AssertNotError (t , err , "making redis ring client" )
379- source = ratelimits .NewRedisSource (ring .Ring , fc , stats )
380- test .AssertNotNil (t , source , "source should not be nil" )
381- err = source .Ping (context .Background ())
382- test .AssertNotError (t , err , "Ping should not error" )
383- limiter , err = ratelimits .NewLimiter (fc , source , stats )
384- test .AssertNotError (t , err , "making limiter" )
385- txnBuilder , err = ratelimits .NewTransactionBuilder ("../test/config-next/wfe2-ratelimit-defaults.yml" , "" )
386- test .AssertNotError (t , err , "making transaction composer" )
387- }
352+ rlSource := ratelimits .NewInmemSource ()
353+ limiter , err := ratelimits .NewLimiter (fc , rlSource , stats )
354+ test .AssertNotError (t , err , "making limiter" )
355+ txnBuilder , err := ratelimits .NewTransactionBuilder ("../test/config-next/wfe2-ratelimit-defaults.yml" , "" )
356+ test .AssertNotError (t , err , "making transaction composer" )
388357
389358 testKeyPolicy , err := goodkey .NewPolicy (nil , nil )
390359 test .AssertNotError (t , err , "making keypolicy" )
@@ -401,7 +370,7 @@ func initAuthorities(t *testing.T) (*DummyValidationAuthority, sapb.StorageAutho
401370 ra .CA = ca
402371 ra .OCSP = & mocks.MockOCSPGenerator {}
403372 ra .PA = pa
404- return va , sa , ra , source , fc , cleanUp
373+ return va , sa , ra , rlSource , fc , cleanUp
405374}
406375
407376func TestValidateContacts (t * testing.T ) {
0 commit comments