I'm trying to install an instance of SQL Server 2014 Express on the Visual Studio Online Build agent, however it seems to get stuck and times out after half an hour (I'm trialling it out and using the free version for now).
I'm currently running the following powershell at the start of the build:
choco feature enable -n=allowGlobalConfirmation
choco install mssqlserver2014express --package-parameters='silentArgs:"/IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=SQLEXPRESS /INSTANCENAME=SQLEXPRESS /UPDATEENABLED=FALSE /FEATURES=SQLENGINE"' -y
This installs fine locally and in AppVeyor, but freezes on VSO Build. Here is the console log up until it times out:
Progress: 99% - Saving 311.7 MB of 311.73 MB
Progress: 100% - Completed download of C:\Users\VssAdministrator\AppData\Local\Temp\chocolatey\chocolatey\MsSqlServer2014Express\SQLEXPR.exe (311.73 MB).
Download of SQLEXPR.exe (311.73 MB) completed.
Hashes match.
C:\Users\VssAdministrator\AppData\Local\Temp\chocolatey\chocolatey\MsSqlServer2014Express\SQLEXPR.exe
Extracting...
Installing...
Installing MsSqlServer2014Express...
I'd be happy to hear answers that don't directly solve the installation problem. For instance, I've found advice elsewhere suggesting that you shouldn't be running integration tests on the build agent. However, I disagree with this advice - I've got a 1000 database tests which only take 5 minutes to run - and I'd prefer to fail the build if these tests fail rather than progress in the build pipeline. Additionally I don't want to mock the database - I'm using Dapper not Entity Framework and want to test that my code interacts with the database schema correctly.
I also saw advice suggesting you should setup your own machine with a SQL instance pre-installed. I'd prefer not to do this since we don't have the resource to setup and maintain (apply security patches etc) the machine. I've trialled using an Azure SQL server, which while easy to maintain, takes too long to create a new database. Each database seems to take about 2 minutes to create, and each test run creates 20 databases.
Update I've tried the microsoft/mssql-server-windows-express docker image on AppVeyor and VSTS. AppVeyor completes the install in ~6minutes but VSTS takes ~19minutes. The download for both took ~4.5mins so I would be happy to use this in AppVeyor with caching, but 19minutes is far too long in VSTS. Does anyone know how to diagnose the bottleneck in VSTS?
docker pull microsoft/mssql-server-windows-express
docker run -d -p 1433:1433 -e sa_password=sgddsgbhidjsghuisg -e ACCEPT_EULA=Y microsoft/mssql-server-windows-express