-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
metal-go
for the BGP neighbors data source
This updates the device BGP neighbors data source to use `metal-go` instead of `packngo`. There were no tests for the BGP neighbors data source, so those are added here as well.
- Loading branch information
Showing
2 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
equinix/data_source_metal_device_bgp_neighbors_acc_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package equinix | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccDataSourceMetalDeviceBgpNeighbors(t *testing.T) { | ||
projectName := fmt.Sprintf("ds-device-%s", acctest.RandString(10)) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ExternalProviders: testExternalProviders, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDataSourceMetalDeviceBgpNeighborsConfig(projectName), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet( | ||
"data.equinix_metal_device_bgp_neighbors.test", "bgp_neighbors.#"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataSourceMetalDeviceBgpNeighborsConfig(projectName string) string { | ||
return fmt.Sprintf(` | ||
%s | ||
data "equinix_metal_device_bgp_neighbors" "test" { | ||
device_id = equinix_metal_device.test.id | ||
} | ||
output "bgp_neighbors_listing" { | ||
value = data.equinix_metal_device_bgp_neighbors.test.bgp_neighbors | ||
} | ||
`, testDataSourceMetalDeviceConfig_basic(projectName)) | ||
} |