Commit 107d7075 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Rename CloseConnection to simply Close

The go method names should match the C library names in general.
Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
parent 3d300833
......@@ -410,7 +410,7 @@ func NewConnectReadOnly(uri string) (*Connect, error) {
return &Connect{ptr: ptr}, nil
}
func (c *Connect) CloseConnection() (int, error) {
func (c *Connect) Close() (int, error) {
result := int(C.virConnectClose(c.ptr))
if result == -1 {
return result, GetLastError()
......
This diff is collapsed.
......@@ -47,8 +47,8 @@ func TestDomainEventRegister(t *testing.T) {
t.Errorf("got `%v` on DomainEventDeregister instead of nil", err)
}
}
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
......
This diff is collapsed.
This diff is collapsed.
......@@ -54,8 +54,8 @@ func TestCreateDestroyInterface(t *testing.T) {
iface, conn := buildTestInterface(generateRandomMac())
defer func() {
iface.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := iface.Create(0); err != nil {
......@@ -71,8 +71,8 @@ func TestUndefineInterface(t *testing.T) {
iface, conn := buildTestInterface(generateRandomMac())
defer func() {
iface.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
name, err := iface.GetName()
......@@ -93,8 +93,8 @@ func TestGetInterfaceName(t *testing.T) {
iface, conn := buildTestInterface(generateRandomMac())
defer func() {
iface.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := iface.GetName(); err != nil {
......@@ -106,8 +106,8 @@ func TestInterfaceIsActive(t *testing.T) {
iface, conn := buildTestInterface(generateRandomMac())
defer func() {
iface.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := iface.Create(0); err != nil {
......@@ -141,8 +141,8 @@ func TestGetMACString(t *testing.T) {
iface, conn := buildTestInterface(origMac)
defer func() {
iface.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
mac, err := iface.GetMACString()
......@@ -159,8 +159,8 @@ func TestGetInterfaceXMLDesc(t *testing.T) {
iface, conn := buildTestInterface(generateRandomMac())
defer func() {
iface.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := iface.GetXMLDesc(0); err != nil {
......@@ -171,8 +171,8 @@ func TestGetInterfaceXMLDesc(t *testing.T) {
func TestInterfaceFree(t *testing.T) {
iface, conn := buildTestInterface(generateRandomMac())
defer func() {
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := iface.Free(); err != nil {
......
......@@ -50,8 +50,8 @@ func TestNetworkEventRegister(t *testing.T) {
t.Errorf("got `%v` on NetworkEventDeregister instead of nil", err)
}
}
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
......
......@@ -62,8 +62,8 @@ func TestGetNetworkName(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := net.GetName(); err != nil {
......@@ -76,8 +76,8 @@ func TestGetNetworkUUID(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
_, err := net.GetUUID()
......@@ -91,8 +91,8 @@ func TestGetNetworkUUIDString(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
_, err := net.GetUUIDString()
......@@ -106,8 +106,8 @@ func TestGetNetworkXMLDesc(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := net.GetXMLDesc(0); err != nil {
......@@ -120,8 +120,8 @@ func TestCreateDestroyNetwork(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := net.Create(); err != nil {
......@@ -139,8 +139,8 @@ func TestNetworkAutostart(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
as, err := net.GetAutostart()
......@@ -171,8 +171,8 @@ func TestNetworkIsActive(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := net.Create(); err != nil {
......@@ -207,8 +207,8 @@ func TestNetworkGetBridgeName(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := net.Create(); err != nil {
......@@ -225,8 +225,8 @@ func TestNetworkGetBridgeName(t *testing.T) {
func TestNetworkFree(t *testing.T) {
net, conn := buildTestNetwork("")
defer func() {
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := net.Free(); err != nil {
......@@ -244,8 +244,8 @@ func TestNetworkCreateXML(t *testing.T) {
}
defer func() {
net.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
......
......@@ -50,8 +50,8 @@ func TestNodeDeviceEventRegister(t *testing.T) {
t.Errorf("got `%v` on NodeDeviceEventDeregister instead of nil", err)
}
}
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
......
......@@ -50,8 +50,8 @@ func TestStoragePoolEventRegister(t *testing.T) {
t.Errorf("got `%v` on StoragePoolEventDeregister instead of nil", err)
}
}
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
......
......@@ -56,8 +56,8 @@ func TestStoragePoolBuild(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Build(STORAGE_POOL_BUILD_NEW); err != nil {
......@@ -69,8 +69,8 @@ func TestUndefineStoragePool(t *testing.T) {
pool, conn := buildTestStoragePool("")
defer func() {
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
name, err := pool.GetName()
......@@ -93,8 +93,8 @@ func TestGetStoragePoolName(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := pool.GetName(); err != nil {
......@@ -107,8 +107,8 @@ func TestGetStoragePoolUUID(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := pool.GetUUID(); err != nil {
......@@ -121,8 +121,8 @@ func TestGetStoragePoolUUIDString(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := pool.GetUUIDString(); err != nil {
......@@ -135,8 +135,8 @@ func TestGetStoragePoolInfo(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := pool.GetInfo(); err != nil {
......@@ -149,8 +149,8 @@ func TestGetStoragePoolXMLDesc(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if _, err := pool.GetXMLDesc(0); err != nil {
......@@ -164,8 +164,8 @@ func TestStoragePoolRefresh(t *testing.T) {
pool.Destroy()
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -182,8 +182,8 @@ func TestCreateDestroyStoragePool(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -218,8 +218,8 @@ func TestStoragePoolAutostart(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
as, err := pool.GetAutostart()
......@@ -249,8 +249,8 @@ func TestStoragePoolIsActive(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
......@@ -285,8 +285,8 @@ func TestStorageVolCreateDelete(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -309,8 +309,8 @@ func TestStorageVolCreateFromDelete(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -348,8 +348,8 @@ func TestLookupStorageVolByName(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......
......@@ -57,8 +57,8 @@ func TestStorageVolGetInfo(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -85,8 +85,8 @@ func TestStorageVolGetKey(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -113,8 +113,8 @@ func TestStorageVolGetName(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -141,8 +141,8 @@ func TestStorageVolGetPath(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -169,8 +169,8 @@ func TestStorageVolGetXMLDesc(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......@@ -197,8 +197,8 @@ func TestPoolLookupByVolume(t *testing.T) {
defer func() {
pool.Undefine()
pool.Free()
if res, _ := conn.CloseConnection(); res != 0 {
t.Errorf("CloseConnection() == %d, expected 0", res)
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := pool.Create(0); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment