August 27, 2015
Testing@LMAX – Replacements in DSL
Given our DSL makes heavy use of aliases, we often have to provide a way to include the real name or ID as part of some string. For example, an audit record for a new account might be:
Created account 127322 with username someUser123. But in our acceptance test we’d create the user with:
registrationAPI.createUser("someUser"); someUser is just an alias, the DSL creates a unique username to use and the system assigns a unique account ID that the DSL keeps track of for us.
August 25, 2015
Miller – Command Line CSV Tool
Miller is like sed, awk, cut, join, and sort for name-indexed data such as CSV. Leaving this here for the next time I have to work with CSV files on the command line. It can do a lot more than just CSVs of course, but that’s likely to be the most useful to me.
August 8, 2015
Display Port Monitor Wakes Up a Few Seconds After Being Suspending on Linux
I have a dual monitor setup with Linux where one display is connected via DisplayPort and the other via DVI, both from an Nvidia graphics card. When the screen is locked both displays go black, the DVI monitor says it’s entering power save mode and the DisplayPort monitor says “No input” at which point both monitors turn back on displaying the unlock screen.
Playing with xset dpms force standby|suspend|off gave a variety of effects, sometimes the DisplayPort stayed off but the DVI turned back on, sometimes the DisplayPort went black but didn’t turn off etc.
June 23, 2015
End to End Tests @ LMAX Update
A little while back I said that LMAX ran around 11,000 end to end tests in around 50 minutes. Since then we’ve deployed some new hardware to run our continuous integration on, plus continued building new stuff and are now running about 11,500 tests in under 20 minutes.
A large part of the speed boost is extra VM instances but also the increased RAM allocation available to each VM has allowed us to increase a number of limits in the system and we can now run more tests concurrently against each VM instance.
June 8, 2015
Testing@LMAX – Aliases
Even after a magnum opus on the DSL LMAX uses for acceptance tests, there’s one crucial feature that I haven’t mentioned: the use of aliases to allow tests to use simple, meaningful names while ensuring that uniqueness constraints are met.
Creating a user with our DSL looks like:
registrationAPI.createUser("user"); You might expect this to create a user with the username ‘user’, but then we’d get conflicts between every test that wanted to call their user ‘user’ which would prevent tests from running safely against the same deployment of the exchange.
June 5, 2015
Testing@LMAX – Abstraction by DSL
At LMAX, all our acceptance tests are written using a high level DSL. This gives us two key advantages:
Tests can focus on what they’re testing with the details and mechanics hidden behind the DSL When things change we can update the DSL implementation to match, avoiding the need to change each test that happens to touch on the area. The DSL that LMAX uses is probably not what most people think of when hearing the term DSL – it doesn’t attempt to read like plain English, just simplifies things down significantly.
April 30, 2015
Making End-to-End Tests Work
The Google Testing Blog has an article “Just Say No to More End-to-End Tests” which winds up being a rather depressing evaluation of the testing capabilities, culture and infrastructure at Google. For example:
Let’s assume the team already has some fantastic test infrastructure in place. Every night:
The latest version of the service is built. This version is then deployed to the team's testing environment. All end-to-end tests then run against this testing environment.
April 14, 2015
Printing Only Part of a grep Match
It’s not uncommon to want to find a particular line in a file and print just a part of it. For example, if we wanted to find the total memory on a machine we could use:
grep '^MemTotal:' /proc/meminfo | sed -e 's/^MemTotal:\s*\([0-9]*\).*/\1/' Which does the job but duplicates a bunch of the matching regex. If you’re using a reasonably recent gnu grep, you can use it’s support for perl regex syntax and the \K operator:
April 9, 2015
Emoji One – Open source emoji designed for the web.
Mostly so I can find this again later when I inevitably need it, Emoji One is a creative commons licensed collection of Emoji and related tools for the web.
March 11, 2015
Patterns are for People
Avdi Grimm in Patterns are for People:
Patterns aren’t tools for programming computers; they are tools for programming people. As such, to say that “patterns are a language smell” makes very little sense. Patterns are a tool for augmenting language: our language, the language we use to talk to each other about a problem and its solutions; the language we use to daydream new machines in our minds before committing them to code.
March 5, 2015
New Favourite Little Java 8 Feature
Pre-Java 8:
ThreadLocal<Foo> foo = new ThreadLocal() {
@Override
protected Foo initialValue() {
return new Foo();
}
}; Post-Java 8:
ThreadLocal<Foo> foo = ThreadLocal.withInitial(Foo::new); Nice.
February 3, 2015
Mounting a Time Capsule Drive In Linux
Lots of articles out there that have almost the right solution here but nearly all of them miss one critical component, so for my future sanity, here’s what works for me:
sudo mount.cifs //timecapsule.local/Data/ /mnt/directory/ -o “pass=password,sec=ntlm”
If you don’t have zeroconf working in your Linux install you’ll have to use the time capsule’s IP instead of it’s .local name. The “Data” part is the name of the disk you want to mount as shown in Airport Utility (make sure you escape any spaces with backslash.