Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukedirtwalker committed Dec 13, 2018
1 parent dbdc873 commit f524677
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ MOCK_SRC_IN =\
lib/snet/snetproxy/reconnecter.go \
lib/snet/snetproxy/io.go \
lib/log/wrappers.go \
lib/sciond/sciond.go
lib/sciond/sciond.go \
lib/infra/modules/trust/trustdb/trustdb.go
MOCK_SRC_OUT = $(foreach in,$(MOCK_SRC_IN),$(call mock_src_in_to_out,$(in)))
# This uses the format <stdlib package>/<interface>:
MOCK_STD_IN = net/Addr net/PacketConn
Expand Down
14 changes: 12 additions & 2 deletions go/cert_srv/internal/csconfig/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ package csconfig
import (
"testing"

"github.com/golang/mock/gomock"
. "github.com/smartystreets/goconvey/convey"

"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/infra/modules/trust/trustdb/mock_trustdb"
"github.com/scionproto/scion/go/lib/keyconf"
"github.com/scionproto/scion/go/lib/scrypto"
"github.com/scionproto/scion/go/lib/xtest"
)

var (
Expand All @@ -33,8 +37,14 @@ var (
)

func TestLoadState(t *testing.T) {
key := common.RawBytes([]byte("aaaaaaa"))
Convey("Load core state", t, func() {
state, err := LoadState("testdata", true)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
trustDB := mock_trustdb.NewMockTrustDB(ctrl)
ia := xtest.MustParseIA("1-ff00:0:110")
trustDB.EXPECT().InsertCustKey(gomock.Any(), gomock.Eq(ia), uint64(1), gomock.Eq(key))
state, err := LoadState("testdata", true, trustDB, nil)
SoMsg("err", err, ShouldBeNil)
SoMsg("Master0", state.keyConf.Master.Key0, ShouldResemble, mstr0)
SoMsg("Master1", state.keyConf.Master.Key1, ShouldResemble, mstr1)
Expand All @@ -46,7 +56,7 @@ func TestLoadState(t *testing.T) {
})

Convey("Load non-core state", t, func() {
state, err := LoadState("testdata", false)
state, err := LoadState("testdata", false, nil, nil)
SoMsg("err", err, ShouldBeNil)
SoMsg("Master0", state.keyConf.Master.Key0, ShouldResemble, mstr0)
SoMsg("Master1", state.keyConf.Master.Key1, ShouldResemble, mstr1)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
YWFhYWFhYQ==

0 comments on commit f524677

Please sign in to comment.