Unit tests are denied access to file system on build agent

I use TeamCity to perform nightly JUnit tests on my project. The tests are run using an Ant script, which works fine when executed outside of TeamCity (e.g. from within my IntelliJ project). In TeamCity, however, tests that try to read files from disk fail with a FileNotFoundException ("Access is denied").

Files that are located inside my project tree (i.e. checked into CVS) and are accessed via a relative path do not exhibit this problem, only files that are located elsewhere on the disk or on network shares. The problematic files add up to over 100 GB, so putting them in CVS or copying them into the build directory every time is not an option.

Is there a configuration option somewhere that will fix this?

Thanks,

Tom

2 comments
Comment actions Permalink

Tom,

Do you have TeamCity build agent installed as a Windows service? In this case service limitations can affect the builds that the agent is running.
The most common service-related issues are:
- user the service runs under. The user should have enough permissions to perform the build.
- access to network shares and mapped drives. Services have a restriction to access the resources that imposed by Windows.
- interaction with desktop, headless mode, etc.

Please try to check whether it reproduces when TeamCity agent is run via console.

0
Comment actions Permalink

Indeed, running the agent from the command line worked fine. I then tried to create a new user account with administrator privileges to run the service under, but that resulted in the same errors as before. I'm now running it under my own account, which does work. Thanks for the help!

0

Please sign in to leave a comment.