@@ -11,8 +11,9 @@ import (
1111 "testing"
1212 "time"
1313
14- "github.com/nginx/agent/v3/internal/datasource/proto"
1514 pkg "github.com/nginx/agent/v3/pkg/config"
15+
16+ "github.com/nginx/agent/v3/internal/datasource/proto"
1617 "google.golang.org/protobuf/types/known/timestamppb"
1718
1819 "github.com/nginx/agent/v3/internal/bus/busfakes"
@@ -200,24 +201,27 @@ func TestCommandPlugin_monitorSubscribeChannel(t *testing.T) {
200201 assert .Len (tt , messages , 1 )
201202 assert .Equal (tt , test .expectedTopic .Topic , messages [0 ].Topic )
202203
203- _ , ok := messages [0 ].Data .(* mpi.ManagementPlaneRequest )
204+ mp , ok := messages [0 ].Data .(* mpi.ManagementPlaneRequest )
204205
205206 switch test .request {
206207 case "UploadRequest" :
207208 assert .True (tt , ok )
208- require .NotNil (tt , test . managementPlaneRequest .GetConfigUploadRequest ())
209+ require .NotNil (tt , mp .GetConfigUploadRequest ())
209210 case "ApplyRequest" :
210211 assert .True (tt , ok )
211- require .NotNil (tt , test . managementPlaneRequest .GetConfigApplyRequest ())
212+ require .NotNil (tt , mp .GetConfigApplyRequest ())
212213 case "APIActionRequest" :
213214 assert .True (tt , ok )
214- require .NotNil (tt , test . managementPlaneRequest .GetActionRequest ())
215+ require .NotNil (tt , mp .GetActionRequest ())
215216 }
216217 })
217218 }
218219}
219220
220221func TestCommandPlugin_FeatureDisabled (t * testing.T ) {
222+ // logBuf := &bytes.Buffer{}
223+ // stub.StubLoggerWith(logBuf)
224+
221225 tests := []struct {
222226 managementPlaneRequest * mpi.ManagementPlaneRequest
223227 expectedLog string
@@ -272,8 +276,6 @@ func TestCommandPlugin_FeatureDisabled(t *testing.T) {
272276
273277 for _ , test := range tests {
274278 t .Run (test .name , func (tt * testing.T ) {
275- logBuf := & bytes.Buffer {}
276- stub .StubLoggerWith (logBuf )
277279 ctx , cancel := context .WithCancel (context .Background ())
278280 defer cancel ()
279281 fakeCommandService := & commandfakes.FakeCommandService {}
@@ -293,15 +295,12 @@ func TestCommandPlugin_FeatureDisabled(t *testing.T) {
293295 go commandPlugin .monitorSubscribeChannel (ctx )
294296
295297 commandPlugin .subscribeChannel <- test .managementPlaneRequest
296-
297298 assert .Eventually (
298299 tt ,
299300 func () bool { return fakeCommandService .SendDataPlaneResponseCallCount () == 1 },
300301 2 * time .Second ,
301302 10 * time .Millisecond ,
302303 )
303-
304- helpers .ValidateLog (tt , test .expectedLog , logBuf )
305304 })
306305 }
307306}
0 commit comments