Skip to content

Commit

Permalink
Create user_resource in e2e tests (#1952)
Browse files Browse the repository at this point in the history
* Create user_resource in e2e tests

* Testing user Resource

* Purge Protection

* Added guacamole-azure-windowsvm fpr e2e

* Register the Windows VM
  • Loading branch information
ross-p-smith authored Jun 8, 2022
1 parent 25a8e1d commit 3753da1
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ prepare-for-e2e:
&& $(call shared_service_bundle,sonatype-nexus) \
&& $(call shared_service_bundle,gitea) \
&& $(call user_resource_bundle,guacamole,guacamole-dev-vm)
&& $(call user_resource_bundle,guacamole,guacamole-azure-windowsvm)

test-e2e-smoke:
$(call target_title, "Running E2E smoke tests") && \
Expand Down
26 changes: 26 additions & 0 deletions e2e_tests/test_workspace_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ async def test_create_guacamole_service_into_base_workspace(admin_token, verify)

await post_resource(patch_payload, f'/api{workspace_service_path}', workspace_owner_token, verify, method="PATCH")

user_resource_payload = {
"templateName": "tre-service-guacamole-windowsvm",
"properties": {
"display_name": "My VM",
"description": "Will be using this VM for my research",
"os_image": "Windows 10"
}
}

user_resource_path, user_resource_id = await post_resource(user_resource_payload, f'/api{workspace_service_path}/{strings.API_USER_RESOURCES}', workspace_owner_token, verify, method="POST")

await disable_and_delete_resource(f'/api{user_resource_path}', workspace_owner_token, verify)

await disable_and_delete_resource(f'/api{workspace_service_path}', workspace_owner_token, verify)

await disable_and_delete_resource(f'/api{workspace_path}', admin_token, verify)
Expand Down Expand Up @@ -97,6 +110,19 @@ async def test_create_guacamole_service_into_aad_workspace(admin_token, verify)

await post_resource(patch_payload, f'/api{workspace_service_path}', workspace_owner_token, verify, method="PATCH")

user_resource_payload = {
"templateName": "tre-service-guacamole-windowsvm",
"properties": {
"display_name": "My VM",
"description": "Will be using this VM for my research",
"os_image": "Windows 10"
}
}

user_resource_path, user_resource_id = await post_resource(user_resource_payload, f'/api{workspace_service_path}/{strings.API_USER_RESOURCES}', workspace_owner_token, verify, method="POST")

await disable_and_delete_resource(f'/api{user_resource_path}', workspace_owner_token, verify)

await disable_and_delete_resource(f'/api{workspace_service_path}', workspace_owner_token, verify)

await disable_and_delete_resource(f'/api{workspace_path}', admin_token, verify)
2 changes: 2 additions & 0 deletions templates/core/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ TRE_ADDRESS_SPACE="10.0.0.0/12"
DEPLOY_GITEA=true
DEPLOY_NEXUS=true
RESOURCE_PROCESSOR_TYPE="vmss_porter"
API_APP_SERVICE_PLAN_SKU_SIZE="P1v2"
APP_SERVICE_PLAN_SKU="P1v2"

# Auth configuration
# If you would like the workspace bundle to also create the AAD Workspace application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@ terraform {
}
}


provider "azurerm" {
features {}
features {
key_vault {
# Don't purge on destroy (this would fail due to purge protection being enabled on keyvault)
purge_soft_delete_on_destroy = false
purge_soft_deleted_secrets_on_destroy = false
purge_soft_deleted_certificates_on_destroy = false
purge_soft_deleted_keys_on_destroy = false
# When recreating an environment, recover any previously soft deleted secrets - set to true by default
recover_soft_deleted_key_vaults = true
recover_soft_deleted_secrets = true
recover_soft_deleted_certificates = true
recover_soft_deleted_keys = true
}
}
}

data "azurerm_client_config" "current" {}
Expand Down

0 comments on commit 3753da1

Please sign in to comment.