From facd5b0ec14d6acc63cbc3190ccc3f9d39913b26 Mon Sep 17 00:00:00 2001 From: wangxinyi7 <121973291+wangxinyi7@users.noreply.github.com> Date: Wed, 9 Aug 2023 09:36:58 -0700 Subject: [PATCH] fix the error in ent repo (#18421) fix the error in ent repo --- agent/agent_endpoint_test.go | 8 ++++++-- agent/agent_test.go | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/agent/agent_endpoint_test.go b/agent/agent_endpoint_test.go index 152a9b9540..6df5275a17 100644 --- a/agent/agent_endpoint_test.go +++ b/agent/agent_endpoint_test.go @@ -1629,7 +1629,9 @@ func TestHTTPHandlers_AgentMetricsStream_ACLDeny(t *testing.T) { bd.MetricsConfig = &lib.MetricsConfig{ Handler: sink, } - d := fakeResolveTokenDelegate{delegate: &delegateMock{}, authorizer: acl.DenyAll()} + mockDelegate := delegateMock{} + mockDelegate.On("LicenseCheck").Return() + d := fakeResolveTokenDelegate{delegate: &mockDelegate, authorizer: acl.DenyAll()} agent := &Agent{ baseDeps: bd, delegate: d, @@ -1658,7 +1660,9 @@ func TestHTTPHandlers_AgentMetricsStream(t *testing.T) { bd.MetricsConfig = &lib.MetricsConfig{ Handler: sink, } - d := fakeResolveTokenDelegate{delegate: &delegateMock{}, authorizer: acl.ManageAll()} + mockDelegate := delegateMock{} + mockDelegate.On("LicenseCheck").Return() + d := fakeResolveTokenDelegate{delegate: &mockDelegate, authorizer: acl.ManageAll()} agent := &Agent{ baseDeps: bd, delegate: d, diff --git a/agent/agent_test.go b/agent/agent_test.go index 646cc34059..495d58c95a 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -346,7 +346,9 @@ func TestAgent_HTTPMaxHeaderBytes(t *testing.T) { require.NoError(t, err) a, err := New(bd) - a.delegate = &delegateMock{} + mockDelegate := delegateMock{} + mockDelegate.On("LicenseCheck").Return() + a.delegate = &mockDelegate require.NoError(t, err) a.startLicenseManager(testutil.TestContext(t)) @@ -5503,7 +5505,9 @@ func TestAgent_ListenHTTP_MultipleAddresses(t *testing.T) { require.NoError(t, err) agent, err := New(bd) - agent.delegate = &delegateMock{} + mockDelegate := delegateMock{} + mockDelegate.On("LicenseCheck").Return() + agent.delegate = &mockDelegate require.NoError(t, err) agent.startLicenseManager(testutil.TestContext(t)) @@ -6097,7 +6101,9 @@ func TestAgent_startListeners(t *testing.T) { require.NoError(t, err) agent, err := New(bd) - agent.delegate = &delegateMock{} + mockDelegate := delegateMock{} + mockDelegate.On("LicenseCheck").Return() + agent.delegate = &mockDelegate require.NoError(t, err) // use up an address @@ -6238,7 +6244,9 @@ func TestAgent_startListeners_scada(t *testing.T) { require.NoError(t, err) agent, err := New(bd) - agent.delegate = &delegateMock{} + mockDelegate := delegateMock{} + mockDelegate.On("LicenseCheck").Return() + agent.delegate = &mockDelegate require.NoError(t, err) _, err = agent.startListeners([]net.Addr{c}) @@ -6294,7 +6302,9 @@ func TestAgent_checkServerLastSeen(t *testing.T) { Config: leafcert.Config{}, }) agent, err := New(bd) - agent.delegate = &delegateMock{} + mockDelegate := delegateMock{} + mockDelegate.On("LicenseCheck").Return() + agent.delegate = &mockDelegate require.NoError(t, err) // Test that an ErrNotExist OS error is treated as ok.