Running three hours of Ruby tests in under three minutes
71–80 of 111 posts
Re: Running three hours of Ruby tests in under three minutes
#72Any reason why a financial infrastructure provider like Stripe would run CI tests on someone elses infrastructure? Isn't that a no go from a security point of view? Or - how do you trust the hosted CI company not to look at your code?
how do you trust the hosted CI company not to look at your code? Contracts, not firewalls, make the world go round.
c.f. also: "Enterprise Architects", a group of people who think building IT systems qualifies you to redesign an entire organisation.
Re: Running three hours of Ruby tests in under three minutes
#73I am tired of this technology having to be re-invented time and time again. The best I ever saw was an internal tool at Microsoft. It could run tests on devices (Windows Mobile phones, but it really didn't care), had a nice reservation and pool system and a nice USB-->Ethernet-->USB system that let you route any device to any of the test benches. This was great because it was a heterogeneous pool of devices, with dif…
>I am tired of this technology having to be re-invented time and time again. So did Microsoft open source this? If not, quit complaining. Just because you saw a massive software engineering company doing something better doesn't mean everyone else who doesn't have access to it sucks for not reaching parity.
Microsoft has alone re-invented this at least a half dozen times. At least one version of it, more limited in some regards more powerful in others, is sold as part of Visual Studio.
Of course the VS one is both much more "enterprisey" and less flexible in numerous ways.
(That said it does have nice charts.)
The industry as a whole though keeps remaking test frameworks again and again.
I admit that a custom made framework to solve a team's problems is going to be easier to use than an infinitely configurable framework that is designed to solve everyone's problems, Microsoft used to have that tool as well, and it was widely disliked for how little it did out of the box and how much work it required to get it up and running. (Also in its early days it had serious scaling problems, and its configuration + use required a lot of mental gymnastics)
I'm just annoyed that we haven't found a nice simple compromise solution, or at least created some fundamental building blocks.
On top of that so few testing systems pay attention to the user interface, if it takes me 5 minutes to add a single test, damned if I am going to be adding 50 tests.
Lots of test systems go with simple annotations, but then the instant I want something more powerful I am boned. MSTest was restricted like this for years, finally in VS2013 they made it much more extensible, but there is minimal C++ support. Other ecosystems are not a lot better, developers are really good at creating test systems that run on their local dev box, zippity do-da.
Then again I have spent most of my developer life in the devices area, which means test results need to in the very least get sent across the wire to a host machine of some type (depending on the intelligence of one's device under test).
I want my devs to be able to annotate a source file, have IPC code generated on both sides (device, and PC side library), and then have the test auto added to my test management system.
Bah humbug, I think I'll just write a parsing system with Perl and RegExs.
The manually adding tests to the test system part still sucks though. (There is an API for it, but again, mental gymnastics create a barrier to entry).
Re: Running three hours of Ruby tests in under three minutes
#74Earlier quoted context omitted.
Only if the early engineers could write in a language that they were as productive in as Ruby. Getting Stripe launched was the key thing Stripe needed to accomplish. Everything else follows from that.
There are certainly enough languages to choose from.
Choose boring (to you) technology.
Re: Running three hours of Ruby tests in under three minutes
#75Earlier quoted context omitted.
There are certainly enough languages to choose from.
Sure there are tons of languages, with different strengths and weaknesses. The part that is important is that the early engineers need to be productive in the language. Choose boring (to you) technology.
Re: Running three hours of Ruby tests in under three minutes
#76One thing I've noticed since coding with immutable data structures & functions (rather than mutable OOP programs) is how tests run really fast, and are easy to run in parallell. I/O only happens in a few functions, and most other code just takes data in -> transforms -> returns data out. This means I only have few functions that need to 'wait' on something outside of itself to finish, and much lesser delays in the co…
Immutable data structures give you easy parallelism, however there's a hidden runtime cost: you have to allocate way more objects. For example, I was able to save a ton of object allocations here: https://github.com/mime-types/ruby-mime-types/pull/93 mostly by mutating. For tasks that are not easily parallelizable it may be slower to use immutable structures. I mostly only ever hear about how fast FP languages are, s…
>Transients are an optimisation on persistent data structures, which decreases the amount of memory allocations needed. This makes a huge difference for performance critical code.
http://hypirion.com/musings/understanding-clojure-transients
Re: Running three hours of Ruby tests in under three minutes
#77I'm super curious how Stripe approaches end-to-end testing (like Selenium/browser testing, but maybe something more bespoke too) My understanding is that they have a large external dependency (my term: "the money system"), and running integration tests against it might be tricky or even undependable. Do they have a mock banking infrastructure they integrate against?
This is a great question, and it's definitely a problem we have. We don't have a single answer we use for every system we work on, but we employ a few common patterns, ranging from just keeping hard-coded strings containing the expected output, up to and including implementing our own fake versions of external infrastructure. We have, for example, our own faked ISO-8583 [1] authorization service, which some of our te…
Re: Running three hours of Ruby tests in under three minutes
#78Re: Running three hours of Ruby tests in under three minutes
#79This made me long for a unit test framework as simple as:
$ make -j36 test
Where you've got something like the following: $ find tests/
tests/bin/A
tests/bin/B
...
tests/input/A
tests/input/B
...
tests/expected/A
tests/expected/B
...
tests/output/
$ cat Makefile
test : $(shell find tests/bin -type f | sed -e 's@/bin/@/output/@')
tests/output/% : tests/bin/% tests/input/% tests/expected/%
@ printf "testing [%s] ... " $@
@ sh -c 'exec $$0 $@
@ # ...runs tests/bin/% tests/output/%
@ sh -c 'exec cmp -s $$3 $$0' $@ $^ && echo pass || echo fail
@ # ...runs cmp -s tests/expected/% tests/output/%
clean :
rm -f tests/output/*
You get test parallelism and efficient use of compute resources "for free" (well, from make -j, because it already has a job queue implementation internally). This setup closely resembles the "rts" unit test approach you'll find in a number of djb-derivative projects.The defining obstacle for Stripe seems like Ruby interpreter startup time though. I'm not sure how to elegantly handle preforked execution in a Makefile-based approach. Drop me a line if you have ideas or have tackled this in the past, I've got a couple projects stalled out on it.
Re: Running three hours of Ruby tests in under three minutes
#80How would one go about building a similar distributed testing setup for end-to-end tests where a sequence of tests have to be run in particular order. Finding the optimal ordering / distribution of tests between workloads would certainly be more complicated. Maybe they could be calculated with directed graph algorithms?