Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Setting up environment variables for running xplat cli tests

xuezhai edited this page Feb 11, 2015 · 22 revisions

Azure Account Setup

Launch cmd console as admin at your test-directory/azure-xplat-cli, at the cmd console, run the following for environment setup:

set AZURE_GITHUB_PASSWORD=github password/access token
set AZURE_GITHUB_REPOSITORY=username/reponame
set AZURE_GITHUB_USERNAME=github_username
set AZURE_GIT_USERNAME=git_username
set AZURE_ARM_TEST_STORAGEACCOUNT=storage_account_name_created_in_the_subscription
set AZURE_ARM_TEST_LOCATION=South Central US
set AZURE_STORAGE_TEST_LOCATION=West US
set AZURE_STORAGE_ACCESS_KEY=access-key_of_the_storage_account
set AZURE_STORAGE_ACCOUNT=storage_account_name_created_in_the_subscription
set AZURE_SITE_TEST_LOCATION=West US
set AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=storage_account;AccountKey=access_key
set AZURE_SCM_SITE_SUFFIX=.scm.azurewebsites.net
set AZURE_AD_TEST_PASSWORD=your_password

Note: Not all tests require all these environment variables, and if a required one is not set the test will fail and tell you which ones need to be set.

Running against Live Server

To run the tests against Live environment set the following environment variable

set NOCK_OFF=true 

Running tests Mocked

To run the tests mocked unset the following environment variable, if it is previously set

set NOCK_OFF= 

Record HTTP Traffic to run mock tests later

To record the live HTTP traffic, so as to run mocks later set the following environment variable

set AZURE_NOCK_RECORD=true

The recordings will get saved in azure-xplat-cli/test/recordings directory

Running VM Tests

set AZURE_COMMUNITY_IMAGE_ID=vmdepot-40432-1-1 (Select any Image ID from deployment script of any image selected from https://vmdepot.msopentech.com)
set AZURE_STORAGE_ACCESS_KEY=storage account access key
set AZURE_STORAGE_ACCOUNT=storage account name
set BLOB_SOURCE_PATH=path to the disk in a blob
set SSHCERT=path to the pem file

Partial recordings

If you plan on adding some tests / features and do not need to regenerate the full set of test recordings, you can open the file: tests/testlist.txt and comment out the tests you do not wish to run during the recording process.

To do so, use a leading # character. i.e.:

# commands/cli.cloudservice-tests.js
# commands/cli.deployment-tests.js
commands/cli.site-tests.js
# commands/cli.site.appsetting-tests

In the above example only the cli.site-tests.js tests would be run.