Skip to content

Commit 539d141

Browse files
authored
test(e2e): reduce flakiness in firewall attachment tests (#837)
The firewall endpoints responds with 500 server_error regularly when being called too many times in parallel. This is annoying as it fails our integration test suite and requires lengthy retries. Moving the tests to run in series reduces the amount of parallel calls to these endpoints. This was previously already done for the firewall resource and datasource tests. Sample failure: https://github.com/hetznercloud/terraform-provider-hcloud/actions/runs/7495395337/job/20405373073?pr=836#step:6:1149
1 parent 6011b42 commit 539d141

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

internal/e2etests/firewall/attachment_resource_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
7+
78
"github.com/hetznercloud/hcloud-go/hcloud"
89
"github.com/hetznercloud/terraform-provider-hcloud/internal/e2etests"
910
"github.com/hetznercloud/terraform-provider-hcloud/internal/firewall"
@@ -30,7 +31,8 @@ func TestAttachmentResource_Servers(t *testing.T) {
3031
fwAttRes.ServerIDRefs = append(fwAttRes.ServerIDRefs, srvRes.TFID()+".id")
3132

3233
tmplMan := testtemplate.Manager{}
33-
resource.ParallelTest(t, resource.TestCase{
34+
// TODO: Move to parallel test once API endpoint supports higher parallelism
35+
resource.Test(t, resource.TestCase{
3436
PreCheck: e2etests.PreCheck(t),
3537
ProtoV6ProviderFactories: e2etests.ProtoV6ProviderFactories(),
3638
CheckDestroy: resource.ComposeAggregateTestCheckFunc(
@@ -75,7 +77,8 @@ func TestAttachmentResource_LabelSelectors(t *testing.T) {
7577
fwAttRes.LabelSelectors = append(fwAttRes.LabelSelectors, "firewall-attachment=test-server")
7678

7779
tmplMan := testtemplate.Manager{}
78-
resource.ParallelTest(t, resource.TestCase{
80+
// TODO: Move to parallel test once API endpoint supports higher parallelism
81+
resource.Test(t, resource.TestCase{
7982
PreCheck: e2etests.PreCheck(t),
8083
ProtoV6ProviderFactories: e2etests.ProtoV6ProviderFactories(),
8184
CheckDestroy: resource.ComposeAggregateTestCheckFunc(

internal/e2etests/firewall/data_source_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55
"testing"
66

7+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
8+
79
"github.com/hetznercloud/terraform-provider-hcloud/internal/e2etests"
810
"github.com/hetznercloud/terraform-provider-hcloud/internal/firewall"
9-
10-
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1111
"github.com/hetznercloud/terraform-provider-hcloud/internal/testsupport"
1212
"github.com/hetznercloud/terraform-provider-hcloud/internal/testtemplate"
1313
)
@@ -30,7 +30,7 @@ func TestAccHcloudDataSourceFirewallTest(t *testing.T) {
3030
}
3131
firewallBySel.SetRName("firewall_by_sel")
3232

33-
// TODO: Move to parallel test once API endpoint is fixed
33+
// TODO: Move to parallel test once API endpoint supports higher parallelism
3434
resource.Test(t, resource.TestCase{
3535
PreCheck: e2etests.PreCheck(t),
3636
ProtoV6ProviderFactories: e2etests.ProtoV6ProviderFactories(),
@@ -76,7 +76,7 @@ func TestAccHcloudDataSourceFirewallListTest(t *testing.T) {
7676
allFirewallsSel.SetRName("all_firewalls_sel")
7777

7878
tmplMan := testtemplate.Manager{}
79-
// TODO: Move to parallel test once API endpoint is fixed
79+
// TODO: Move to parallel test once API endpoint supports higher parallelism
8080
resource.Test(t, resource.TestCase{
8181
PreCheck: e2etests.PreCheck(t),
8282
ProtoV6ProviderFactories: e2etests.ProtoV6ProviderFactories(),

internal/e2etests/firewall/resource_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestFirewallResource_Basic(t *testing.T) {
6666
}, nil)
6767
updated.SetRName(res.RName())
6868
tmplMan := testtemplate.Manager{}
69-
// TODO: Move to parallel test once API endpoint is fixed
69+
// TODO: Move to parallel test once API endpoint supports higher parallelism
7070
resource.Test(t, resource.TestCase{
7171
PreCheck: e2etests.PreCheck(t),
7272
ProtoV6ProviderFactories: e2etests.ProtoV6ProviderFactories(),
@@ -192,7 +192,7 @@ func TestFirewallResource_SourceIPs_IPv6Comparison(t *testing.T) {
192192
}, nil)
193193
tmplMan := testtemplate.Manager{}
194194

195-
// TODO: Move to parallel test once API endpoint is fixed
195+
// TODO: Move to parallel test once API endpoint supports higher parallelism
196196
resource.Test(t, resource.TestCase{
197197
PreCheck: e2etests.PreCheck(t),
198198
ProtoV6ProviderFactories: e2etests.ProtoV6ProviderFactories(),
@@ -225,7 +225,7 @@ func TestFirewallResource_DestinationIPs_IPv6Comparison(t *testing.T) {
225225
}, nil)
226226
tmplMan := testtemplate.Manager{}
227227

228-
// TODO: Move to parallel test once API endpoint is fixed
228+
// TODO: Move to parallel test once API endpoint supports higher parallelism
229229
resource.Test(t, resource.TestCase{
230230
PreCheck: e2etests.PreCheck(t),
231231
ProtoV6ProviderFactories: e2etests.ProtoV6ProviderFactories(),

0 commit comments

Comments
 (0)