Skip to content

Commit 6963fd4

Browse files
committed
adding general fix for manager
1 parent 04f6e30 commit 6963fd4

File tree

4 files changed

+274
-5
lines changed

4 files changed

+274
-5
lines changed

internal/mode/static/nginx/runtime/manager.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,10 @@ func (m *ManagerImpl) GetUpstreams() (ngxclient.Upstreams, error) {
194194
}
195195

196196
func NewProcessHandlerImpl(readFile ReadFileFunc, checkFile CheckFileFunc) *ProcessHandlerImpl {
197-
ph := &ProcessHandlerImpl{
197+
return &ProcessHandlerImpl{
198198
readFile: readFile,
199199
checkFile: checkFile,
200200
}
201-
202-
return ph
203201
}
204202

205203
func (p *ProcessHandlerImpl) FindMainProcess(

internal/mode/static/nginx/runtime/manager_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ func TestFindMainProcess(t *testing.T) {
237237
for _, test := range tests {
238238
t.Run(test.name, func(t *testing.T) {
239239
g := NewWithT(t)
240-
p := runtime.NewProcessHandlerImpl{}
240+
p := runtime.NewProcessHandlerImpl(
241+
test.readFile,
242+
test.checkFile)
241243
result, err := p.FindMainProcess(test.ctx, 2*time.Millisecond)
242244

243245
if test.expectError {

internal/mode/static/nginx/runtime/runtimefakes/fake_nginx_config_verifier.go

Lines changed: 269 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/mode/static/nginx/runtime/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const configVersionURI = "/var/run/nginx/nginx-config-version.sock"
1919
var noNewWorkersErrFmt = "reload unsuccessful: no new NGINX worker processes started for config version %d." +
2020
" Please check the NGINX container logs for possible configuration issues: %w"
2121

22-
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . verifyClient
22+
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . nginxConfigVerifier
2323

2424
type nginxConfigVerifier interface {
2525
GetConfigVersion() (int, error)

0 commit comments

Comments
 (0)