Skip to content

Commit af9600b

Browse files
committed
clean up
1 parent cef67fc commit af9600b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

internal/nginx/nginx_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,9 @@ func (n *NginxPlugin) rollbackConfigApply(ctx context.Context, correlationID, in
623623
func (n *NginxPlugin) completeConfigApply(ctx context.Context, configContext *model.NginxConfigContext,
624624
dpResponse *mpi.DataPlaneResponse,
625625
) {
626-
n.messagePipe.Process(ctx, &bus.Message{Topic: bus.DataPlaneResponseTopic, Data: dpResponse})
627626
n.fileManagerService.ClearCache()
628627
n.enableWatchers(ctx, configContext, dpResponse.GetInstanceId())
628+
n.messagePipe.Process(ctx, &bus.Message{Topic: bus.DataPlaneResponseTopic, Data: dpResponse})
629629
}
630630

631631
func (n *NginxPlugin) enableWatchers(ctx context.Context, configContext *model.NginxConfigContext, instanceID string) {

internal/nginx/nginx_plugin_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -886,18 +886,20 @@ func TestNginx_Process_handleConfigApplyRequest(t *testing.T) {
886886
dataPlaneResponse.GetCommandResponse().GetMessage())
887887
assert.Equal(t, test.configApplyReturnsErr.Error(), dataPlaneResponse.GetCommandResponse().GetError())
888888

889-
dataPlaneResponse, ok = messages[1].Data.(*mpi.DataPlaneResponse)
889+
assert.Equal(t, bus.EnableWatchersTopic, messages[1].Topic)
890+
891+
dataPlaneResponse, ok = messages[2].Data.(*mpi.DataPlaneResponse)
890892
assert.True(t, ok)
891893
assert.Equal(t, "Config apply failed, rollback successful",
892894
dataPlaneResponse.GetCommandResponse().GetMessage())
893895
assert.Equal(t, mpi.CommandResponse_COMMAND_STATUS_FAILURE,
894896
dataPlaneResponse.GetCommandResponse().GetStatus())
895897

896-
assert.Equal(t, bus.EnableWatchersTopic, messages[2].Topic)
897898
case test.configApplyStatus == model.NoChange:
898899
assert.Len(t, messages, 2)
900+
assert.Equal(t, bus.EnableWatchersTopic, messages[0].Topic)
899901

900-
response, ok := messages[0].Data.(*mpi.DataPlaneResponse)
902+
response, ok := messages[1].Data.(*mpi.DataPlaneResponse)
901903
assert.True(t, ok)
902904
assert.Equal(t, 1, fakeFileManagerService.ClearCacheCallCount())
903905
assert.Equal(
@@ -911,13 +913,13 @@ func TestNginx_Process_handleConfigApplyRequest(t *testing.T) {
911913
response.GetCommandResponse().GetStatus(),
912914
)
913915

914-
assert.Equal(t, bus.EnableWatchersTopic, messages[1].Topic)
915-
916916
case test.message == nil:
917917
assert.Empty(t, messages)
918918
default:
919919
assert.Len(t, messages, 2)
920-
dataPlaneResponse, ok := messages[0].Data.(*mpi.DataPlaneResponse)
920+
assert.Equal(t, bus.EnableWatchersTopic, messages[0].Topic)
921+
922+
dataPlaneResponse, ok := messages[1].Data.(*mpi.DataPlaneResponse)
921923
assert.True(t, ok)
922924
assert.Equal(
923925
t,
@@ -926,7 +928,6 @@ func TestNginx_Process_handleConfigApplyRequest(t *testing.T) {
926928
)
927929
assert.Equal(t, "Config apply failed", dataPlaneResponse.GetCommandResponse().GetMessage())
928930
assert.Equal(t, test.configApplyReturnsErr.Error(), dataPlaneResponse.GetCommandResponse().GetError())
929-
assert.Equal(t, bus.EnableWatchersTopic, messages[1].Topic)
930931
}
931932
})
932933
}

0 commit comments

Comments
 (0)