Date | Commit message (Collapse) |
|
|
|
IO.select can raise errors (IOError most notably) on bad
descriptors. Ensure we can detect and delete them from our
waiting sets if IO.select raises something.
|
|
New way to call 'store_content' with a
MogileFS::Util::StoreContent allows you to roll your own method
of streaming data to mogile on an upload (instead of using a
string or file)
[ew: this still requires a known content length beforehand]
[ew: applied with --whitespace=strip, rewritten subject,
80-column wrapping]
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
|
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
|
I'm tired of the overhead of loading rubygems
|
|
At least processes are easier to debug than threads...
|
|
When running tests in parallel, releasing a listener when
killing the process that owns it can cause another test to grab
it. Allow setting TEST_DEAD_PORT in env to avoid this race
condition.
|
|
Not sure why the atexit statement doesn't kick in in test/setup;
but I'm too lazy to look into it at the moment. Also remove a
"require 'tempfile'" while we're at it.
|
|
Kernel threads in 1.9 are excruciatingly painful to debug
(much more so than userspace threads in 1.8). I'm not in
a masochistic days...
|
|
File and StringIO objects need to be opened in binary mode,
otherwise they take the default encoding format. Thankfully,
Sockets and Tempfile objects seem to be binary by default as of
1.9.1; but it really is a mess to have to deal with FS
abstractions that try to deal with encoding crap behind your
back...
|
|
Not sure how hosts was ever allowed to be a String, but sort_by
does not work on Strings in 1.9 so this was a bug before, too.
Also I'm not sure how the accept_nr variable gets shared between
threads; better just to use sockets for here...
|
|
Use String#ord instead of String#[] when it is available.
|
|
the "default_test" method may not exist in the version
of Ruby we're using (1.9.1p0)
|
|
We don't want to return the used object back to the caller.
Noticed during 1.9.1 compatibility testing.
|
|
|
|
Again, eliminate unnecessary return statements and
simplify hash generation.
|
|
Domains and devices may be added/changed at any time,
so there's a risk of cache misses in case something
got added before our cache refresh interval. Always
retry if we have a cache miss.
|
|
Some static code analysis tools by Seattle.rb folks
I'm avoiding sticking these tasks in the Rakefile since they're
too slow (and I like GNU Make more than I like Ruby *g*)
|
|
Last I checked, the trailing "return" is not optimized away by
MRI 1.8. Additionally, remove some useless temporary variables.
|
|
|
|
Don't specify an empty class (e.g. "class="), instead
just omit the parameter entirely if it is nil.
|
|
Due to the unfortunate name, it never got run.
Oops!
|
|
|
|
Since the test server sleeps forever, there's no harm in having
a shorter timeout so our tests run faster (over twice as fast
with `make -j').
|
|
Oops, there may be more of these...
|
|
This makes it easier to use when making requests.
|
|
This is a bit safer since we'll retry on short writes
instead of silently failing...
|
|
Socket#send will return with short writes and IO.write just
sucks, so expose our existing syswrite_full routine to the
public.
While we're at it, add a unit test to try to ensure that we're
correctly doing syswrite_full here. System-specific behavior
dealing with buffer sizes is not easy to test...
|
|
Oops, this method needs to bypass transformations we
in the normal MogileFS::MogileFS code path.
|
|
This got noticed when I imported this project into another
project vendor/ subdirectory (no, I've decided to not use
submodules for that project).
|
|
|
|
|
|
We never checked the HTTP status code when making the HEAD
request. All this HTTP stuff should probably be moved to
HTTPFile
|
|
Correctly fail when we get non-200 HTTP responses and retry on
the next URI.
|
|
This will include networks and optimal URI selection support
|
|
|
|
"io.sync = true" does not appear to flush file pointers in MRI
1.8, we need to explicitly flush it first.
|
|
Also, remove the PID uniqueness thing, it's easy enough
to just create a new directory if we want to run tests
in parallel... Additionally, add ignores in for the
log files.
|
|
And incorrectly nested assertions in the tests made
sure the errors were never caught, too.
Now the unit tests run in about 3s for me
Damn Ruby conventions and 2-space indents...
|
|
-o pipefail was only useful when I was experimenting
with unbuffering output to the terminal. I've decided
to just forgo terminal spewing in the tests, and the
lone use of cat(1) is highly unlikely to fail..
|
|
This way tests can run quicker by default but we
can still use larger ones to test things.
|
|
|
|
Previously, when we got multiple destinations to
upload to and one of them failed, we failed to
correctly retry the next destination. This will
set the correct devid and URL.
|
|
We dropped NFS support, so this can be simplified further.
|
|
I'm getting a 40% decreas with my current set of tests
on my dual core machine.
|
|
I don't think we ever used the assertions from ZenTest
and rubygems increases load time on my box.
|
|
I prefer running my tests directly from the command-line
ruby -I lib/ test/test_client.rb
|
|
We used to mock it for the tests, but we use real sockets now.
|
|
Also, fix up a warning about @thr being uninitialized
that showed up in testing.
|
|
We don't mock `select' anywhere, and this makes us safer
in case we're included in another module.
|