@@ -359,6 +359,54 @@ func TestIPAddress(t *testing.T) {
359359 AssertNil (t , err )
360360 })
361361
362+ t .Run ("Check ReserveOrUpdate with no change needed" , func (t * testing.T ) {
363+ inputList := ipam .NewIpamIPAddressesListParams ().WithAddress (& ipAddress )
364+
365+ description := TruncateDescription (Description )
366+ comments := Comments + warningComment
367+ outputList := & ipam.IpamIPAddressesListOK {
368+ Payload : & ipam.IpamIPAddressesListOKBody {
369+ Results : []* netboxModels.IPAddress {
370+ {
371+ ID : expectedIPAddress ().ID ,
372+ Address : expectedIPAddress ().Address ,
373+ Description : description ,
374+ Comments : comments ,
375+ Status : & netboxModels.IPAddressStatus {
376+ Label : & Label ,
377+ Value : & Value ,
378+ },
379+ CustomFields : map [string ]interface {}{},
380+ },
381+ },
382+ },
383+ }
384+
385+ mockIPAddress .EXPECT ().IpamIPAddressesList (inputList , nil ).Return (outputList , nil ).AnyTimes ()
386+
387+ clientV3 := & NetboxClientV3 {
388+ Ipam : mockIPAddress ,
389+ }
390+ compositeClient := & NetboxCompositeClient {
391+ clientV3 : clientV3 ,
392+ }
393+
394+ result , err := compositeClient .ReserveOrUpdateIpAddress (& models.IPAddress {
395+ IpAddress : ipAddress ,
396+ Metadata : & models.NetboxMetadata {
397+ Description : Description ,
398+ Comments : Comments ,
399+ },
400+ })
401+ AssertNil (t , err )
402+ assert .NotNil (t , result )
403+ assert .Equal (t , expectedIPAddress ().ID , result .ID )
404+ assert .Equal (t , expectedIPAddress ().Address , result .Address )
405+ assert .Equal (t , expectedIPAddress ().Description + warningComment , result .Description )
406+ assert .Equal (t , expectedIPAddress ().Comments + warningComment , result .Comments )
407+ assert .Equal (t , * expectedIPAddress ().Status , * result .Status )
408+ })
409+
362410 t .Run ("Check ReserveOrUpdate with hash mismatch" , func (t * testing.T ) {
363411 inputList := ipam .NewIpamIPAddressesListParams ().WithAddress (& ipAddress )
364412 outputList := & ipam.IpamIPAddressesListOK {
0 commit comments