-
Notifications
You must be signed in to change notification settings - Fork 1
/
data_source_nsxt_static_routes_test.go
73 lines (66 loc) · 2.18 KB
/
data_source_nsxt_static_routes_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/***************************************************************************
* ========================================================================
* Copyright 2022-2023 VMware, Inc. All rights reserved. VMware Confidential
* SPDX-License-Identifier: MPL-2.0
* ========================================================================
*/
// Auto generated code. DO NOT EDIT.
// nolint
package nsxt
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"testing"
)
func TestNSXTDataSourceStaticRoutesBasic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNSXTDSStaticRoutesConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckTypeSetElemNestedAttrs(
"nsxt_vpc_static_routes.testStaticRoutes", "next_hops.*", map[string]string{
"ip_address": "41.1.1.1"}),
resource.TestCheckTypeSetElemNestedAttrs(
"nsxt_vpc_static_routes.testStaticRoutes", "next_hops.*", map[string]string{
"admin_distance": "1"}),
resource.TestCheckResourceAttr(
"nsxt_vpc_static_routes.testStaticRoutes", "nsx_id", "test-staticroutes-abc"),
resource.TestCheckResourceAttr(
"nsxt_vpc_static_routes.testStaticRoutes", "display_name", "test-staticroutes-abc"),
resource.TestCheckResourceAttr(
"nsxt_vpc_static_routes.testStaticRoutes", "description", "StaticRoutes description"),
resource.TestCheckResourceAttr(
"nsxt_vpc_static_routes.testStaticRoutes", "network", "45.1.1.0/24"),
),
},
},
})
}
const testAccNSXTDSStaticRoutesConfig = `
resource "nsxt_vpc_static_routes" "testStaticRoutes" {
next_hops {
ip_address = "41.1.1.1"
admin_distance = 1
}
next_hops {
ip_address = "42.1.1.1"
admin_distance = 2
}
next_hops {
ip_address = "43.1.2.3"
admin_distance = 3
}
nsx_id = "test-staticroutes-abc"
display_name = "test-staticroutes-abc"
description = "StaticRoutes description"
network = "45.1.1.0/24"
}
data "nsxt_vpc_static_routes" "testStaticRoutes" {
display_name = nsxt_vpc_static_routes.testStaticRoutes.display_name
context {
scope = "vpc"
}
}
`