@@ -201,6 +201,84 @@ func TestMapFields(t *testing.T) {
201201 },
202202 isValid : true ,
203203 },
204+ {
205+ description : "port range in model defined, but in response null" ,
206+ args : args {
207+ state : Model {
208+ ProjectId : types .StringValue ("pid" ),
209+ SecurityGroupId : types .StringValue ("sgid" ),
210+ SecurityGroupRuleId : types .StringValue ("sgrid" ),
211+ Region : types .StringValue ("eu01" ),
212+ PortRange : fixtureModelPortRange ,
213+ },
214+ input : & iaas.SecurityGroupRule {
215+ Id : new ("sgrid "),
216+ Description : new ("desc "),
217+ Direction : new ("ingress "),
218+ Ethertype : new ("ether "),
219+ IpRange : new ("iprange "),
220+ RemoteSecurityGroupId : new ("remote "),
221+ PortRange : nil ,
222+ Protocol : & fixtureProtocol ,
223+ },
224+ region : "eu02" ,
225+ },
226+ expected : Model {
227+ Id : types .StringValue ("pid,eu02,sgid,sgrid" ),
228+ ProjectId : types .StringValue ("pid" ),
229+ SecurityGroupId : types .StringValue ("sgid" ),
230+ SecurityGroupRuleId : types .StringValue ("sgrid" ),
231+ Direction : types .StringValue ("ingress" ),
232+ Description : types .StringValue ("desc" ),
233+ EtherType : types .StringValue ("ether" ),
234+ IpRange : types .StringValue ("iprange" ),
235+ RemoteSecurityGroupId : types .StringValue ("remote" ),
236+ IcmpParameters : types .ObjectNull (icmpParametersTypes ),
237+ PortRange : fixtureModelPortRange ,
238+ Protocol : fixtureModelProtocol ,
239+ Region : types .StringValue ("eu02" ),
240+ },
241+ isValid : true ,
242+ },
243+ {
244+ description : "icmp parameters in model defined, but in response null" ,
245+ args : args {
246+ state : Model {
247+ ProjectId : types .StringValue ("pid" ),
248+ SecurityGroupId : types .StringValue ("sgid" ),
249+ SecurityGroupRuleId : types .StringValue ("sgrid" ),
250+ Region : types .StringValue ("eu01" ),
251+ IcmpParameters : fixtureModelIcmpParameters ,
252+ },
253+ input : & iaas.SecurityGroupRule {
254+ Id : new ("sgrid "),
255+ Description : new ("desc "),
256+ Direction : new ("ingress "),
257+ Ethertype : new ("ether "),
258+ IpRange : new ("iprange "),
259+ RemoteSecurityGroupId : new ("remote "),
260+ IcmpParameters : nil ,
261+ Protocol : & fixtureProtocol ,
262+ },
263+ region : "eu02" ,
264+ },
265+ expected : Model {
266+ Id : types .StringValue ("pid,eu02,sgid,sgrid" ),
267+ ProjectId : types .StringValue ("pid" ),
268+ SecurityGroupId : types .StringValue ("sgid" ),
269+ SecurityGroupRuleId : types .StringValue ("sgrid" ),
270+ Direction : types .StringValue ("ingress" ),
271+ Description : types .StringValue ("desc" ),
272+ EtherType : types .StringValue ("ether" ),
273+ IpRange : types .StringValue ("iprange" ),
274+ RemoteSecurityGroupId : types .StringValue ("remote" ),
275+ IcmpParameters : fixtureModelIcmpParameters ,
276+ PortRange : types .ObjectNull (portRangeTypes ),
277+ Protocol : fixtureModelProtocol ,
278+ Region : types .StringValue ("eu02" ),
279+ },
280+ isValid : true ,
281+ },
204282 {
205283 description : "response_nil_fail" ,
206284 },
0 commit comments