The way I have TeamCity set up is as follows. I have two build projects that I'll call Build A and Build B.
Build A is the compile and deploy process, and takes approx. 5 minutes to run. Build B is the running of the unit tests, which runs on a different agent and takes approx. 20 minutes to run.
Build A is triggered from source control, and build B has a "Build Triggering" dependency on Build A. Build B has also been set up as a Snapshot dependency on Build A (although I'm not certain if this is required - is it?).
What happens is that when someone checks in to source control, Build A runs, completes, and then Build B starts running. However, while B is running, if someone was to check in to source control, build A would start again, and can potentially break Build B.
Essentially, I need Build A to block while Build B is running.
What is the best way to go about this?