Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 93a1ee0

Browse files
authored
fix: update octopus go client to populate script syntax and body (#866)
1 parent 8fdbab1 commit 93a1ee0

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22
55
toolchain go1.22.3
66

77
require (
8-
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.64.0
8+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.64.2
99
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20241206032352-dbc62b2d16cf
1010
github.com/google/uuid v1.6.0
1111
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ github.com/OctopusDeploy/go-octodiff v1.0.0 h1:U+ORg6azniwwYo+O44giOw6TiD5USk8S4
2020
github.com/OctopusDeploy/go-octodiff v1.0.0/go.mod h1:Mze0+EkOWTgTmi8++fyUc6r0aLZT7qD9gX+31t8MmIU=
2121
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.64.0 h1:NWqQ/7JLUfEJQ8QHrkek7AfePuN121+f6+tUi3xP6vE=
2222
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.64.0/go.mod h1:ggvOXzMnq+w0pLg6C9zdjz6YBaHfO3B3tqmmB7JQdaw=
23+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.64.2 h1:soRQnNPMLFiTm8tSH6fx3znFvTYOyGnTFYPAfpJH9e0=
24+
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.64.2/go.mod h1:ggvOXzMnq+w0pLg6C9zdjz6YBaHfO3B3tqmmB7JQdaw=
2325
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20241206032352-dbc62b2d16cf h1:wuUJ6DbSZEHE4a3SfSJIcoeTQCSI6lbQ+i46ibY14+Q=
2426
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20241206032352-dbc62b2d16cf/go.mod h1:xVv8DvYhhwxtQUQQDfOYA6CY8KTkHXccxQ2RfRj6IJ0=
2527
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg=

octopusdeploy_framework/resource_script_module_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ package octopusdeploy_framework
22

33
import (
44
"fmt"
5+
"path/filepath"
6+
"testing"
7+
8+
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/scriptmodules"
59
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/variables"
610
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/octoclient"
711
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/test"
812
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
913
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1014
"github.com/hashicorp/terraform-plugin-testing/terraform"
11-
"path/filepath"
12-
"testing"
1315
)
1416

1517
func TestAccOctopusDeployScriptModuleBasic(t *testing.T) {
@@ -102,7 +104,7 @@ func TestScriptModuleResource(t *testing.T) {
102104
Take: 1,
103105
}
104106

105-
resources, err := client.LibraryVariableSets.Get(query)
107+
resources, err := scriptmodules.Get(client, newSpaceId, query)
106108
if err != nil {
107109
t.Fatal(err.Error())
108110
}
@@ -116,6 +118,14 @@ func TestScriptModuleResource(t *testing.T) {
116118
t.Fatal("The library variable set must be have a description of \"Test script module\" (was \"" + resource.Description + "\")")
117119
}
118120

121+
if resource.Syntax != "PowerShell" {
122+
t.Fatal("The script module must have a syntax of \"PowerShell\" (was \"" + resource.Syntax + "\")")
123+
}
124+
125+
if resource.ScriptBody != "echo \"hi\"" {
126+
t.Fatal("The script module must have a script body of \"echo \"hi\"\" (was \"" + resource.ScriptBody + "\")")
127+
}
128+
119129
variables, err := client.Variables.GetAll(resource.ID)
120130

121131
if len(variables.Variables) != 2 {

0 commit comments

Comments
 (0)