Skip to content

Commit

Permalink
Switch to different location for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fhofherr committed Mar 10, 2021
1 parent 4337116 commit 3de435e
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion internal/e2etests/floatingip/data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAccHcloudDataSourceFloatingIPTest(t *testing.T) {
Labels: map[string]string{
"key": strconv.Itoa(acctest.RandInt()),
},
HomeLocationName: "nbg1",
HomeLocationName: e2etests.TestLocationName,
}
res.SetRName("floatingip-ds-test")
floatingipByName := &floatingip.DData{
Expand Down
2 changes: 1 addition & 1 deletion internal/e2etests/floatingip/resource_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestFloatingIPAssignmentResource_Basic(t *testing.T) {
resFloatingIP := &floatingip.RData{
Name: "fip-assignment",
Type: "ipv4",
HomeLocationName: "fsn1",
HomeLocationName: e2etests.TestLocationName,
}
resFloatingIP.SetRName("floating_ip_assignment")

Expand Down
2 changes: 1 addition & 1 deletion internal/e2etests/floatingip/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestFloatingIPResource_Basic(t *testing.T) {
Name: "floatingip-test",
Type: "ipv4",
Labels: nil,
HomeLocationName: "nbg1",
HomeLocationName: e2etests.TestLocationName,
}
resRenamed := &floatingip.RData{Name: res.Name + "-renamed", Type: res.Type, HomeLocationName: res.HomeLocationName}
resRenamed.SetRName(res.Name)
Expand Down
2 changes: 1 addition & 1 deletion internal/e2etests/loadbalancer/data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestAccHcloudDataSourceLoadBalancerTest(t *testing.T) {

res := &loadbalancer.RData{
Name: "some-load-balancer",
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Labels: map[string]string{
"key": strconv.Itoa(acctest.RandInt()),
},
Expand Down
2 changes: 1 addition & 1 deletion internal/e2etests/loadbalancer/resource_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func TestAccHcloudLoadBalancerService_HTTPS_UpdateUnchangedCertificates(t *testi
certRes2 := certificate.NewRData(t, "cert-res2", "TFAccTests2")
lbRes := &loadbalancer.RData{
Name: "load-balancer-certificates-unchanged",
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
}
svcRes := &loadbalancer.RDataService{
Name: "service-with-two-certs",
Expand Down
16 changes: 8 additions & 8 deletions internal/e2etests/loadbalancer/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestLoadBalancerResource_Basic(t *testing.T) {
res := loadbalancer.Basic
resRenamed := &loadbalancer.RData{
Name: res.Name + "-renamed",
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Algorithm: "least_connections",
Labels: map[string]string{
"key1": "value1",
Expand All @@ -44,7 +44,7 @@ func TestLoadBalancerResource_Basic(t *testing.T) {
resource.TestCheckResourceAttr(res.TFID(), "name",
fmt.Sprintf("basic-load-balancer--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(res.TFID(), "load_balancer_type", e2etests.TestLoadBalancerType),
resource.TestCheckResourceAttr(res.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(res.TFID(), "location", res.LocationName),
),
},
{
Expand All @@ -64,7 +64,7 @@ func TestLoadBalancerResource_Basic(t *testing.T) {
resource.TestCheckResourceAttr(resRenamed.TFID(), "name",
fmt.Sprintf("basic-load-balancer-renamed--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(resRenamed.TFID(), "load_balancer_type", e2etests.TestLoadBalancerType),
resource.TestCheckResourceAttr(resRenamed.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(resRenamed.TFID(), "location", resRenamed.LocationName),
resource.TestCheckResourceAttr(resRenamed.TFID(), "algorithm.0.type", "least_connections"),
resource.TestCheckResourceAttr(resRenamed.TFID(), "labels.key1", "value1"),
resource.TestCheckResourceAttr(resRenamed.TFID(), "labels.key2", "value2"),
Expand All @@ -80,7 +80,7 @@ func TestLoadBalancerResource_Resize(t *testing.T) {
res := loadbalancer.Basic
resResized := &loadbalancer.RData{
Name: res.Name,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Type: "lb21",
}

Expand All @@ -99,7 +99,7 @@ func TestLoadBalancerResource_Resize(t *testing.T) {
resource.TestCheckResourceAttr(res.TFID(), "name",
fmt.Sprintf("basic-load-balancer--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(res.TFID(), "load_balancer_type", e2etests.TestLoadBalancerType),
resource.TestCheckResourceAttr(res.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(res.TFID(), "location", res.LocationName),
),
},
{
Expand All @@ -112,7 +112,7 @@ func TestLoadBalancerResource_Resize(t *testing.T) {
resource.TestCheckResourceAttr(resResized.TFID(), "name",
fmt.Sprintf("basic-load-balancer--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(resResized.TFID(), "load_balancer_type", "lb21"),
resource.TestCheckResourceAttr(resResized.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(resResized.TFID(), "location", resResized.LocationName),
),
},
},
Expand All @@ -137,7 +137,7 @@ func TestLoadBalancerResource_InlineTarget(t *testing.T) {
resServer2.SetRName("another-server")
res := &loadbalancer.RData{
Name: "some-lb",
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Algorithm: "least_connections",
Labels: map[string]string{
"key1": "value1",
Expand All @@ -150,7 +150,7 @@ func TestLoadBalancerResource_InlineTarget(t *testing.T) {
}
resWithoutTargets := &loadbalancer.RData{
Name: "some-lb",
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Algorithm: "least_connections",
Labels: map[string]string{
"key1": "value1",
Expand Down
4 changes: 2 additions & 2 deletions internal/e2etests/rdns/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestRDNSResource_FloatingIP_IPv4(t *testing.T) {
restFloatingIP := &floatingip.RData{
Name: "floating-ipv4-rdns",
Type: "ipv4",
HomeLocationName: "fsn1",
HomeLocationName: e2etests.TestLocationName,
}
restFloatingIP.SetRName("floating_ips_rdns_v4")
resRDNS := rdns.NewRData(t, "floating_ips_rdns_v4", "", restFloatingIP.TFID()+".id", restFloatingIP.TFID()+".ip_address", "example.hetzner.cloud")
Expand Down Expand Up @@ -115,7 +115,7 @@ func TestRDNSResource_FloatingIP_IPv6(t *testing.T) {
restFloatingIP := &floatingip.RData{
Name: "floating-ipv6-rdns",
Type: "ipv6",
HomeLocationName: "fsn1",
HomeLocationName: e2etests.TestLocationName,
}
restFloatingIP.SetRName("floating_ips_rdns_v6")

Expand Down
4 changes: 2 additions & 2 deletions internal/e2etests/server/resource_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestAccHcloudServerNetwork_NetworkID(t *testing.T) {
sRes := &server.RData{
Name: "s-network-test",
Type: e2etests.TestServerType,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Image: e2etests.TestImage,
SSHKeys: []string{sk.TFID() + ".id"},
}
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestAccHcloudServerNetwork_SubNetID(t *testing.T) {
sRes := &server.RData{
Name: "s-network-test",
Type: e2etests.TestServerType,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Image: e2etests.TestImage,
SSHKeys: []string{sk.TFID() + ".id"},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/e2etests/server/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestServerResource_DirectAttachToNetwork(t *testing.T) {
sRes := &server.RData{
Name: "server-direct-attach",
Type: e2etests.TestServerType,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Image: e2etests.TestImage,
SSHKeys: []string{sk.TFID() + ".id"},
}
Expand Down
3 changes: 3 additions & 0 deletions internal/e2etests/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const (

// TestLoadBalancerType is the default Load Balancer type used in all tests
TestLoadBalancerType = "lb11"

// TestLocationName is the default location where we execute our tests.
TestLocationName = "hel1"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion internal/e2etests/volume/data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestAccHcloudDataSourceVolumeTest(t *testing.T) {
res := &volume.RData{
Name: "some-volume",
Size: 10,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Labels: map[string]string{
"key": strconv.Itoa(acctest.RandInt()),
},
Expand Down
24 changes: 12 additions & 12 deletions internal/e2etests/volume/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestVolumeResource_Basic(t *testing.T) {
res := volume.Basic
resRenamed := &volume.RData{
Name: res.Name + "-renamed",
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Size: 10,
Labels: map[string]string{
"key1": "value1",
Expand All @@ -44,7 +44,7 @@ func TestVolumeResource_Basic(t *testing.T) {
resource.TestCheckResourceAttr(res.TFID(), "name",
fmt.Sprintf("basic-volume--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(res.TFID(), "size", "10"),
resource.TestCheckResourceAttr(res.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(res.TFID(), "location", res.LocationName),
),
},
{
Expand All @@ -63,7 +63,7 @@ func TestVolumeResource_Basic(t *testing.T) {
resource.TestCheckResourceAttr(resRenamed.TFID(), "name",
fmt.Sprintf("basic-volume-renamed--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(resRenamed.TFID(), "size", "10"),
resource.TestCheckResourceAttr(resRenamed.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(resRenamed.TFID(), "location", resRenamed.LocationName),
resource.TestCheckResourceAttr(resRenamed.TFID(), "labels.key1", "value1"),
resource.TestCheckResourceAttr(resRenamed.TFID(), "labels.key2", "value2"),
),
Expand All @@ -79,7 +79,7 @@ func TestVolumeResource_Resize(t *testing.T) {
res.Name = "resized-volume"
resResized := &volume.RData{
Name: res.Name,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
Size: 25,
Labels: map[string]string{
"key1": "value1",
Expand All @@ -103,7 +103,7 @@ func TestVolumeResource_Resize(t *testing.T) {
resource.TestCheckResourceAttr(res.TFID(), "name",
fmt.Sprintf("resized-volume--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(res.TFID(), "size", "10"),
resource.TestCheckResourceAttr(res.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(res.TFID(), "location", res.LocationName),
),
},
{
Expand All @@ -116,7 +116,7 @@ func TestVolumeResource_Resize(t *testing.T) {
resource.TestCheckResourceAttr(resResized.TFID(), "name",
fmt.Sprintf("resized-volume--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(resResized.TFID(), "size", "25"),
resource.TestCheckResourceAttr(resResized.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(resResized.TFID(), "location", resResized.LocationName),
resource.TestCheckResourceAttr(resResized.TFID(), "labels.key1", "value1"),
resource.TestCheckResourceAttr(resResized.TFID(), "labels.key2", "value2"),
),
Expand All @@ -132,15 +132,15 @@ func TestVolumeResource_WithServer(t *testing.T) {
Name: "some-server",
Type: e2etests.TestServerType,
Image: e2etests.TestImage,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
}
resServer1.SetRName("some-server")

resServer2 := &server.RData{
Name: "another-server",
Type: e2etests.TestServerType,
Image: e2etests.TestImage,
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
}
resServer2.SetRName("another-server")

Expand Down Expand Up @@ -172,7 +172,7 @@ func TestVolumeResource_WithServer(t *testing.T) {
resource.TestCheckResourceAttr(res.TFID(), "name",
fmt.Sprintf("volume-with-server--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(res.TFID(), "size", "10"),
resource.TestCheckResourceAttr(res.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(res.TFID(), "location", resServer1.LocationName),
),
},
{
Expand All @@ -193,7 +193,7 @@ func TestVolumeResource_WithServer(t *testing.T) {
resource.TestCheckResourceAttr(res.TFID(), "name",
fmt.Sprintf("volume-with-server--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(res.TFID(), "size", "10"),
resource.TestCheckResourceAttr(res.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(res.TFID(), "location", resServer2.LocationName),
),
},
},
Expand All @@ -207,7 +207,7 @@ func TestVolumeResource_WithServerMultipleVolumes(t *testing.T) {
Name: "some-server",
Type: "cx11",
Image: "ubuntu-20.04",
LocationName: "nbg1",
LocationName: e2etests.TestLocationName,
}
resServer1.SetRName("some-server")

Expand Down Expand Up @@ -243,7 +243,7 @@ func TestVolumeResource_WithServerMultipleVolumes(t *testing.T) {
resource.TestCheckResourceAttr(res.TFID(), "name",
fmt.Sprintf("volume-with-server--%d", tmplMan.RandInt)),
resource.TestCheckResourceAttr(res.TFID(), "size", "10"),
resource.TestCheckResourceAttr(res.TFID(), "location", "nbg1"),
resource.TestCheckResourceAttr(res.TFID(), "location", resServer1.LocationName),
),
},
},
Expand Down

0 comments on commit 3de435e

Please sign in to comment.