Skip to content

Commit

Permalink
test_pipeline_create_and_variables_test Fix (#1184)
Browse files Browse the repository at this point in the history
* test_devops_group_and_member_tests

* sleep_in_live_run to 60

* Update test_devopsSecurityGroupTest.py

* 1175 changes

* Cassete updated

* Pipeline fix

* Authering test steps updated

Co-authored-by: Roshan-sy <roshan-sy@github.com>
  • Loading branch information
roshan-sy and Roshan-sy committed Sep 2, 2021
1 parent 9e3e15d commit 8cb419b
Show file tree
Hide file tree
Showing 3 changed files with 771 additions and 1,305 deletions.
5 changes: 5 additions & 0 deletions doc/authoring_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
Make sure your machine python SDK cache is clear. It is located at `%userprofile%\.azure-devops\python-sdk\cache\`
While running the test localy for first time make sure that the cassest (in the recording folder) gets the resource call as well

## Logout from az cli

Do `az logout` so that PAT token can be used.
If you don't logout, system will not take PAT for Authentication, which will result into test fail in PR pipeline.

## Configure PAT for running live tests

Recommended way is to use PAT from environment variable (AZURE_DEVOPS_EXT_PAT) when running a live test, so your PAT in the test file does not accidently get exposed to public in a PR.
Expand Down
2,065 changes: 763 additions & 1,302 deletions tests/recordings/test_pipeline_create_and_variables_test.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/test_pipelinesCreateAndVariablesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from azure_devtools.scenario_tests import AllowLargeResponse
from .utilities.helper import DevopsScenarioTest, disable_telemetry, set_authentication, get_test_org_from_env_variable

DEVOPS_CLI_TEST_ORGANIZATION = get_test_org_from_env_variable() or 'Https://dev.azure.com/azuredevopsclitest'
DEVOPS_CLI_TEST_ORGANIZATION = get_test_org_from_env_variable() or 'Https://dev.azure.com/devops-cli-test-org'

class PipelinesTests(DevopsScenarioTest):
@AllowLargeResponse(size_kb=3072)
Expand All @@ -34,7 +34,7 @@ def test_pipeline_create_and_variables_test(self):
created_repo_name = list_repo_output[0]["name"]

# Import repo with yaml file
import_repo_command = 'az repos import create --git-source-url https://dev.azure.com/AzureDevOpsCliTest/ImportRepoTest/_git/snakes-and-ladders --repository ' + created_repo_id + ' --detect false --output json'
import_repo_command = 'az repos import create --git-source-url https://dev.azure.com/devops-cli-test-org/TestSupportProject/_git/snakes-and-ladders --repository ' + created_repo_id + ' --detect false --output json'
import_repo_output = self.cmd(import_repo_command).get_output_in_json()
import_repo_status = import_repo_output["status"]
assert import_repo_status == 'completed'
Expand All @@ -43,7 +43,7 @@ def test_pipeline_create_and_variables_test(self):
PIPELINE_NAME = 'ContosoBuild'
PIPELINE_DESCRIPTION = 'Pipeline for contoso project'
pipeline_create_command = 'az pipelines create --name {} --description "{}" --repository {} \
--repository-type tfsgit --branch master --yml-path azure-pipelines.yml --detect false \
--repository-type tfsgit --branch main --yml-path azure-pipelines.yml --detect false \
--output json'.format(PIPELINE_NAME, PIPELINE_DESCRIPTION, created_repo_name)
pipeline_create_output = self.cmd(pipeline_create_command).get_output_in_json()
created_pipeline_id = pipeline_create_output['definition']['id']
Expand Down

0 comments on commit 8cb419b

Please sign in to comment.