Skip to content

Instantly share code, notes, and snippets.

@Seddryck
Last active January 20, 2018 14:03
Show Gist options
  • Save Seddryck/eb50e20a88ea15492b558197de818937 to your computer and use it in GitHub Desktop.
Save Seddryck/eb50e20a88ea15492b558197de818937 to your computer and use it in GitHub Desktop.
Install Azure Cosmos DB Emulator on AppVeyor
install:
- ps: Start-FileDownload 'https://aka.ms/cosmosdb-emulator' -FileName 'c:\projects\cosmos-db.msi'
- cmd: cmd /c start /wait msiexec /i "c:\projects\cosmos-db.msi" /qn /quiet /norestart /log install.log
- ps: Start-Process "start-emulator.cmd"
- ps: .\wait-connect-cosmosdb.ps1
"C:\Program Files\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" /NoExplorer /NoUI
$attempt = 0; $max = 5
$client = New-Object System.Net.Sockets.TcpClient([System.Net.Sockets.AddressFamily]::InterNetwork)
do {
try {
$client.Connect("127.0.0.1", 8081)
write-host "CosmosDB started"
}
catch {
$client.Close()
if($attempt -eq $max) {
write-host "CosmosDB was not started"
} else {
[int]$sleepTime = 5 * (++$attempt)
write-host "CosmosDB is not started. Retry after $sleepTime seconds..."
sleep $sleepTime;
}
}
}while(!$client.Connected -and $attempt -lt $max)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment