How to run a smoke-test errand manually on TAS and Isolation Segment
search cancel

How to run a smoke-test errand manually on TAS and Isolation Segment

book

Article ID: 298420

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

The smoke-test is a set of commands that setup and deploy an app, org and space on the environment, get app logs and stats to ensure basic functionality of the platform is working as expected. Sometimes the smoke-test fails and it can be useful to run the steps manually to find the point of failure. 

Environment

Product Version: 2.13

Resolution

To run the smoke-test manually, there are a few simple steps to do to setup the environment. Most of the errands on TAS and Isolation Segment are running on the clock_global vm, in particular the smoke-test errand. 
So to run the errand manually ssh into the clock_global vm:

bosh -d cf-a9eaa91d4bbbca8a09a ssh clock_global/0

The smoke-test directories are located at /var/vcap/packages/smoke-tests/ and /var/vcap/jobs/smoke-tests/
First setup the environment to be able to run the errand. This requires an export of the following environmental variables. Those can be found at /var/vcap/jobs/smoke_tests/bin# cat test

# Put GoLang dependancy binaries in PATH
export GOROOT=$(readlink -nf /var/vcap/packages/golang-1.17-linux)
export PATH=${GOROOT}/bin:${PATH}

# Enable GoLang Module support
export GO111MODULE=on

# Put the CF CLI on the PATH
export PATH=/var/vcap/packages/cf7-cli-linux:${PATH}

Next step is to get the smoke-test user credentials to login into the api. The login credentials for the smoke-test user are located in /var/vcap/jobs/smoke_tests/config/config.json

clock_global/cae94482-dc06-4fca-9fff-a8ea092cb526:/var/vcap/jobs/smoke_tests/config# cat config.json 
{"foundation": {
    "user": {
      "name": "smoke_tests",
      "password": "J3hGcTa_9#############HAGfdJ"},
    
    "organization": "system",

    "api": "https://api.run-##.####-##.tanzu-###-####.######.com", 
    "apps_domain": "cfapps-##.####-##.tanzu-###-####.#####.com",
    "skip_ssl_validation": false  }}

Login to the api to run the cf commands to run the test steps (replacing with the values from above step):

cf login -a api.example.com -u smoke_tests -p PASSWORD -o system -s system --skip-ssl-validation

In errand config page, you can specify what space and org this app will be created in, as it is mentioned here. https://techdocs.broadcom.com/us/en/vmware-tanzu/platform/tanzu-platform-for-cloud-foundry/4-0/tpcf/configure-pas-contd.html

If there is no preference, we can use the system space and org for the test. Otherwise, you will need to create a specified space and org: cf create-space SPACE  and cf create-org ORG (https://cli.cloudfoundry.org/en-US/v7/create-space.html & https://cli.cloudfoundry.org/en-US/v7/create-org.html).

Every time the errand is run, it creates a new app manifest. This manifest is then stored in the directory  /var/vcap/data/smoke_tests/tmp/ . You can chose any of the manifests to create an app from it. 

To check what exactly the smoke test does, open the file /var/vcap/packages/smoke-tests/src/base_test.go for TAS smoke-test and /var/vcap/packages/smoke-tests/src/isolation_segment_test.go for Isolation Segment smoke-test. 

The command to run the smoke-test manually for TAS is:

cf7 push SMOKES-APP-b19c7f4a-a35d -b ruby_buildpack -p /var/vcap/packages/smoke-tests/src/assets/ruby_simple
 -f /var/vcap/data/smoke_tests/tmp/runtime-manifest-102317142.yml

The command to run the smoke-test manually for Isolation Segment is:

cf7 push SMOKES-APP-b19c7f4a-a35d -b ruby_buildpack -p /var/vcap/packages/smoke-tests/src/assets/ruby_simple
 -f /var/vcap/data/smoke_tests_isolation/tmp/runtime-manifest-102317142.yml

Note: app name can be anything, and the manifest file can be named differently in your environment.
Once app is successfully deployed, you can then run commands like cf scale, cf logs, cf map-route etc to manipulate the app and test the functionality.