@@ -13,15 +13,61 @@ import (
13
13
14
14
var TestAccIpLoadbalancingHttpFarmServerPlan = [][]map [string ]interface {}{
15
15
{
16
- {"Status" : "active" , "Address" : "10.0.0.11" , "Port" : 80 , "Weight" : 3 , "DisplayName" : "testBackendA" },
17
- {"Port" : 8080 , "Probe" : true , "Backup" : true },
18
- {"Port" : 8080 , "Probe" : false , "Backup" : false , "Weight" : 2 , "DisplayName" : "testBackendB" },
16
+ {
17
+ "Status" : "active" ,
18
+ "Address" : "10.0.0.11" ,
19
+ "Port" : 80 ,
20
+ "Weight" : 3 ,
21
+ "DisplayName" : "testBackendA" ,
22
+ },
23
+ {
24
+ "Status" : "active" ,
25
+ "Address" : "10.0.0.11" ,
26
+ "Port" : 8080 ,
27
+ "Weight" : 3 ,
28
+ "DisplayName" : "testBackendA" ,
29
+ "Probe" : true ,
30
+ "Backup" : true ,
31
+ },
32
+ {
33
+ "Status" : "active" ,
34
+ "Address" : "10.0.0.11" ,
35
+ "Port" : 8080 ,
36
+ "Weight" : 2 ,
37
+ "DisplayName" : "testBackendB" ,
38
+ "Probe" : false ,
39
+ "Backup" : false ,
40
+ },
19
41
},
20
42
{
21
- {"Status" : "inactive" , "Address" : "10.0.0.12" , "Port" : 80 },
22
- {"Port" : 8080 , "ProxyProtocolVersion" : "v2" , "Ssl" : true },
23
- {"Port" : 8080 , "ProxyProtocolVersion" : "v1" , "Ssl" : true , "Backup" : false },
24
- {"Port" : 8080 , "ProxyProtocolVersion" : nil , "Ssl" : true , "Backup" : true , "Status" : "active" },
43
+ {
44
+ "Status" : "inactive" ,
45
+ "Address" : "10.0.0.12" ,
46
+ "Port" : 80 ,
47
+ },
48
+ {
49
+ "Status" : "active" ,
50
+ "Address" : "10.0.0.11" ,
51
+ "Port" : 8080 ,
52
+ "ProxyProtocolVersion" : "v2" ,
53
+ "Ssl" : true ,
54
+ },
55
+ {
56
+ "Status" : "active" ,
57
+ "Address" : "10.0.0.11" ,
58
+ "Port" : 8080 ,
59
+ "ProxyProtocolVersion" : "v1" ,
60
+ "Ssl" : true ,
61
+ "Backup" : false ,
62
+ },
63
+ {
64
+ "Status" : "active" ,
65
+ "Address" : "10.0.0.11" ,
66
+ "Port" : 8080 ,
67
+ "ProxyProtocolVersion" : nil ,
68
+ "Ssl" : true ,
69
+ "Backup" : true ,
70
+ },
25
71
},
26
72
}
27
73
@@ -31,7 +77,7 @@ type TestAccIpLoadbalancingHttpFarmServer struct {
31
77
BackendId int `json:"backendId"`
32
78
FarmId int `json:"farmId"`
33
79
DisplayName * string `json:"displayName"`
34
- Address * string `json:"address"`
80
+ Address string `json:"address"`
35
81
Cookie * string `json:"cookie"`
36
82
Port * int `json:"port"`
37
83
ProxyProtocolVersion * string `json:"proxyProtocolVersion"`
@@ -40,7 +86,7 @@ type TestAccIpLoadbalancingHttpFarmServer struct {
40
86
Probe * bool `json:"probe"`
41
87
Ssl * bool `json:"ssl"`
42
88
Backup * bool `json:"backup"`
43
- Status * string `json:"status"`
89
+ Status string `json:"status"`
44
90
}
45
91
46
92
type TestAccIpLoadbalancingHttpFarmServerWrapper struct {
@@ -49,18 +95,6 @@ type TestAccIpLoadbalancingHttpFarmServerWrapper struct {
49
95
50
96
func (w * TestAccIpLoadbalancingHttpFarmServerWrapper ) Config () string {
51
97
var config bytes.Buffer
52
- var address , status string
53
- if w .Expected .Address == nil {
54
- address = ""
55
- } else {
56
- address = * w .Expected .Address
57
- }
58
-
59
- if w .Expected .Status == nil {
60
- status = ""
61
- } else {
62
- status = * w .Expected .Status
63
- }
64
98
65
99
config .WriteString (fmt .Sprintf (`
66
100
resource "ovh_iploadbalancing_http_farm" "testacc" {
@@ -81,8 +115,8 @@ func (w *TestAccIpLoadbalancingHttpFarmServerWrapper) Config() string {
81
115
status = "%s"
82
116
` , w .Expected .ServiceName ,
83
117
w .Expected .ServiceName ,
84
- address ,
85
- status ,
118
+ w . Expected . Address ,
119
+ w . Expected . Status ,
86
120
))
87
121
88
122
conditionalAttributeString (& config , "display_name" , w .Expected .DisplayName )
@@ -137,15 +171,15 @@ type TestAccIpLoadbalancingHttpFarmServerStep struct {
137
171
138
172
func (w * TestAccIpLoadbalancingHttpFarmServerWrapper ) TestStep (c map [string ]interface {}) resource.TestStep {
139
173
w .Expected .DisplayName = getNilStringPointerFromData (c , "DisplayName" )
140
- w .Expected .Address = getNilStringPointerFromData ( c , "Address" )
174
+ w .Expected .Address = c [ "Address" ].( string )
141
175
w .Expected .Port = getNilIntPointerFromData (c , "Port" )
142
176
w .Expected .ProxyProtocolVersion = getNilStringPointerFromData (c , "ProxyProtocolVersion" )
143
177
w .Expected .Chain = getNilStringPointerFromData (c , "Chain" )
144
178
w .Expected .Weight = getNilIntPointerFromData (c , "Weight" )
145
179
w .Expected .Probe = getNilBoolPointerFromData (c , "Probe" )
146
180
w .Expected .Ssl = getNilBoolPointerFromData (c , "Ssl" )
147
181
w .Expected .Backup = getNilBoolPointerFromData (c , "Backup" )
148
- w .Expected .Status = getNilStringPointerFromData ( c , "Status" )
182
+ w .Expected .Status = c [ "Status" ].( string )
149
183
150
184
expected := * w .Expected
151
185
0 commit comments