Skip to content

Commit

Permalink
refactor cli usage in tests (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbloss authored Oct 22, 2024
1 parent 0335823 commit 1b5d91e
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 59 deletions.
5 changes: 2 additions & 3 deletions tests/check_alert_source_usage.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,11 @@ run "resource_check_alert_source_usage_unset_optional_fields" {
run "delete_check_alert_source_usage_outside_of_terraform" {

variables {
resource_id = run.resource_check_alert_source_usage_create_with_all_fields.this.id
resource_type = "check"
command = "delete check ${run.resource_check_alert_source_usage_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/check_git_branch_protection.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,11 @@ run "resource_check_git_branch_protection_update_unset_optional_fields" {
run "delete_check_alert_source_usage_outside_of_terraform" {

variables {
resource_id = run.resource_check_git_branch_protection_create_with_all_fields.this.id
resource_type = "check"
command = "delete check ${run.resource_check_git_branch_protection_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/check_has_documentation.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,11 @@ run "resource_check_has_documentation_unset_optional_fields" {
run "delete_check_has_documentation_outside_of_terraform" {

variables {
resource_id = run.resource_check_has_documentation_create_with_all_fields.this.id
resource_type = "check"
command = "delete check ${run.resource_check_has_documentation_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 5 additions & 0 deletions tests/cli/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "terraform_data" "opslevel_cli" {
provisioner "local-exec" {
command = "opslevel ${var.command}"
}
}
4 changes: 4 additions & 0 deletions tests/cli/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "command" {
type = string
description = "OpsLevel CLI command to run - everything after 'opslevel'"
}
File renamed without changes.
5 changes: 2 additions & 3 deletions tests/domain.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,11 @@ run "resource_domain_unset_optional_fields" {
run "delete_domain_outside_of_terraform" {

variables {
resource_id = run.resource_domain_create_with_all_fields.this.id
resource_type = "domain"
command = "delete domain ${run.resource_domain_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/integration_aws.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,11 @@ run "resource_integration_aws_unset_optional_fields" {
run "delete_aws_integration_outside_of_terraform" {

variables {
resource_id = run.resource_integration_aws_create_with_all_fields.this.id
resource_type = "integration"
command = "delete integration ${run.resource_integration_aws_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/integration_azure_resources.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,11 @@ run "resource_integration_azure_unset_optional_fields" {
run "delete_azure_integration_outside_of_terraform" {

variables {
resource_id = run.resource_integration_azure_create_with_all_fields.this.id
resource_type = "integration"
command = "delete integration ${run.resource_integration_azure_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/integration_google_cloud.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,11 @@ run "resource_integration_google_cloud_unset_optional_fields" {
run "delete_google_cloud_integration_outside_of_terraform" {

variables {
resource_id = run.resource_integration_google_cloud_create_with_all_fields.this.id
resource_type = "integration"
command = "delete integration ${run.resource_integration_google_cloud_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 0 additions & 5 deletions tests/provisioner/main.tf

This file was deleted.

9 changes: 0 additions & 9 deletions tests/provisioner/variables.tf

This file was deleted.

5 changes: 2 additions & 3 deletions tests/rubric_category.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ run "resource_rubric_category_create_with_all_fields" {
run "delete_rubric_category_outside_of_terraform" {

variables {
resource_id = run.resource_rubric_category_create_with_all_fields.this.id
resource_type = "category"
command = "delete category ${run.resource_rubric_category_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/rubric_level.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ run "resource_rubric_level_update_unset_optional_fields" {
run "delete_rubric_level_outside_of_terraform" {

variables {
resource_id = run.resource_rubric_level_create_with_all_fields.this.id
resource_type = "level"
command = "delete level ${run.resource_rubric_level_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/scorecard.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,11 @@ run "resource_scorecard_unset_optional_fields" {
run "delete_scorecard_outside_of_terraform" {

variables {
resource_id = run.resource_scorecard_create_with_all_fields.this.id
resource_type = "scorecard"
command = "delete scorecard ${run.resource_scorecard_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/secret.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,11 @@ run "resource_secret_replaced_by_alias_update" {
run "delete_secret_outside_of_terraform" {

variables {
resource_id = run.resource_secret_replaced_by_alias_update.this.id
resource_type = "secret"
command = "delete secret ${run.resource_secret_replaced_by_alias_update.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}

}
Expand Down
5 changes: 2 additions & 3 deletions tests/system.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,11 @@ run "resource_sytem_unset_optional_fields" {
run "delete_system_outside_of_terraform" {

variables {
resource_id = run.resource_system_create_with_all_fields.this.id
resource_type = "system"
command = "delete system ${run.resource_system_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/team.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,11 @@ run "resource_team_unset_optional_fields" {
run "delete_team_outside_of_terraform" {

variables {
resource_id = run.resource_team_create_with_all_fields.this.id
resource_type = "team"
command = "delete team ${run.resource_team_create_with_all_fields.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/team_contact.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ run "resource_team_contact_create_slack_channel" {
run "delete_team_contact_outside_of_terraform" {

variables {
resource_id = run.resource_team_contact_create_slack_channel.this.id
resource_type = "contact"
command = "delete contact ${run.resource_team_contact_create_slack_channel.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down
5 changes: 2 additions & 3 deletions tests/team_tag.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,11 @@ run "resource_team_tag_unset_id_set_alias" {
run "delete_team_tag_outside_of_terraform" {

variables {
resource_id = run.resource_team_tag_unset_id_set_alias.this.id
resource_type = "tag"
command = "delete tag ${run.resource_team_tag_unset_id_set_alias.this.id}"
}

module {
source = "./provisioner"
source = "./cli"
}
}

Expand Down

0 comments on commit 1b5d91e

Please sign in to comment.