Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing - rackup folder - sleep #1902

Closed
MSP-Greg opened this issue Aug 10, 2019 · 3 comments
Closed

testing - rackup folder - sleep #1902

MSP-Greg opened this issue Aug 10, 2019 · 3 comments
Labels

Comments

@MSP-Greg
Copy link
Member

There are several files in the test/rackup folder, and a few make use of sleep, with varying times.

The same thing may be done when 'app' lambdas are declared in a test method. I've worked locally and in my fork with a file similar to:

run lambda { |env|
  dly = (env['REQUEST_PATH'][/\/(d+)sec/,1] || '0').to_i
  sleep dly
  [200, {}, ["Delayed #{dly}"]]
}

as a replacement, and also used a constant lambda defined in `helper.rb'.

This came about when thinking of tests for external KILL/TERM, graceful shutdown, phased-restarts, etc. A way to clearly create requests with specific time delays seems needed.

The above needs a GET of '/<x>sec', where <x> is an integer, and replies with 'Delayed <x>'.

Hence, two questions:

  1. Stupid idea or otherwise?
  2. If a 'good' idea', what to name the file, the constant, the GET and the reply? Kind of sensitive to ESL issues, as contributors are worldwide...
@nateberkopec
Copy link
Member

Makes sense.

I think we could add it a new "helpers/apps.rb" file that's required by test/helper. Namespace something like ExampleRackApps::SLEEP. I think you should just use the world sleep as it describes what the app actually does, which is call sleep.

@dentarg
Copy link
Member

dentarg commented Aug 12, 2019

Can this issue be closed now that #1903 was merged?

@MSP-Greg
Copy link
Member Author

Ok with me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants