azure-devops - Azure Devops yaml 管道中 Azure cosmos Db 模拟器的任务失败
问题描述
我正在尝试使用 Azure Cosmos Db 模拟器测试我的单元测试用例。当我运行任务时,管道给了我错误,因为目标机器主动拒绝并且所有应该测试的查询都针对我的实际生产数据库运行。可能错误是管道无法连接到我的模拟器数据库。为了解决这个问题,我从任务列表中添加了 Azure Cosmos Db Emulator 任务(公共预览版),并在我的 YAMl 管道中添加了以下两个任务。我在任务运行 Azure Cosmos Db 模拟器的管道中收到以下错误:
来自守护进程的错误响应:未能在网络 nat 上创建端点 azure-cosmosdb-emulator:在 hnsCallRawResponse 期间失败:在 Win32 中 hnsCall 失败:该进程无法访问该文件,因为它正被另一个进程使用。(0x20) 错误:无法启动容器:11429cb294f98fe04cac2fbc8ff026063ee51d2dff4ece1bbeff33c778cdd4da
下面是我的 Yaml 脚本:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
Start-CosmosDbEmulator
Get-Module
- task: azure-cosmosdb.emulator-public-preview.run-cosmosdbemulatorcontainer.CosmosDbEmulator@2
displayName: 'Run Azure Cosmos DB Emulator'
- script: yarn test
displayName: 'Run API tests (Cosmos DB)'
env:
HOST: $(CosmosDbEmulator.Endpoint)
AUTH_KEY: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
NODE_TLS_REJECT_UNAUTHORIZED: '0'
我在做什么错?如果有人可以解释。如果我不使用 Powershell 任务,则会收到以下错误:
来自守护进程的错误响应:hcsshim::CreateComputeSystem 120a874376d885ffea38a4e299f613340a599eae8a01b691366f21dcb6707501:容器操作系统与主机操作系统不匹配。
解决方案
推荐阅读
- flutter - 使用自定义 JSON API 创建类似 Instagram 的 Flutter Stories
- python - 如何仅计算基于多个月的新用户反应,在 Python Pandas 的 CSV 的不同页面中?
- javascript - 等待js加载后再抓取
- ruby-on-rails - 如何使用 Docker 交互模式粘贴多行命令但不评估?
- javascript - `window.x` 全局变量在浏览器调试断点刷新期间持续存在
- python - python datetime 模块中的 12 小时制,PM 和 AM 不影响日期时间
- json - 无法从谷歌表格 API 链接访问 JSON 数据
- networking - Docker 在 Debian Bullseye 中编写
- python - 迁移学习中的问题:在训练 CRNN 和 CTC 损失时,损失函数的值为 nan
- html - 如何按升序重新排列卡片 django