hopefully this topic can help someone else find similar errors in the future. So basically, no matter what I did, I always got the same error message back because it was always importing the very same x file. it didn't consider that a problem and simply ploughed ahead with it's next task, which was to import the (by now very, very, very old) x file which, obviously, contained some errors relating to problems connecting to SQL Server as the NT AUTHORITY\SYSTEM user. Please specify a different results file or verify the existing file is no longer needed and delete it. ![]() The results file "C:\TeamCity\buildAgent\work\997fcad12fa08c08\src\x" already exists. after locating the call to MSTest, voila! There was that same bloody error, just before the x file was imported: Which gave me an idea and so I went back to the build log and made sure I was viewing "All Messages" instead of just the errors. "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" /runconfig:C:\TeamCity\buildAgent\work\997fcad12fa08c08\src\localtestrun.testrunconfig /testcontainer:C:\TeamCity\buildAgent\work\997fcad12fa08c08\src\\bin\Staging\ /testcontainer:C:\TeamCity\buildAgent\work\997fcad12fa08c08\src\\bin\Staging\.dll /testcontainer:C:\TeamCity\buildAgent\work\997fcad12fa08c08\src\\bin\Staging\ /resultsfile:C:\TeamCity\buildAgent\work\997fcad12fa08c08\src\x If I changed the command to the following (simply changing x to x) then everything worked fine and all tests executed and passed successfully: it fell over, but not for the reason I thought - it fell over because the x file already existed. I then ran cmd.exe in the security context of the NT AUTHORITY\SYSTEM user (using PsExec) and executed that exact same command. OK, so I finally figured out what was going wrong.įirstly, I looked in the logs for the build to check exactly what command was being issued to run MSTests and found the following: It still doesn't make sense though since the Local System account definitely has access to the database in question, as well as to the master database (and the temp database for that matter). This leads me to believe that TeamCity uses a different security context to run the build file (MSBuild) than the one it uses to execute the unit tests. ![]() no issues connection to the DB when the Build.xml file is run by TeamCity). ![]() However, if rather than checking "Enable MSTest tests" in the MSBuild options I instead run the following task from within the MSBuild file iteself then the tests run and all of them pass (i.e. so now I'm back to square one which is that when team city tries to run my unit tests via MSTest I get login failures connecting to the SQL Server database using the System account. the unit tests still fail it's just the failure goes unnoticed by TeamCity. ![]() If I ommit the results file then all it does is hide the actual errors.
0 Comments
Leave a Reply. |