如何使用spring引导集成测试(java)在Azure devops中运行Azure cosmos DB模拟器?
目前,cosmos DB模拟器只支持Windows服务器,而不支持linux?
有什么建议吗?
更新:1用于windows生成代理,下面的任务可以使用,这是从蔚蓝管道。
- task: CosmosDbEmulator@2
inputs:
containerName: 'azure-cosmosdb-emulator'
enableAPI: 'SQL'
portMapping: '8081:8081, 8901:8901, 8902:8902, 8979:8979, 10250:10250, 10251:10251, 10252:10252, 10253:10253, 10254:10254, 10255:10255, 10256:10256, 10350:10350'
hostDirectory: '$(Build.BinariesDirectory)\azure-cosmosdb-emulator'对于Linux:我使用与@Ricardo相同的
发布于 2021-09-14 11:07:45
有一种用于linux的CosmosDB模拟器:这里的尝试。
它们提供在linux机器上运行它的命令,我们只是将它们放在一个bash步骤中,以便能够在我们的yaml管道中运行:
*休眠是为了给模拟器在容器内启动的时间
- bash: |
ipaddr="`ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | head -n 1`"
ifconfig | grep "inet " | grep -Fv 127.0.0.1
docker pull mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
docker run -p 8081:8081 -p 10251:10251 -p 10252:10252 -p 10253:10253 -p 10254:10254 -m 4g --cpus=2.0 --name=test-linux-emulator -e AZURE_COSMOS_EMULATOR_PARTITION_COUNT=10 -e AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=false -e AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=$ipaddr -d -it mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
sleep 30
curl -k https://localhost:8081/_explorer/emulator.pem > /tmp/emulatorcert.crt
keytool -cacerts -storepass changeit -noprompt -importcert -alias emulator_cert -file /tmp/emulatorcert.crt
displayName: Install CosmosDB Emulator Dockerhttps://stackoverflow.com/questions/69068268
复制相似问题