Skip to content

Commit 57cd372

Browse files
authored
tests(lb): remove tests with deprecated static-config (#2639)
* increase lb timeout * remove tests with deprecated static-config * remove invalid static config test
1 parent 977d9bc commit 57cd372

5 files changed

+1
-8060
lines changed

internal/services/lb/helpers_lb.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
)
2424

2525
const (
26-
defaultLbLbTimeout = 10 * time.Minute
26+
defaultLbLbTimeout = 15 * time.Minute
2727
RetryLbIPInterval = 5 * time.Second
2828
)
2929

internal/services/lb/lb_test.go

-265
Original file line numberDiff line numberDiff line change
@@ -360,271 +360,6 @@ func TestAccLB_Migrate(t *testing.T) {
360360
})
361361
}
362362

363-
func TestAccLB_WithIP(t *testing.T) {
364-
tt := acctest.NewTestTools(t)
365-
defer tt.Cleanup()
366-
resource.ParallelTest(t, resource.TestCase{
367-
PreCheck: func() { acctest.PreCheck(t) },
368-
ProviderFactories: tt.ProviderFactories,
369-
CheckDestroy: isLbDestroyed(tt),
370-
Steps: []resource.TestStep{
371-
{
372-
Config: `
373-
resource scaleway_lb_ip ip01 {
374-
}
375-
376-
resource scaleway_vpc_private_network pnLB01 {
377-
name = "pn-with-lb-static"
378-
}
379-
380-
resource scaleway_lb lb01 {
381-
ip_id = scaleway_lb_ip.ip01.id
382-
name = "test-lb-with-pn-static-2"
383-
type = "LB-S"
384-
release_ip = false
385-
private_network {
386-
private_network_id = scaleway_vpc_private_network.pnLB01.id
387-
static_config = ["172.16.0.100"]
388-
}
389-
}
390-
`,
391-
Check: resource.ComposeTestCheckFunc(
392-
isLbPresent(tt, "scaleway_lb.lb01"),
393-
isIPPresent(tt, "scaleway_lb_ip.ip01"),
394-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB01", "name"),
395-
resource.TestCheckResourceAttr("scaleway_lb.lb01",
396-
"private_network.0.static_config.0", "172.16.0.100"),
397-
),
398-
},
399-
{
400-
Config: `
401-
resource scaleway_lb_ip ip01 {
402-
}
403-
404-
resource scaleway_vpc_private_network pnLB01 {
405-
name = "pn-with-lb-to-add"
406-
}
407-
408-
resource scaleway_vpc_private_network pnLB02 {
409-
name = "pn-with-lb-to-add"
410-
}
411-
412-
resource scaleway_lb lb01 {
413-
ip_id = scaleway_lb_ip.ip01.id
414-
name = "test-lb-with-static-to-update-with-two-pn-3"
415-
type = "LB-S"
416-
release_ip = false
417-
private_network {
418-
private_network_id = scaleway_vpc_private_network.pnLB01.id
419-
static_config = ["172.16.0.100"]
420-
}
421-
422-
private_network {
423-
private_network_id = scaleway_vpc_private_network.pnLB02.id
424-
static_config = ["172.16.0.105"]
425-
}
426-
}
427-
`,
428-
Check: resource.ComposeTestCheckFunc(
429-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB01", "name"),
430-
resource.TestCheckResourceAttr("scaleway_lb.lb01", "private_network.#", "2"),
431-
resource.TestCheckTypeSetElemNestedAttrs("scaleway_lb.lb01", "private_network.*", map[string]string{
432-
"static_config.0": "172.16.0.100",
433-
}),
434-
resource.TestCheckTypeSetElemNestedAttrs("scaleway_lb.lb01", "private_network.*", map[string]string{
435-
"static_config.0": "172.16.0.105",
436-
}),
437-
),
438-
},
439-
{
440-
Config: `
441-
resource scaleway_lb_ip ip01 {
442-
}
443-
444-
resource scaleway_vpc_private_network pnLB01 {
445-
name = "pn-with-lb-to-add"
446-
}
447-
448-
resource scaleway_vpc_private_network pnLB02 {
449-
name = "pn-with-lb-to-add"
450-
}
451-
452-
resource scaleway_lb lb01 {
453-
ip_id = scaleway_lb_ip.ip01.id
454-
name = "test-lb-with-static-to-update-with-two-pn-4"
455-
type = "LB-S"
456-
release_ip = false
457-
private_network {
458-
private_network_id = scaleway_vpc_private_network.pnLB01.id
459-
static_config = ["172.16.0.100"]
460-
}
461-
462-
private_network {
463-
private_network_id = scaleway_vpc_private_network.pnLB02.id
464-
static_config = ["172.16.0.107"]
465-
}
466-
}
467-
`,
468-
Check: resource.ComposeTestCheckFunc(
469-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB01", "name"),
470-
resource.TestCheckResourceAttr("scaleway_lb.lb01", "private_network.#", "2"),
471-
resource.TestCheckTypeSetElemNestedAttrs("scaleway_lb.lb01", "private_network.*", map[string]string{
472-
"static_config.0": "172.16.0.100",
473-
}),
474-
resource.TestCheckTypeSetElemNestedAttrs("scaleway_lb.lb01", "private_network.*", map[string]string{
475-
"static_config.0": "172.16.0.107",
476-
}),
477-
),
478-
},
479-
{
480-
Config: `
481-
resource scaleway_lb_ip ip01 {
482-
}
483-
484-
resource scaleway_vpc_private_network pnLB01 {
485-
name = "pn-with-lb-detached"
486-
}
487-
488-
resource scaleway_vpc_private_network pnLB02 {
489-
name = "pn-with-lb-detached"
490-
}
491-
492-
resource scaleway_lb lb01 {
493-
ip_id = scaleway_lb_ip.ip01.id
494-
name = "test-lb-with-only-one-pn-is-conserved-5"
495-
type = "LB-S"
496-
release_ip = false
497-
private_network {
498-
private_network_id = scaleway_vpc_private_network.pnLB01.id
499-
static_config = ["172.16.0.100"]
500-
}
501-
}
502-
`,
503-
Check: resource.ComposeTestCheckFunc(
504-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB01", "name"),
505-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB02", "name"),
506-
resource.TestCheckResourceAttr("scaleway_lb.lb01", "private_network.#", "1"),
507-
resource.TestCheckResourceAttr("scaleway_lb.lb01", "private_network.0.static_config.0", "172.16.0.100"),
508-
),
509-
},
510-
{
511-
Config: `
512-
resource scaleway_lb_ip ip01 {
513-
}
514-
515-
resource scaleway_vpc_private_network pnLB01 {
516-
name = "pn-with-lb-detached"
517-
}
518-
519-
resource scaleway_vpc_private_network pnLB02 {
520-
name = "pn-with-lb-detached"
521-
}
522-
`,
523-
Check: resource.ComposeTestCheckFunc(
524-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB01", "name"),
525-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB02", "name"),
526-
),
527-
},
528-
{
529-
Config: `
530-
resource scaleway_lb_ip ip01 {
531-
}
532-
533-
resource scaleway_vpc_private_network pnLB01 {
534-
name = "pn-with-lb-detached"
535-
}
536-
537-
resource scaleway_vpc_private_network pnLB02 {
538-
name = "pn-with-lb-detached"
539-
}
540-
`,
541-
Check: resource.ComposeTestCheckFunc(
542-
isIPPresent(tt, "scaleway_lb_ip.ip01"),
543-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB02", "name"),
544-
resource.TestCheckResourceAttrSet("scaleway_vpc_private_network.pnLB01", "name"),
545-
),
546-
},
547-
{
548-
Config: `
549-
resource scaleway_lb_ip ip01 {
550-
}
551-
`,
552-
Check: resource.ComposeTestCheckFunc(
553-
isIPPresent(tt, "scaleway_lb_ip.ip01"),
554-
),
555-
},
556-
},
557-
})
558-
}
559-
560-
func TestAccLB_WithStaticIPCIDR(t *testing.T) {
561-
tt := acctest.NewTestTools(t)
562-
defer tt.Cleanup()
563-
resource.ParallelTest(t, resource.TestCase{
564-
PreCheck: func() { acctest.PreCheck(t) },
565-
ProviderFactories: tt.ProviderFactories,
566-
CheckDestroy: isLbDestroyed(tt),
567-
Steps: []resource.TestStep{
568-
{
569-
Config: `
570-
resource "scaleway_lb_ip" "ip01" {}
571-
572-
resource "scaleway_vpc_private_network" "pn" {
573-
name = "pn-with-lb-static"
574-
}
575-
576-
resource "scaleway_lb" "lb01" {
577-
ip_id = scaleway_lb_ip.ip01.id
578-
name = "test-lb-with-pn-static-cidr"
579-
type = "LB-S"
580-
private_network {
581-
private_network_id = scaleway_vpc_private_network.pn.id
582-
static_config = ["192.168.1.1/25"]
583-
}
584-
}
585-
`,
586-
Check: resource.ComposeTestCheckFunc(
587-
isLbPresent(tt, "scaleway_lb.lb01"),
588-
isIPPresent(tt, "scaleway_lb_ip.ip01"),
589-
resource.TestCheckResourceAttr("scaleway_lb.lb01",
590-
"private_network.0.static_config.0", "192.168.1.1/25"),
591-
),
592-
},
593-
},
594-
})
595-
}
596-
597-
func TestAccLB_InvalidStaticConfig(t *testing.T) {
598-
tt := acctest.NewTestTools(t)
599-
defer tt.Cleanup()
600-
resource.ParallelTest(t, resource.TestCase{
601-
PreCheck: func() { acctest.PreCheck(t) },
602-
ProviderFactories: tt.ProviderFactories,
603-
CheckDestroy: isLbDestroyed(tt),
604-
Steps: []resource.TestStep{
605-
{
606-
Config: `
607-
resource "scaleway_lb_ip" "ip01" {}
608-
609-
resource "scaleway_vpc_private_network" "pn" {
610-
name = "pn-with-lb-to-static"
611-
}
612-
613-
resource "scaleway_lb" "lb01" {
614-
ip_id = scaleway_lb_ip.ip01.id
615-
name = "test-lb-with-invalid_ip"
616-
type = "LB-S"
617-
private_network {
618-
private_network_id = scaleway_vpc_private_network.pn.id
619-
static_config = ["472.16.0.100/24"]
620-
}
621-
}`,
622-
ExpectError: regexp.MustCompile("\".+\" is not a valid IP address or CIDR notation: .+"),
623-
},
624-
},
625-
})
626-
}
627-
628363
func TestAccLB_WithPrivateNetworksOnDHCPConfig(t *testing.T) {
629364
tt := acctest.NewTestTools(t)
630365
defer tt.Cleanup()

0 commit comments

Comments
 (0)