Skip to content

Commit 8238d7a

Browse files
committed
Merge branch 'develop' of github.com:Scalr/go-scalr into feature/SCALRCORE-24861
2 parents 78d2f06 + f41c1e3 commit 8238d7a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

workspace.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ type WorkspaceListOptions struct {
152152

153153
// WorkspaceRunScheduleOptions represents option for setting run schedules for workspace
154154
type WorkspaceRunScheduleOptions struct {
155-
ApplySchedule string `json:"apply-schedule"`
156-
DestroySchedule string `json:"destroy-schedule"`
155+
ApplySchedule *string `json:"apply-schedule"`
156+
DestroySchedule *string `json:"destroy-schedule"`
157157
}
158158

159159
// List all the workspaces within an environment.

workspace_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,11 @@ func TestWorkspacesSetSchedule(t *testing.T) {
481481
wTest, _ := createWorkspace(t, client, envTest)
482482

483483
t.Run("with valid options", func(t *testing.T) {
484+
applySchedule := "30 3 5 3-5 2"
485+
destroySchedule := "31 5 5 3-5 2"
484486
options := WorkspaceRunScheduleOptions{
485-
ApplySchedule: "30 3 5 3-5 2",
486-
DestroySchedule: "30 5 5 3-5 2",
487+
ApplySchedule: &applySchedule,
488+
DestroySchedule: &destroySchedule,
487489
}
488490

489491
w, err := client.Workspaces.SetSchedule(ctx, wTest.ID, options)
@@ -497,14 +499,15 @@ func TestWorkspacesSetSchedule(t *testing.T) {
497499
w,
498500
refreshed,
499501
} {
500-
assert.Equal(t, options.ApplySchedule, item.ApplySchedule)
501-
assert.Equal(t, options.DestroySchedule, item.DestroySchedule)
502+
assert.Equal(t, applySchedule, item.ApplySchedule)
503+
assert.Equal(t, destroySchedule, item.DestroySchedule)
502504
}
503505
})
504506

505507
t.Run("when an error is returned from the api", func(t *testing.T) {
508+
applySchedule := "bla-bla-bla"
506509
w, err := client.Workspaces.SetSchedule(ctx, wTest.ID, WorkspaceRunScheduleOptions{
507-
ApplySchedule: "bla-bla-bla",
510+
ApplySchedule: &applySchedule,
508511
})
509512
assert.Nil(t, w)
510513
assert.Error(t, err)

0 commit comments

Comments
 (0)