Azure.core.Exceptions.ServiceRequestError при выполнении тестов Behave Python в конвейере AzurePython

Программы на Python
Anonymous
Azure.core.Exceptions.ServiceRequestError при выполнении тестов Behave Python в конвейере Azure

Сообщение Anonymous »

Я создал среду автоматизации тестирования Behave Cucumber с Python для тестирования ресурсов Azure. До сих пор я запускал его локально, но теперь его нужно запускать как конвейер Azure. После настройки в конвейер Azure выдается следующая ошибка
`

Код: Выделить всё

: Failed to establish a new connection: [Errno -2] Name or service not known
`
Журналы

Код: Выделить всё

                 ^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/policies/_authentication.py", line 126, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/storage/blob/_shared/policies.py", line 302, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/_base.py", line 119, in send
self._sender.send(request.http_request, **request.context.options),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/azure/core/pipeline/transport/_requests_basic.py", line 386, in send
raise error
azure.core.exceptions.ServiceRequestError: : Failed to establish a new connection: [Errno -2] Name or service not known

Пожалуйста, может кто-нибудь подсказать, как устранить эту ошибку? Может ли это быть проблема с DNS или с кодом?
Вот мой файл yaml

Код: Выделить всё

name: $(Date:yyyy-MM-dd).$(Rev:r) $(env)-trial-${{ parameters.clinicalTrialNumber }}-$(studyCode) clean-up
trigger: none
parameters:
- name: subscription
displayName: Subscription
type: string
default: ''
values:

- name: landingZoneNumber
displayName: 'Landing Zone Number'
type: string
default: ''

- name: clinicalTrialNumber
displayName: 'Clinical Trial Number'
type: string
default: ''

- name: sourceType
displayName: 'Source type'
type: string
default: 'dev'
values:
- 'dev'
- 'live'

variables:
- name: landingZoneNumber
value: ${{ parameters.landingZoneNumber}}

- name: clinicalTrialNumber
value: ${{ parameters.clinicalTrialNumber}}

- name: env
${{ if startsWith(parameters.subscription, 'azu-cie') }}:
value: 'cie'
${{ if startsWith(parameters.subscription, 'azu-dev') }}:
value: 'dev'
${{ if startsWith(parameters.subscription, 'azu-tst') }}:
value: 'tst'

- name: variableGlobalTrialGroup

- name: variableTrialGroup

pool:
name: $(poolName)
vmImage: $(vmImage)

jobs:
- deployment: trialCleanup
displayName: 'Clean-up ${{ variables.env }}-trial-${{ parameters.clinicalTrialNumber }}'
environment: ${{ variables.env }}
strategy:
runOnce:
deploy:
steps:
- checkout: self
clean: true
fetchDepth: 2

- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
inputs:
versionSpec: '3.12'
addToPath: true
architecture: 'x64'

- task: AzureCLI@2
name: SPN
continueOnError: false
inputs:
azureSubscription: ${{ parameters.subscription }}
scriptType:  pscore
scriptLocation: 'InlineScript'
addSpnToEnvironment: true
inlineScript: |

- script: |
pip --version
python -m pip install --upgrade pip
pip cache purge
pip install -r requirements.txt
displayName: 'py requirements'

- script: env | sort
displayName: 'Display Env variables'

- task: AzureCLI@2
name: runBehaveCleanUp
displayName: 'Behave clean-up trial-${{ parameters.clinicalTrialNumber}}'
inputs:
azureSubscription: ${{ parameters.subscription }}
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
pip install pytest-azurepipelines
behave --no-capture --no-color ./features/clean_up.feature
addSpnToEnvironment: true
failOnStandardError: true

`

Подробнее здесь: https://stackoverflow.com/questions/784 ... tests-in-a

Вернуться в «Python»