-
Notifications
You must be signed in to change notification settings - Fork 10
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
Refactor the HTTP handler into a struct #6
base: master
Are you sure you want to change the base?
Conversation
This allows the test suite to not spam syslog while testing. It will also let us test that messages actually get logged, etc.
This makes it easier to test the actual binary (for me at least) Use a WaitGroup so that we wait for whatever we *do* run.
This makes it easier to test the actual binary (for me at least) Use a WaitGroup so that we wait for whatever we *do* run.
It is nice to know how the random data is handled.
Test that we actually get an error code in the no-challenge case. Test that we handle when we can't write to the device. Test that we fail and log a message when we can't read from the device, and we send the appropriate message across the wire.
when using fatal it wasn't appending a newline, so messages were confusing this fixes that. also, add millisecond-level timing for how long it takes us to respond to requests. The *data* is available in UnixNano() but it requires doing the subtraction somehow, and also misses some of the overhead as the 'received challenge' only triggers after we've processed some of the request.
Conflicts: pollen.go
Conflicts: pollen.go
also, add a log when the process starts
Conflicts: pollen.go
Looks brilliant, thanks! Committed and pushed to both bzr and git. kirkland@x230:~/src/pollen/pollen⟫ debcommit
added .gitignore INFO: git exists git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. Counting objects: 12, done. Dustin Kirkland On Wed, Feb 26, 2014 at 3:06 AM, John Arbash Meinel <
|
This changes the 'handler' from being just a func() using global state to being a struct with local state.
It then moves the things like dev and log to being members of the struct, with interfaces that let us override them in the test suite.
It then adds a bunch of tests about how we handle failures, errors, logging, the size flag, etc.
The interfaces also mean that we won't try to spam syslog while running the test suite.
Another small change is that if you do:
Then it won't try to bind to the HTTP port with a cert.
Since I'm not the official source for pollen, it helped for testing at least the HTTP requests manually.
This also fixes the help text for "-size" since it doesn't actually change how much content we send on the wire, but how much content we read from /dev/urandom (but it adds tests for that fact).