use service principal secret during build

skip test if credentials are missing
This commit is contained in:
Markus Cozowicz 2019-07-30 14:33:35 +02:00
Родитель 08aa8e7036
Коммит 99760447a2
2 изменённых файлов: 30 добавлений и 23 удалений

Просмотреть файл

@ -8,13 +8,15 @@ steps:
- script: |
cd python
python install -e .[extra]
pip install -e .[extra]
displayName: 'Install Package'
- script: |
cd python
pytest --junitxml=junit/test-unitttest.xml
displayName: 'Python Unit Tests'
env:
myserviceprincipal1: $(test_service_principal_secret)
- task: PublishTestResults@2
condition: succeededOrFailed()

Просмотреть файл

@ -10,13 +10,18 @@ def test_subdir():
os.chdir(os.path.dirname(os.path.abspath(__file__)))
@pytest.mark.skipif(os.environ.get('myserviceprincipal1') is None,
reason='Environment variable myserviceprincipal1 must be set to service principals secret')
def test_service_principal(test_subdir):
ws = pyworkspace.Workspace()
svc1 = ws['myvault1']
assert len(svc1.get_secret("workspacetest1")) > 0
@pytest.mark.skipif(os.environ.get('myserviceprincipal1') is None,
reason='Environment variable myserviceprincipal1 must be set to service principals secret')
def test_service_csv1(test_subdir):
ws = pyworkspace.Workspace()