Skip to content

Commit

Permalink
Added a few test code
Browse files Browse the repository at this point in the history
  • Loading branch information
kopwei committed Mar 29, 2016
1 parent 707f035 commit 4689d20
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ovsbridge_test.go
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
package goovs

import (
"testing"
)

func TestBridgeExists(t *testing.T) {
brname := "nonexistentbr"

}
5 changes: 5 additions & 0 deletions ovsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type OvsClient interface {
FindAllPortsOnBridge(brname string) ([]string, error)
PortExistsOnBridge(portname, brname string) (bool, error)
RemoveInterfaceFromPort(portname, interfaceUUID string) error
Disconnect()
}

type ovsClient struct {
Expand Down Expand Up @@ -127,6 +128,10 @@ func GetOVSClient(contype, endpoint string) (OvsClient, error) {
return client, nil
}

func (client *ovsClient) Disconnect() {
client.dbClient.Disconnect()
}

func (client *ovsClient) transact(operations []libovsdb.Operation, action string) error {
reply, _ := client.dbClient.Transact(defaultOvsDB, operations...)

Expand Down
13 changes: 13 additions & 0 deletions ovsclient_test.go
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
package goovs

import (
"testing"
)

func preparingEnv() OvsClient{
client, _ := GetOVSClient("tcp", "ovs:6640")
return client
}

func tearDown(client OvsClient) {
client.Disconnect()
}

0 comments on commit 4689d20

Please sign in to comment.