@@ -30,13 +30,15 @@ func AddTestSweepers() {
3030func testSweepInstanceGroup (_ string ) error {
3131 return acctest .SweepZones ((& autoscaling.API {}).Zones (), func (scwClient * scw.Client , zone scw.Zone ) error {
3232 autoscalingAPI := autoscaling .NewAPI (scwClient )
33+
3334 logging .L .Debugf ("sweeper: destroying the autoscaling instance groups in (%s)" , zone )
35+
3436 listInstanceGroups , err := autoscalingAPI .ListInstanceGroups (
3537 & autoscaling.ListInstanceGroupsRequest {
3638 Zone : zone ,
3739 }, scw .WithAllPages ())
3840 if err != nil {
39- return fmt .Errorf ("error listing instancegroup in (%s) in sweeper: %s " , zone , err )
41+ return fmt .Errorf ("error listing instancegroup in (%s) in sweeper: %w " , zone , err )
4042 }
4143
4244 for _ , instanceGroup := range listInstanceGroups .InstanceGroups {
@@ -45,9 +47,9 @@ func testSweepInstanceGroup(_ string) error {
4547 Zone : zone ,
4648 })
4749 if err != nil {
48- logging .L .Debugf ("sweeper: error (%s )" , err )
50+ logging .L .Debugf ("sweeper: error (%w )" , err )
4951
50- return fmt .Errorf ("error deleting instance group in sweeper: %s " , err )
52+ return fmt .Errorf ("error deleting instance group in sweeper: %w " , err )
5153 }
5254 }
5355
@@ -58,13 +60,15 @@ func testSweepInstanceGroup(_ string) error {
5860func testSweepInstanceTemplate (_ string ) error {
5961 return acctest .SweepZones ((& autoscaling.API {}).Zones (), func (scwClient * scw.Client , zone scw.Zone ) error {
6062 autoscalingAPI := autoscaling .NewAPI (scwClient )
63+
6164 logging .L .Debugf ("sweeper: destroying the autoscaling instance templates in (%s)" , zone )
65+
6266 listInstanceTemplates , err := autoscalingAPI .ListInstanceTemplates (
6367 & autoscaling.ListInstanceTemplatesRequest {
6468 Zone : zone ,
6569 }, scw .WithAllPages ())
6670 if err != nil {
67- return fmt .Errorf ("error listing instance templates in (%s) in sweeper: %s " , zone , err )
71+ return fmt .Errorf ("error listing instance templates in (%s) in sweeper: %w " , zone , err )
6872 }
6973
7074 for _ , instanceTemplate := range listInstanceTemplates .InstanceTemplates {
@@ -73,9 +77,9 @@ func testSweepInstanceTemplate(_ string) error {
7377 Zone : zone ,
7478 })
7579 if err != nil {
76- logging .L .Debugf ("sweeper: error (%s )" , err )
80+ logging .L .Debugf ("sweeper: error (%w )" , err )
7781
78- return fmt .Errorf ("error deleting instance template in sweeper: %s " , err )
82+ return fmt .Errorf ("error deleting instance template in sweeper: %w " , err )
7983 }
8084 }
8185
@@ -86,13 +90,14 @@ func testSweepInstanceTemplate(_ string) error {
8690func testSweepInstancePolicy (_ string ) error {
8791 return acctest .SweepZones ((& autoscaling.API {}).Zones (), func (scwClient * scw.Client , zone scw.Zone ) error {
8892 autoscalingAPI := autoscaling .NewAPI (scwClient )
93+
8994 logging .L .Debugf ("sweeper: destroying the autoscaling instance policies in (%s)" , zone )
90- listInstancePolicies , err := autoscalingAPI . ListInstancePolicies (
91- & autoscaling.ListInstancePoliciesRequest {
92- Zone : zone ,
93- }, scw .WithAllPages ())
95+
96+ listInstancePolicies , err := autoscalingAPI . ListInstancePolicies ( & autoscaling.ListInstancePoliciesRequest {
97+ Zone : zone ,
98+ }, scw .WithAllPages ())
9499 if err != nil {
95- return fmt .Errorf ("error listing instance policy in (%s) in sweeper: %s " , zone , err )
100+ return fmt .Errorf ("error listing instance policy in (%s) in sweeper: %w " , zone , err )
96101 }
97102
98103 for _ , instancePolicy := range listInstancePolicies .Policies {
@@ -101,9 +106,9 @@ func testSweepInstancePolicy(_ string) error {
101106 Zone : zone ,
102107 })
103108 if err != nil {
104- logging .L .Debugf ("sweeper: error (%s )" , err )
109+ logging .L .Debugf ("sweeper: error (%w )" , err )
105110
106- return fmt .Errorf ("error deleting instance policy in sweeper: %s " , err )
111+ return fmt .Errorf ("error deleting instance policy in sweeper: %w " , err )
107112 }
108113 }
109114
0 commit comments