Skip to content

Commit

Permalink
Revert "add test for variable scoping"
Browse files Browse the repository at this point in the history
This reverts commit ce83912.
  • Loading branch information
tleed5 committed Jan 10, 2024
1 parent fb25578 commit b694231
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions octopusdeploy/resource_variable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ func TestAccOctopusDeployVariableBasic(t *testing.T) {
projectGroupName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
projectLocalName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
projectName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
deploymentProcessLocalName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
deploymentProcessName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)

// TODO: replace with client reference
spaceID := os.Getenv("OCTOPUS_SPACE")
Expand All @@ -58,7 +56,7 @@ func TestAccOctopusDeployVariableBasic(t *testing.T) {
resource.TestCheckResourceAttr(prefix, "scope.0.%", "6"),
resource.TestCheckResourceAttr(prefix, "scope.0.environments.#", "1"),
),
Config: testVariableBasic(spaceID, environmentLocalName, environmentName, lifecycleLocalName, lifecycleName, projectGroupLocalName, projectGroupName, projectLocalName, projectName, deploymentProcessLocalName, deploymentProcessName, channelLocalName, channelName, localName, name, description, isSensitive, value, variableType),
Config: testVariableBasic(spaceID, environmentLocalName, environmentName, lifecycleLocalName, lifecycleName, projectGroupLocalName, projectGroupName, projectLocalName, projectName, channelLocalName, channelName, localName, name, description, isSensitive, value, variableType),
},
{
Check: resource.ComposeTestCheckFunc(
Expand All @@ -72,7 +70,7 @@ func TestAccOctopusDeployVariableBasic(t *testing.T) {
resource.TestCheckResourceAttr(prefix, "scope.0.%", "6"),
resource.TestCheckResourceAttr(prefix, "scope.0.environments.#", "1"),
),
Config: testVariableBasic(spaceID, environmentLocalName, environmentName, lifecycleLocalName, lifecycleName, projectGroupLocalName, projectGroupName, projectLocalName, projectName, deploymentProcessLocalName, deploymentProcessName, channelLocalName, channelName, localName, name, description, isSensitive, newValue, variableType),
Config: testVariableBasic(spaceID, environmentLocalName, environmentName, lifecycleLocalName, lifecycleName, projectGroupLocalName, projectGroupName, projectLocalName, projectName, channelLocalName, channelName, localName, name, description, isSensitive, newValue, variableType),
},
{
Check: resource.ComposeTestCheckFunc(
Expand All @@ -90,15 +88,15 @@ func TestAccOctopusDeployVariableBasic(t *testing.T) {
%s`,
testGcpAccount(localName, name, acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)),
testVariableBasic(spaceID, environmentLocalName, environmentName, lifecycleLocalName, lifecycleName, projectGroupLocalName, projectGroupName, projectLocalName, projectName, deploymentProcessLocalName, deploymentProcessName, channelLocalName, channelName, localName, name, description, isSensitive, accountValue, accountVariableType)),
testVariableBasic(spaceID, environmentLocalName, environmentName, lifecycleLocalName, lifecycleName, projectGroupLocalName, projectGroupName, projectLocalName, projectName, channelLocalName, channelName, localName, name, description, isSensitive, accountValue, accountVariableType)),
},
},
})
}

func testVariableBasic(spaceID string, environmentLocalName string,
environmentName string,
lifecycleLocalName string, lifecycleName string, projectGroupLocalName string, projectGroupName string, projectLocalName string, projectName string, deploymentProcessLocalName string, deploymentProcessName string, channelLocalName string, channelName string, localName string, name string, description string, isSensitive bool, value string, variableType string) string {
lifecycleLocalName string, lifecycleName string, projectGroupLocalName string, projectGroupName string, projectLocalName string, projectName string, channelLocalName string, channelName string, localName string, name string, description string, isSensitive bool, value string, variableType string) string {
return fmt.Sprintf(`%s
%s
Expand All @@ -109,8 +107,6 @@ func testVariableBasic(spaceID string, environmentLocalName string,
%s
%s
resource "octopusdeploy_variable" "%s" {
description = "%s"
is_sensitive = "%v"
Expand All @@ -122,15 +118,13 @@ func testVariableBasic(spaceID string, environmentLocalName string,
scope {
channels = [octopusdeploy_channel.%s.id]
environments = [octopusdeploy_environment.%s.id]
processes = [octopusdeploy_deployment_process.%s.id]
tenant_tags = []
}
}`,
createEnvironment(environmentLocalName, environmentName),
createLifecycle(lifecycleLocalName, lifecycleName),
createProjectGroup(projectGroupLocalName, projectGroupName),
createProject(spaceID, projectLocalName, projectName, lifecycleLocalName, projectGroupLocalName),
createDeploymentProcess(projectLocalName, spaceID, deploymentProcessLocalName, deploymentProcessName),
createChannel(channelLocalName, channelName, projectLocalName),
localName,
description,
Expand All @@ -141,7 +135,6 @@ func testVariableBasic(spaceID string, environmentLocalName string,
value,
channelLocalName,
environmentLocalName,
deploymentProcessLocalName,
)
}

Expand Down Expand Up @@ -172,14 +165,6 @@ func createProject(spaceID string, localName, name, lifecycleLocal, projectGroup
}`, localName, name, lifecycleLocal, projectGroupLocal, spaceID)
}

func createDeploymentProcess(projectLocalName string, spaceId string, localName, name string) string {
return fmt.Sprintf(`resource "octopusdeploy_deployment_process" "%s" {
name = "%s"
project_id = octopusdeploy_project.%s.id
space_id = "%s"
}`, localName, name, projectLocalName, spaceId)
}

func createChannel(localName, name, projectLocal string) string {
return fmt.Sprintf(`resource "octopusdeploy_channel" "%s" {
name = "%s"
Expand Down

0 comments on commit b694231

Please sign in to comment.