Skip to content

Files

automation

Quickstart: running integration tests locally on Mac/Docker

Set Up

For Azure tests:

  • Create a new BEE with the swatomation template
  • Create a new billing project on you BEE
  • Create a new workspace
  • Find the appropriate comment in beforeAll within AzureBillingBeforeAndAfter to override the billing project
  • Find the appropriate comment in withRawlsWorkspace to override the workspace

Run this command on the VPN to generate you application.conf file

BEE_NAME=[Your BEE instance name] ./render-local-env.sh [branch of firecloud-automated-testing] [vault token] [env] [service root]

Arguments: (arguments are positional)

  • branch of firecloud-automated-testing
    • Configs branch; defaults to master
  • Vault auth token
    • Defaults to reading it from the .vault-token via $(cat ~/.vault-token).
  • env
    • Environment of your BEE; defaults to dev
  • service root
    • the name of your local clone of leonardo if not leonardo

Run tests (GCP)

sbt -Djsse.enableSNIExtension=false -Dheadless=false "project automation" test

IntelliJ

  • Edit Configurations -> Defaults -> ScalaTest
  • set VM parameters -Djsse.enableSNIExtension=false -Dheadless=false
  • set Working dir to local dir
  • use classpath and SDK of the leonardoTests (automation) module
  • IntelliJ -> Preferences -> Build, Execution, Deployment -> Build Tools -> sbt: Check the two boxes next to Use sbt shell
  • should be able to right-click-run on the particular test
  • If you get an error like selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 75, download the chrome driver from https://sites.google.com/a/chromium.org/chromedriver/downloads that has the same version of your local chrome. Update chromeSettings.chromedriverPath in application.conf to the new chrome driver that you just downloaded

Note: If the test you're trying to run is annotated with @DoNotDiscover, do the following for running the individual test

  • Comment out @DoNotDiscover of the test you are running
  • Have Spec extend NewBillingProjectAndWorkspaceBeforeAndAfterAll directly or indirectly:
    • If the Spec extends ClusterFixtureSpec/RuntimeFixtureSpec, add with NewBillingProjectAndWorkspaceBeforeAndAfterAll to ClusterFixtureSpec/RuntimeFixtureSpec.
    • If not, add with NewBillingProjectAndWorkspaceBeforeAndAfterAll to the Spec directly.

Run tests (Azure)

  • Check that all sections of application.conf have the proper bee/terra URLS. For example, for a bee named jc-bee-10:
fireCloud {
  baseUrl = "https://firecloud.jc-bee-10.bee.envs-terra.bio/"
  orchApiUrl = "https://firecloudorch.jc-bee-10.bee.envs-terra.bio/"


  orchApiUrl = "https://firecloudorch.jc-bee-10.bee.envs-terra.bio/"
  rawlsApiUrl = "https://rawls.jc-bee-10.bee.envs-terra.bio/"
  samApiUrl = "https://sam.jc-bee-10.bee.envs-terra.bio/"
  thurloeApiUrl = "https://thurloe.jc-bee-10.bee.envs-terra.bio/"

  fireCloudId = "4c717998-7442-11e6-8b77-86f30ca893d3"

  # TODO more Config class nonsense
  tcgaAuthDomain = “TCGA-dbGaP-Authorized”


  gpAllocApiUrl = "https://gpalloc-qa.dsp-techops.broadinstitute.org/api/"

}

leonardo {

  apiUrl = "https://leonardo.jc-bee-10.bee.envs-terra.bio/"

  notebooksServiceAccountEmail = "leonardo-qa@broad-dsde-qa.iam.gserviceaccount.com"

}

azure {
	leoVmUser = See output of `vault read secret/dsde/terra/azure/qa/leonardo/azure-vm-credential`
	leoVmPassword = See output of `vault read secret/dsde/terra/azure/qa/leonardo/azure-vm-credential`
}

Then, tests can be run via sbt "project automation" "testOnly -s org.broadinstitute.dsde.workbench.leonardo.LeonardoAzureSuite" If you want to test a specific test, you can comment out the other tests here:

final class LeonardoAzureSuite
	extends Suites(
		new AzureRuntimeSpec,
		new AzureDiskSpec,
		new AzureAutopauseSpec
	)

If the test fails with some intermediate resources remaining:

  • Be sure to check the staticTestingMrg in the azure portal periodically to ensure you are not leaking resources when testing
  • It may be helpful to clean up your BEE's leonardo DB since only one runtime can exist per workspace. You can find instructions to get shell mysql access to your BEE in the leonardo handbook.
    • Once you have shell access to your BEE's leonardo mysql, run the following to delete all Leo runtime records: DELETE FROM CLUSTER_ERROR WHERE 1=1; DELETE FROM CLUSTER_IMAGE WHERE 1=1; DELETE FROM RUNTIME_CONTROLLED_RESOURCE WHERE 1=1; DELETE FROM CLUSTER WHERE 1=1; DELETE FROM RUNTIME_CONFIG WHERE 1=1; DELETE FROM PERSISTENT_DISK WHERE 1=1;

To get any tests working with the ssh tunnel, you will need to run the following commands. Note that the argument after -s is the subscription ID and can be found in the Azure Portal under the static managed resource group.

az login --service-principal -u $(vault read -field=client-id secret/dsde/terra/azure/qa/leonardo/managed-app-publisher) -p "$(vault read -field=client-secret secret/dsde/terra/azure/qa/leonardo/managed-app-publisher)" -t $(vault read -field=tenant-id secret/dsde/terra/azure/qa/leonardo/managed-app-publisher)
az account set -s "f557c728-871d-408c-a28b-eb6b2141a087"