agent: make registerEndpoint private

This is only used for testing.
This commit is contained in:
Frank Schroeder 2017-06-19 16:36:09 +02:00 committed by Frank Schröder
parent 2b41f2e3a3
commit c4fc581e07
4 changed files with 30 additions and 30 deletions

View File

@ -47,7 +47,7 @@ func TestACL_Version8(t *testing.T) {
defer a.Shutdown()
m := MockServer{}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -70,7 +70,7 @@ func TestACL_Disabled(t *testing.T) {
defer a.Shutdown()
m := MockServer{}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -123,7 +123,7 @@ func TestACL_Special_IDs(t *testing.T) {
defer a.Shutdown()
m := MockServer{}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -176,7 +176,7 @@ func TestACL_Down_Deny(t *testing.T) {
defer a.Shutdown()
m := MockServer{}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -206,7 +206,7 @@ func TestACL_Down_Allow(t *testing.T) {
defer a.Shutdown()
m := MockServer{}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -236,7 +236,7 @@ func TestACL_Down_Extend(t *testing.T) {
defer a.Shutdown()
m := MockServer{}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -313,7 +313,7 @@ func TestACL_Cache(t *testing.T) {
defer a.Shutdown()
m := MockServer{}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -495,7 +495,7 @@ func TestACL_vetServiceRegister(t *testing.T) {
defer a.Shutdown()
m := MockServer{catalogPolicy}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -541,7 +541,7 @@ func TestACL_vetServiceUpdate(t *testing.T) {
defer a.Shutdown()
m := MockServer{catalogPolicy}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -577,7 +577,7 @@ func TestACL_vetCheckRegister(t *testing.T) {
defer a.Shutdown()
m := MockServer{catalogPolicy}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -660,7 +660,7 @@ func TestACL_vetCheckUpdate(t *testing.T) {
defer a.Shutdown()
m := MockServer{catalogPolicy}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -716,7 +716,7 @@ func TestACL_filterMembers(t *testing.T) {
defer a.Shutdown()
m := MockServer{catalogPolicy}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -752,7 +752,7 @@ func TestACL_filterServices(t *testing.T) {
defer a.Shutdown()
m := MockServer{catalogPolicy}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -783,7 +783,7 @@ func TestACL_filterChecks(t *testing.T) {
defer a.Shutdown()
m := MockServer{catalogPolicy}
if err := a.RegisterEndpoint("ACL", &m); err != nil {
if err := a.registerEndpoint("ACL", &m); err != nil {
t.Fatalf("err: %v", err)
}

View File

@ -1067,11 +1067,11 @@ LOAD:
return nil
}
// RegisterEndpoint registers a handler for the consul RPC server
// registerEndpoint registers a handler for the consul RPC server
// under a unique name while making it accessible under the provided
// name. This allows overwriting handlers for the golang net/rpc
// service which does not allow this.
func (a *Agent) RegisterEndpoint(name string, handler interface{}) error {
func (a *Agent) registerEndpoint(name string, handler interface{}) error {
srv, ok := a.delegate.(*consul.Server)
if !ok {
panic("agent must be a server")

View File

@ -3932,7 +3932,7 @@ func TestDNS_PreparedQuery_AllowStale(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -4013,7 +4013,7 @@ func TestDNS_PreparedQuery_AgentSource(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}

View File

@ -74,7 +74,7 @@ func TestPreparedQuery_Create(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -159,7 +159,7 @@ func TestPreparedQuery_List(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -192,7 +192,7 @@ func TestPreparedQuery_List(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -242,7 +242,7 @@ func TestPreparedQuery_Execute(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -275,7 +275,7 @@ func TestPreparedQuery_Execute(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -331,7 +331,7 @@ func TestPreparedQuery_Execute(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -365,7 +365,7 @@ func TestPreparedQuery_Execute(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -415,7 +415,7 @@ func TestPreparedQuery_Execute(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -479,7 +479,7 @@ func TestPreparedQuery_Explain(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -552,7 +552,7 @@ func TestPreparedQuery_Get(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -617,7 +617,7 @@ func TestPreparedQuery_Update(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}
@ -695,7 +695,7 @@ func TestPreparedQuery_Delete(t *testing.T) {
defer a.Shutdown()
m := MockPreparedQuery{}
if err := a.RegisterEndpoint("PreparedQuery", &m); err != nil {
if err := a.registerEndpoint("PreparedQuery", &m); err != nil {
t.Fatalf("err: %v", err)
}