mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 11:40:06 +00:00
Add missing mock assertions
This commit is contained in:
parent
adff2eef16
commit
547fb9570e
@ -4,6 +4,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
time "time"
|
time "time"
|
||||||
|
|
||||||
|
"github.com/hashicorp/go-memdb"
|
||||||
"github.com/hashicorp/raft"
|
"github.com/hashicorp/raft"
|
||||||
autopilot "github.com/hashicorp/raft-autopilot"
|
autopilot "github.com/hashicorp/raft-autopilot"
|
||||||
mock "github.com/stretchr/testify/mock"
|
mock "github.com/stretchr/testify/mock"
|
||||||
@ -164,7 +165,7 @@ func TestAutopilotStateToReadyServersWithTaggedAddresses(t *testing.T) {
|
|||||||
types.NodeID("792ae13c-d765-470b-852c-e073fdb6e849"),
|
types.NodeID("792ae13c-d765-470b-852c-e073fdb6e849"),
|
||||||
structs.NodeEnterpriseMetaInDefaultPartition(),
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
structs.DefaultPeerKeyword,
|
structs.DefaultPeerKeyword,
|
||||||
).Once().Return(
|
).Times(2).Return(
|
||||||
uint64(0),
|
uint64(0),
|
||||||
&structs.Node{TaggedAddresses: map[string]string{"wan": "5.4.3.2"}},
|
&structs.Node{TaggedAddresses: map[string]string{"wan": "5.4.3.2"}},
|
||||||
nil,
|
nil,
|
||||||
@ -174,7 +175,7 @@ func TestAutopilotStateToReadyServersWithTaggedAddresses(t *testing.T) {
|
|||||||
types.NodeID("65e79ff4-bbce-467b-a9d6-725c709fa985"),
|
types.NodeID("65e79ff4-bbce-467b-a9d6-725c709fa985"),
|
||||||
structs.NodeEnterpriseMetaInDefaultPartition(),
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
structs.DefaultPeerKeyword,
|
structs.DefaultPeerKeyword,
|
||||||
).Once().Return(
|
).Times(2).Return(
|
||||||
uint64(0),
|
uint64(0),
|
||||||
&structs.Node{TaggedAddresses: map[string]string{"wan": "1.2.3.4"}},
|
&structs.Node{TaggedAddresses: map[string]string{"wan": "1.2.3.4"}},
|
||||||
nil,
|
nil,
|
||||||
@ -184,12 +185,24 @@ func TestAutopilotStateToReadyServersWithTaggedAddresses(t *testing.T) {
|
|||||||
types.NodeID("db11f0ac-0cbe-4215-80cc-b4e843f4df1e"),
|
types.NodeID("db11f0ac-0cbe-4215-80cc-b4e843f4df1e"),
|
||||||
structs.NodeEnterpriseMetaInDefaultPartition(),
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
structs.DefaultPeerKeyword,
|
structs.DefaultPeerKeyword,
|
||||||
).Once().Return(
|
).Times(2).Return(
|
||||||
uint64(0),
|
uint64(0),
|
||||||
&structs.Node{TaggedAddresses: map[string]string{"wan": "9.8.7.6"}},
|
&structs.Node{TaggedAddresses: map[string]string{"wan": "9.8.7.6"}},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
store.On("NodeService",
|
||||||
|
memdb.WatchSet(nil),
|
||||||
|
"",
|
||||||
|
structs.ConsulServiceID,
|
||||||
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
|
structs.DefaultPeerKeyword,
|
||||||
|
).Times(3).Return(
|
||||||
|
uint64(0),
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
|
||||||
r := NewReadyServersEventPublisher(Config{
|
r := NewReadyServersEventPublisher(Config{
|
||||||
GetStore: func() StateStore { return store },
|
GetStore: func() StateStore { return store },
|
||||||
})
|
})
|
||||||
@ -493,7 +506,7 @@ func TestReadyServerEventsSnapshotHandler(t *testing.T) {
|
|||||||
types.NodeID("792ae13c-d765-470b-852c-e073fdb6e849"),
|
types.NodeID("792ae13c-d765-470b-852c-e073fdb6e849"),
|
||||||
structs.NodeEnterpriseMetaInDefaultPartition(),
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
structs.DefaultPeerKeyword,
|
structs.DefaultPeerKeyword,
|
||||||
).Once().Return(
|
).Times(2).Return(
|
||||||
uint64(0),
|
uint64(0),
|
||||||
&structs.Node{TaggedAddresses: map[string]string{"wan": "5.4.3.2"}},
|
&structs.Node{TaggedAddresses: map[string]string{"wan": "5.4.3.2"}},
|
||||||
nil,
|
nil,
|
||||||
@ -503,7 +516,7 @@ func TestReadyServerEventsSnapshotHandler(t *testing.T) {
|
|||||||
types.NodeID("65e79ff4-bbce-467b-a9d6-725c709fa985"),
|
types.NodeID("65e79ff4-bbce-467b-a9d6-725c709fa985"),
|
||||||
structs.NodeEnterpriseMetaInDefaultPartition(),
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
structs.DefaultPeerKeyword,
|
structs.DefaultPeerKeyword,
|
||||||
).Once().Return(
|
).Times(2).Return(
|
||||||
uint64(0),
|
uint64(0),
|
||||||
&structs.Node{TaggedAddresses: map[string]string{"wan": "1.2.3.4"}},
|
&structs.Node{TaggedAddresses: map[string]string{"wan": "1.2.3.4"}},
|
||||||
nil,
|
nil,
|
||||||
@ -513,12 +526,24 @@ func TestReadyServerEventsSnapshotHandler(t *testing.T) {
|
|||||||
types.NodeID("db11f0ac-0cbe-4215-80cc-b4e843f4df1e"),
|
types.NodeID("db11f0ac-0cbe-4215-80cc-b4e843f4df1e"),
|
||||||
structs.NodeEnterpriseMetaInDefaultPartition(),
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
structs.DefaultPeerKeyword,
|
structs.DefaultPeerKeyword,
|
||||||
).Once().Return(
|
).Times(2).Return(
|
||||||
uint64(0),
|
uint64(0),
|
||||||
&structs.Node{TaggedAddresses: map[string]string{"wan": "9.8.7.6"}},
|
&structs.Node{TaggedAddresses: map[string]string{"wan": "9.8.7.6"}},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
store.On("NodeService",
|
||||||
|
memdb.WatchSet(nil),
|
||||||
|
"",
|
||||||
|
structs.ConsulServiceID,
|
||||||
|
structs.NodeEnterpriseMetaInDefaultPartition(),
|
||||||
|
structs.DefaultPeerKeyword,
|
||||||
|
).Times(3).Return(
|
||||||
|
uint64(0),
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
buf.AssertExpectations(t)
|
buf.AssertExpectations(t)
|
||||||
store.AssertExpectations(t)
|
store.AssertExpectations(t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user