Skip to content

Commit 00065fd

Browse files
SYN-4581: add optional timezone field, this is required for recurring downtime configurations (#35)
1 parent bf725f7 commit 00065fd

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

syntheticsclientv2/common_models.go

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ type DowntimeConfiguration struct {
229229
Testcount int `json:"testCount,omitempty"`
230230
Testids []int `json:"testIds,omitempty"`
231231
Recurrence *Recurrence `json:"recurrence"`
232+
Timezone *string `json:"timezone,omitempty"`
232233
}
233234

234235
type DeleteCheck struct {

syntheticsclientv2/create_downtimeconfigurationv2_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
var (
29-
createDowntimeConfigurationV2Body = `{"downtimeConfiguration":{"name":"dc test","description":"My super awesome test downtimeConfiguration","rule":"augment_data","testIds":[482],"startTime":"2024-05-16T20:23:00.000Z","endTime":"2024-05-16T20:38:00.000Z","recurrence":{"repeats":{"type":"daily"},"end":{"type":"after","value":"10"}}}}`
29+
createDowntimeConfigurationV2Body = `{"downtimeConfiguration":{"name":"dc test","description":"My super awesome test downtimeConfiguration","rule":"augment_data","testIds":[482],"startTime":"2024-05-16T20:23:00.000Z","endTime":"2024-05-16T20:38:00.000Z","timezone":"UTC","recurrence":{"repeats":{"type":"daily"},"end":{"type":"after","value":"10"}}}}`
3030
inputDowntimeConfigurationV2Data = DowntimeConfigurationV2Input{}
3131
)
3232

@@ -83,4 +83,8 @@ func TestCreateDowntimeConfigurationV2(t *testing.T) {
8383
t.Errorf("returned \n\n%#v want \n\n%#v", resp.DowntimeConfiguration.Recurrence, inputDowntimeConfigurationV2Data.DowntimeConfiguration.Recurrence)
8484
}
8585

86+
if !reflect.DeepEqual(resp.DowntimeConfiguration.Timezone, inputDowntimeConfigurationV2Data.DowntimeConfiguration.Timezone) {
87+
t.Errorf("returned \n\n%#v want \n\n%#v", resp.DowntimeConfiguration.Timezone, inputDowntimeConfigurationV2Data.DowntimeConfiguration.Timezone)
88+
}
89+
8690
}

syntheticsclientv2/get_downtimeconfigurationsv2_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import (
2727
var (
2828
getDowntimeConfigurationsV2Body = `{"page":1,"perPage":50}`
2929
inputGetDowntimeConfigurationsV2 = verifyDowntimeConfigurationsV2Input(string(getDowntimeConfigurationsV2Body))
30-
getDowntimeConfigurationsV2Output = `{"downtimeConfigurations":[{"id":1,"name":"dc test","description":"My super awesome test downtimeConfiguration","rule":"pause_tests","startTime":"2024-05-16T20:23:00.000Z","endTime":"2024-05-16T20:38:00.000Z","status":"scheduled","createdAt":"2024-05-15T20:24:07.541Z","updatedAt":"2024-05-15T20:25:44.211Z","testsUpdatedAt":"2024-05-15T20:24:07.541Z","testCount":1,"recurrence":{"repeats":{"type":"daily"},"end":{"type":"after","value":"10"}}}],"page":1,"pageLimit":1,"totalCount":1}`
30+
getDowntimeConfigurationsV2Output = `{"downtimeConfigurations":[{"id":1,"name":"dc test","description":"My super awesome test downtimeConfiguration","rule":"pause_tests","startTime":"2024-05-16T20:23:00.000Z","endTime":"2024-05-16T20:38:00.000Z","status":"scheduled","createdAt":"2024-05-15T20:24:07.541Z","updatedAt":"2024-05-15T20:25:44.211Z","testsUpdatedAt":"2024-05-15T20:24:07.541Z","testCount":1,"timezone":"UTC","recurrence":{"repeats":{"type":"daily"},"end":{"type":"after","value":"10"}}}],"page":1,"pageLimit":1,"totalCount":1}`
3131
downtimeConfigurationsV2Output = &DowntimeConfigurationsV2Response{}
32-
getDowntimeConfigurationV2Body = `{"downtimeConfiguration":{"id":1,"name":"dc test","description":"My super awesome test downtimeConfiguration","rule":"pause_tests","startTime":"2024-05-16T20:23:00.000Z","endTime":"2024-05-16T20:38:00.000Z","status":"scheduled","createdAt":"2024-05-15T20:24:07.541Z","updatedAt":"2024-05-15T20:25:44.211Z","testsUpdatedAt":"2024-05-15T20:24:07.541Z","testIds":[29976],"recurrence":{"repeats":{"type":"daily"},"end":{"type":"after","value":"10"}}}}`
32+
getDowntimeConfigurationV2Body = `{"downtimeConfiguration":{"id":1,"name":"dc test","description":"My super awesome test downtimeConfiguration","rule":"pause_tests","startTime":"2024-05-16T20:23:00.000Z","endTime":"2024-05-16T20:38:00.000Z","status":"scheduled","createdAt":"2024-05-15T20:24:07.541Z","updatedAt":"2024-05-15T20:25:44.211Z","testsUpdatedAt":"2024-05-15T20:24:07.541Z","testIds":[29976],"timezone":"UTC","recurrence":{"repeats":{"type":"daily"},"end":{"type":"after","value":"10"}}}}`
3333
inputGetDowntimeConfigurationV2 = verifyDowntimeConfigurationV2Input(string(getDowntimeConfigurationV2Body))
3434
)
3535

@@ -94,6 +94,10 @@ func TestGetDowntimeConfigurationV2(t *testing.T) {
9494
t.Errorf("returned \n\n%#v want \n\n%#v", resp.DowntimeConfiguration.Recurrence, inputGetDowntimeConfigurationV2.DowntimeConfiguration.Recurrence)
9595
}
9696

97+
if !reflect.DeepEqual(resp.DowntimeConfiguration.Timezone, inputGetDowntimeConfigurationV2.DowntimeConfiguration.Timezone) {
98+
t.Errorf("returned \n\n%#v want \n\n%#v", resp.DowntimeConfiguration.Timezone, inputGetDowntimeConfigurationV2.DowntimeConfiguration.Timezone)
99+
}
100+
97101
}
98102

99103
func verifyDowntimeConfigurationV2Input(stringInput string) *DowntimeConfigurationV2Response {

0 commit comments

Comments
 (0)