@@ -44,18 +44,12 @@ func TestInstances_List(t *testing.T) {
4444 require .NotNil (t , linode .PlacementGroup .MigratingTo )
4545 assert .Equal (t , 2468 , * linode .PlacementGroup .MigratingTo )
4646 assert .Equal (t , "linode/migrate" , linode .MaintenancePolicy )
47- if linode .Alerts .SystemAlerts != nil {
48- systemAlerts := * linode .Alerts .SystemAlerts
49- if len (systemAlerts ) >= 2 {
50- assert .Equal (t , 123 , systemAlerts [0 ])
51- assert .Equal (t , 456 , systemAlerts [1 ])
52- }
47+ if len (linode .Alerts .SystemAlerts ) >= 2 {
48+ assert .Equal (t , 123 , linode .Alerts .SystemAlerts [0 ])
49+ assert .Equal (t , 456 , linode .Alerts .SystemAlerts [1 ])
5350 }
54- if linode .Alerts .UserAlerts != nil {
55- userAlerts := * linode .Alerts .UserAlerts
56- if len (userAlerts ) > 0 {
57- assert .Equal (t , 555 , userAlerts [0 ])
58- }
51+ if len (linode .Alerts .UserAlerts ) > 0 {
52+ assert .Equal (t , 555 , linode .Alerts .UserAlerts [0 ])
5953 }
6054}
6155
@@ -90,18 +84,12 @@ func TestInstance_Get(t *testing.T) {
9084 assert .Equal (t , "linode/migrate" , instance .MaintenancePolicy )
9185 require .NotNil (t , instance .PlacementGroup .MigratingTo )
9286 assert .Equal (t , 2468 , * instance .PlacementGroup .MigratingTo )
93- if instance .Alerts .SystemAlerts != nil {
94- systemAlerts := * instance .Alerts .SystemAlerts
95- if len (systemAlerts ) >= 2 {
96- assert .Equal (t , 123 , systemAlerts [0 ])
97- assert .Equal (t , 456 , systemAlerts [1 ])
98- }
87+ if len (instance .Alerts .SystemAlerts ) >= 2 {
88+ assert .Equal (t , 123 , instance .Alerts .SystemAlerts [0 ])
89+ assert .Equal (t , 456 , instance .Alerts .SystemAlerts [1 ])
9990 }
100- if instance .Alerts .UserAlerts != nil {
101- userAlerts := * instance .Alerts .UserAlerts
102- if len (userAlerts ) > 0 {
103- assert .Equal (t , 555 , userAlerts [0 ])
104- }
91+ if len (instance .Alerts .UserAlerts ) > 0 {
92+ assert .Equal (t , 555 , instance .Alerts .UserAlerts [0 ])
10593 }
10694}
10795
@@ -207,8 +195,8 @@ func TestInstance_Create(t *testing.T) {
207195 RootPass : "securepassword" ,
208196 MaintenancePolicy : linodego .Pointer ("linode/migrate" ),
209197 Alerts : & linodego.InstanceACLPAlertsOptions {
210- SystemAlerts : linodego . Pointer ( []int {123 , 456 }) ,
211- UserAlerts : linodego . Pointer ( []int {555 }) ,
198+ SystemAlerts : []int {123 , 456 },
199+ UserAlerts : []int {555 },
212200 },
213201 }
214202
@@ -218,18 +206,12 @@ func TestInstance_Create(t *testing.T) {
218206 assert .NoError (t , err )
219207 assert .Equal (t , "new-instance" , instance .Label )
220208 assert .Equal (t , "linode/migrate" , instance .MaintenancePolicy )
221- if instance .Alerts .SystemAlerts != nil {
222- systemAlerts := * instance .Alerts .SystemAlerts
223- if len (systemAlerts ) >= 2 {
224- assert .Equal (t , 123 , systemAlerts [0 ])
225- assert .Equal (t , 456 , systemAlerts [1 ])
226- }
209+ if len (instance .Alerts .SystemAlerts ) >= 2 {
210+ assert .Equal (t , 123 , instance .Alerts .SystemAlerts [0 ])
211+ assert .Equal (t , 456 , instance .Alerts .SystemAlerts [1 ])
227212 }
228- if instance .Alerts .UserAlerts != nil {
229- userAlerts := * instance .Alerts .UserAlerts
230- if len (userAlerts ) > 0 {
231- assert .Equal (t , 555 , userAlerts [0 ])
232- }
213+ if len (instance .Alerts .UserAlerts ) > 0 {
214+ assert .Equal (t , 555 , instance .Alerts .UserAlerts [0 ])
233215 }
234216}
235217
@@ -245,8 +227,8 @@ func TestInstance_Update(t *testing.T) {
245227 Label : "updated-instance" ,
246228 MaintenancePolicy : linodego .Pointer ("linode/power_off_on" ),
247229 Alerts : & linodego.InstanceAlert {
248- SystemAlerts : linodego . Pointer ( []int {123 , 456 }) ,
249- UserAlerts : linodego . Pointer ( []int {555 }) ,
230+ SystemAlerts : []int {123 , 456 },
231+ UserAlerts : []int {555 },
250232 },
251233 }
252234
@@ -256,18 +238,12 @@ func TestInstance_Update(t *testing.T) {
256238 assert .NoError (t , err )
257239 assert .Equal (t , "updated-instance" , instance .Label )
258240 assert .Equal (t , "linode/power_off_on" , instance .MaintenancePolicy )
259- if instance .Alerts .SystemAlerts != nil {
260- systemAlerts := * instance .Alerts .SystemAlerts
261- if len (systemAlerts ) >= 2 {
262- assert .Equal (t , 123 , systemAlerts [0 ])
263- assert .Equal (t , 456 , systemAlerts [1 ])
264- }
241+ if len (instance .Alerts .SystemAlerts ) >= 2 {
242+ assert .Equal (t , 123 , instance .Alerts .SystemAlerts [0 ])
243+ assert .Equal (t , 456 , instance .Alerts .SystemAlerts [1 ])
265244 }
266- if instance .Alerts .UserAlerts != nil {
267- userAlerts := * instance .Alerts .UserAlerts
268- if len (userAlerts ) > 0 {
269- assert .Equal (t , 555 , userAlerts [0 ])
270- }
245+ if len (instance .Alerts .UserAlerts ) > 0 {
246+ assert .Equal (t , 555 , instance .Alerts .UserAlerts [0 ])
271247 }
272248}
273249
@@ -317,8 +293,8 @@ func TestInstance_Clone(t *testing.T) {
317293 Type : "g6-standard-1" ,
318294 Label : "cloned-instance" ,
319295 Alerts : & linodego.InstanceACLPAlertsOptions {
320- SystemAlerts : linodego . Pointer ( []int {123 , 456 }) ,
321- UserAlerts : linodego . Pointer ( []int {555 }) ,
296+ SystemAlerts : []int {123 , 456 },
297+ UserAlerts : []int {555 },
322298 },
323299 }
324300
@@ -328,18 +304,12 @@ func TestInstance_Clone(t *testing.T) {
328304 assert .NoError (t , err )
329305 assert .Equal (t , "cloned-instance" , instance .Label )
330306 assert .Equal (t , "linode/migrate" , instance .MaintenancePolicy )
331- if instance .Alerts .SystemAlerts != nil {
332- systemAlerts := * instance .Alerts .SystemAlerts
333- if len (systemAlerts ) >= 2 {
334- assert .Equal (t , 123 , systemAlerts [0 ])
335- assert .Equal (t , 456 , systemAlerts [1 ])
336- }
307+ if len (instance .Alerts .SystemAlerts ) >= 2 {
308+ assert .Equal (t , 123 , instance .Alerts .SystemAlerts [0 ])
309+ assert .Equal (t , 456 , instance .Alerts .SystemAlerts [1 ])
337310 }
338- if instance .Alerts .UserAlerts != nil {
339- userAlerts := * instance .Alerts .UserAlerts
340- if len (userAlerts ) > 0 {
341- assert .Equal (t , 555 , userAlerts [0 ])
342- }
311+ if len (instance .Alerts .UserAlerts ) > 0 {
312+ assert .Equal (t , 555 , instance .Alerts .UserAlerts [0 ])
343313 }
344314}
345315
0 commit comments