RSpec search_spec.rb RateLimiter LimitExceeded problems

(Mittineague) #1

Continuing the discussion from Search within topic is omitting results:

I was getting things set up to do a PR - Pull Request - and figured it might be nice to include a test.

So I ran
bundle exec rspec spec/components/search_spec.rb
and got “38 examples, 30 failures” - Ouch!
* my change didn’t add any Fails, but then it didn’t remove any either :sadpanda:

After running

RAILS_ENV=development bundle exec rake db:migrate
RAILS_ENV=development bundle exec rspec spec/components/search_spec.rb

Much better, only 7 Fails. Some “expecting _ got 5” etc. and some “RateLimiter LimitExceeded”

I was under the impression that testing was exempt from rate limits.

Am I missing a command option?

TBH, I’m not all that sure that I’ll be able to write some good test code, but I’d rather not be timed out between attempts.

(Régis Hanol) #2

Have you tried flushing redis (redis-cli flushall)?

Also, you’ve got to start using autospec: rake autospec. You’re welcome :wink:

(cpradio) #3

Doesn’t that run every test? Sometimes it is nice to be able to run the ones you know you are affecting or are throwing errors to help nail things down.

Does autospec do something to help increase ratelimits?

(Régis Hanol) #4

It does, but it’s clever enough to watch the files and stop what it’s currently doing to run the tests associated with the file you just saved :wink: And it will automatically keep re-trying the same tests until they’re green. Huge time saver since you don’t have to wait for rails to launch every time!

(cpradio) #5

Hmm… Okay, with that in mind though, I think it doesn’t like me or it may not like my setup, as I tried it after wiping the discourse_test database, and re-seeding that database, and it gets about a dozen failures.

3 are related to Search

rspec ./spec/components/search_spec.rb:68 # Search escapes non alphanumeric characters
rspec ./spec/components/search_spec.rb:429 # Search Advanced search supports before and after in:first user:
rspec ./spec/components/search_spec.rb:485 # Search Advanced search can find by status

So I guess I’ll have to spend some time to figure out why this is happening, when I get a chance.

(Régis Hanol) #6

Might be an issue with the locale of your database or your postgresql server.

(cpradio) #7

I followed

I don’t see anything mentioned there about locale… or ensuring it is set properly.