The test actually worked, but vars for master and slave were inverted and sometimes used incorrectly.