aboutsummaryrefslogtreecommitdiffstats
path: root/core/core_test.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2017-12-04 09:54:13 +0100
committerOndrej Fabry <ofabry@cisco.com>2017-12-04 09:54:13 +0100
commitde8e6592e23a3819266cea5e9999c7c21fdd826f (patch)
treeb0b3eaf9cc92e36ef1944cb1a4eb09df8ec3cf6b /core/core_test.go
parentacf57209ccbd67fa96644abe5aef65f58264c112 (diff)
Fix events for mock adapter
Change-Id: Iee5fa6282e845ed2aef76c9246a9068f3765139c Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'core/core_test.go')
-rw-r--r--core/core_test.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/core/core_test.go b/core/core_test.go
index 3184ef5..37c0b9c 100644
--- a/core/core_test.go
+++ b/core/core_test.go
@@ -12,13 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package core
+package core_test
import (
"testing"
"git.fd.io/govpp.git/adapter/mock"
"git.fd.io/govpp.git/api"
+ "git.fd.io/govpp.git/core"
"git.fd.io/govpp.git/core/bin_api/vpe"
"git.fd.io/govpp.git/examples/bin_api/interfaces"
@@ -27,7 +28,7 @@ import (
type testCtx struct {
mockVpp *mock.VppAdapter
- conn *Connection
+ conn *core.Connection
ch *api.Channel
}
@@ -38,7 +39,7 @@ func setupTest(t *testing.T) *testCtx {
ctx.mockVpp = &mock.VppAdapter{}
var err error
- ctx.conn, err = Connect(ctx.mockVpp)
+ ctx.conn, err = core.Connect(ctx.mockVpp)
Expect(err).ShouldNot(HaveOccurred())
ctx.ch, err = ctx.conn.NewAPIChannel()
@@ -146,7 +147,7 @@ func TestNotifications(t *testing.T) {
func TestNilConnection(t *testing.T) {
RegisterTestingT(t)
- var conn *Connection
+ var conn *core.Connection
ch, err := conn.NewAPIChannel()
Expect(ch).Should(BeNil())
@@ -163,7 +164,7 @@ func TestDoubleConnection(t *testing.T) {
ctx := setupTest(t)
defer ctx.teardownTest()
- conn, err := Connect(ctx.mockVpp)
+ conn, err := core.Connect(ctx.mockVpp)
Expect(err).Should(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("only one connection per process"))
Expect(conn).Should(BeNil())
@@ -174,14 +175,14 @@ func TestAsyncConnection(t *testing.T) {
defer ctx.teardownTest()
ctx.conn.Disconnect()
- conn, ch, err := AsyncConnect(ctx.mockVpp)
+ conn, ch, err := core.AsyncConnect(ctx.mockVpp)
ctx.conn = conn
Expect(err).ShouldNot(HaveOccurred())
Expect(conn).ShouldNot(BeNil())
ev := <-ch
- Expect(ev.State).Should(BeEquivalentTo(Connected))
+ Expect(ev.State).Should(BeEquivalentTo(core.Connected))
}
func TestFullBuffer(t *testing.T) {
@@ -218,7 +219,7 @@ func TestFullBuffer(t *testing.T) {
func TestCodec(t *testing.T) {
RegisterTestingT(t)
- codec := &MsgCodec{}
+ codec := &core.MsgCodec{}
// request
data, err := codec.EncodeMsg(&vpe.CreateLoopback{MacAddress: []byte{1, 2, 3, 4, 5, 6}}, 11)
@@ -254,7 +255,7 @@ func TestCodec(t *testing.T) {
func TestCodecNegative(t *testing.T) {
RegisterTestingT(t)
- codec := &MsgCodec{}
+ codec := &core.MsgCodec{}
// nil message for encoding
data, err := codec.EncodeMsg(nil, 15)