I learned today from Rob Lanphier that it has recently become possible to do this reliably in every extension repo as well as mw core:
$ git checkout wmf/1.23wmf17
/VisualEditor$ git checkout wmf/1.23wmf17
Branch wmf/1.23wmf17 set up to track remote branch wmf/1.23wmf17 from origin.
Switched to a new branch 'wmf/1.23wmf17'
The current branch of each wiki is tracked in https://git.wikimedia.org/blob/operations%2Fmediawiki-config/HEAD/wikiversions.json
The current branch of core (which should be consistent across all extensions also) is available on https://test2.wikipedia.org/wiki/Special:Version (and theoretically in the API somewhere)
It would be good if we could change our Jenkins builds with test2 as a target to pull the current wmf branch instead of master.
In the short term, we could update the build config manually every Thursday.
In the slightly longer term it should be possible to read Special:Version or the wikiversions.json file in order to determine at run time the proper version of the tests appropriate for test2 (and any other target environment not beta labs, e.g. enwiki or commons)