Skip to content
Snippets Groups Projects
Commit 97e34ba1 authored by Daniel Czerwonk's avatar Daniel Czerwonk
Browse files

fixed test

parent aeb53527
No related branches found
No related tags found
No related merge requests found
Showing
with 59 additions and 16 deletions
......@@ -56,6 +56,7 @@ go_test(
"//routingtable:go_default_library",
"//routingtable/filter:go_default_library",
"//routingtable/locRIB:go_default_library",
"//testing:go_default_library",
"//vendor/github.com/stretchr/testify/assert:go_default_library",
],
)
......@@ -4,6 +4,7 @@ import (
"testing"
"github.com/bio-routing/bio-rd/protocols/bgp/packet"
btesting "github.com/bio-routing/bio-rd/testing"
"github.com/stretchr/testify/assert"
)
......@@ -68,6 +69,7 @@ func TestOpenMsgReceived(t *testing.T) {
fsm := newFSM2(&peer{
peerASN: test.asn,
})
fsm.con = &btesting.MockConn{}
s := &openSentState{
fsm: fsm,
......
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["conn_mock.go"],
importpath = "github.com/bio-routing/bio-rd/testing",
visibility = ["//visibility:public"],
)
package testing
import "net"
// MockConn mock an connection
type MockConn struct {
net.Conn
// Bytes are the bytes writen
Bytes []byte
}
func NewMockConn() *MockConn {
return &MockConn{
Bytes: make([]byte, 0),
}
}
func (m *MockConn) Write(b []byte) (int, error) {
m.Bytes = append(m.Bytes, b...)
return len(b), nil
}
func (m *MockConn) Read(b []byte) (n int, err error) {
count := len(b)
if count > len(m.Bytes) {
count = len(m.Bytes)
}
copy(m.Bytes[0:count], b)
return count, nil
}
......@@ -13,7 +13,7 @@ go_library(
"union.go",
"version.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/Masterminds/semver",
importmap = "vendor/github.com/Masterminds/semver",
importpath = "github.com/Masterminds/semver",
visibility = ["//visibility:public"],
)
......@@ -12,7 +12,7 @@ go_library(
"vcs_local_lookup.go",
"vcs_remote_lookup.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/Masterminds/vcs",
importmap = "vendor/github.com/Masterminds/vcs",
importpath = "github.com/Masterminds/vcs",
visibility = ["//visibility:public"],
)
......@@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["radix.go"],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/armon/go-radix",
importmap = "vendor/github.com/armon/go-radix",
importpath = "github.com/armon/go-radix",
visibility = ["//visibility:public"],
)
......@@ -26,7 +26,7 @@ go_library(
"page.go",
"tx.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/boltdb/bolt",
importmap = "vendor/github.com/boltdb/bolt",
importpath = "github.com/boltdb/bolt",
visibility = ["//visibility:public"],
deps = select({
......
......@@ -11,7 +11,7 @@ go_library(
"format.go",
"spew.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/davecgh/go-spew/spew",
importmap = "vendor/github.com/davecgh/go-spew/spew",
importpath = "github.com/davecgh/go-spew/spew",
visibility = ["//visibility:public"],
)
......@@ -17,7 +17,7 @@ go_library(
"yamlh.go",
"yamlprivateh.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/go-yaml/yaml",
importmap = "vendor/github.com/go-yaml/yaml",
importpath = "github.com/go-yaml/yaml",
visibility = ["//visibility:public"],
)
......@@ -11,7 +11,7 @@ go_library(
"project.go",
"txn_writer.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep",
importmap = "vendor/github.com/golang/dep",
importpath = "github.com/golang/dep",
visibility = ["//visibility:public"],
deps = [
......
......@@ -16,7 +16,7 @@ go_library(
"status.go",
"version.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/cmd/dep",
importmap = "vendor/github.com/golang/dep/cmd/dep",
importpath = "github.com/golang/dep/cmd/dep",
visibility = ["//visibility:private"],
deps = [
......
......@@ -42,7 +42,7 @@ go_library(
"version_queue.go",
"version_unifier.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/gps",
importmap = "vendor/github.com/golang/dep/gps",
importpath = "github.com/golang/dep/gps",
visibility = ["//visibility:public"],
deps = [
......
......@@ -6,7 +6,7 @@ go_library(
"pb.go",
"source_cache.pb.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/gps/internal/pb",
importmap = "vendor/github.com/golang/dep/gps/internal/pb",
importpath = "github.com/golang/dep/gps/internal/pb",
visibility = ["//vendor/github.com/golang/dep/gps:__subpackages__"],
deps = ["//vendor/github.com/golang/protobuf/proto:go_default_library"],
......
......@@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["paths.go"],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/gps/paths",
importmap = "vendor/github.com/golang/dep/gps/paths",
importpath = "github.com/golang/dep/gps/paths",
visibility = ["//visibility:public"],
)
......@@ -9,7 +9,7 @@ go_library(
"pkgtree.go",
"reachmap.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/gps/pkgtree",
importmap = "vendor/github.com/golang/dep/gps/pkgtree",
importpath = "github.com/golang/dep/gps/pkgtree",
visibility = ["//visibility:public"],
deps = [
......
......@@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/hack/licenseok",
importmap = "vendor/github.com/golang/dep/hack/licenseok",
importpath = "github.com/golang/dep/hack/licenseok",
visibility = ["//visibility:private"],
)
......
......@@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["feedback.go"],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/internal/feedback",
importmap = "vendor/github.com/golang/dep/internal/feedback",
importpath = "github.com/golang/dep/internal/feedback",
visibility = ["//vendor/github.com/golang/dep:__subpackages__"],
deps = ["//vendor/github.com/golang/dep/gps:go_default_library"],
......
......@@ -7,7 +7,7 @@ go_library(
"rename.go",
"rename_windows.go",
],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/internal/fs",
importmap = "vendor/github.com/golang/dep/internal/fs",
importpath = "github.com/golang/dep/internal/fs",
visibility = ["//vendor/github.com/golang/dep:__subpackages__"],
deps = ["//vendor/github.com/pkg/errors:go_default_library"],
......
......@@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["importers.go"],
importmap = "github.com/bio-routing/bio-rd/vendor/github.com/golang/dep/internal/importers",
importmap = "vendor/github.com/golang/dep/internal/importers",
importpath = "github.com/golang/dep/internal/importers",
visibility = ["//vendor/github.com/golang/dep:__subpackages__"],
deps = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment