diff --git a/go.mod b/go.mod index 39f70aee02..b60145abae 100644 --- a/go.mod +++ b/go.mod @@ -705,5 +705,3 @@ replace github.com/pires/go-proxyproto v1.0.0 => github.com/peteski22/go-proxypr // github.com/veraison/go-cose v1.2.0 doesn't exists but required by the latest github.com/Microsoft/hcsshim replace github.com/veraison/go-cose v1.2.0 => github.com/veraison/go-cose v1.1.1 - -replace github.com/fsnotify/fsnotify v1.8.0 => github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index 73b3834af0..1a352e1e0b 100644 --- a/go.sum +++ b/go.sum @@ -494,8 +494,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= diff --git a/internal/configsource/includeconfigsource/package_test.go b/internal/configsource/includeconfigsource/package_test.go new file mode 100644 index 0000000000..f8a18aebb3 --- /dev/null +++ b/internal/configsource/includeconfigsource/package_test.go @@ -0,0 +1,25 @@ +// Copyright Splunk, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package includeconfigsource + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/internal/configsource/includeconfigsource/source.go b/internal/configsource/includeconfigsource/source.go index b4a87157d0..1af6eea569 100644 --- a/internal/configsource/includeconfigsource/source.go +++ b/internal/configsource/includeconfigsource/source.go @@ -109,7 +109,6 @@ func (is *includeConfigSource) watchFile(file string, watcherFunc confmap.Watche } if event.Op&fsnotify.Write == fsnotify.Write { watcherFunc(&confmap.ChangeEvent{Error: nil}) - return } case watcherErr, ok := <-is.watcher.Errors: if !ok { diff --git a/internal/configsource/includeconfigsource/source_test.go b/internal/configsource/includeconfigsource/source_test.go index 1d3abcd470..8554e832df 100644 --- a/internal/configsource/includeconfigsource/source_test.go +++ b/internal/configsource/includeconfigsource/source_test.go @@ -126,9 +126,14 @@ func TestIncludeConfigSource_WatchFileUpdate(t *testing.T) { // Perform initial retrieve watchChannel := make(chan *confmap.ChangeEvent, 1) + watchDone := make(chan struct{}, 1) ctx := context.Background() r, err := s.Retrieve(ctx, dst, nil, func(event *confmap.ChangeEvent) { - watchChannel <- event + t.Log(event) + select { + case watchChannel <- event: + case <-watchDone: + } }) require.NoError(t, err) require.NotNil(t, r) @@ -141,6 +146,7 @@ func TestIncludeConfigSource_WatchFileUpdate(t *testing.T) { require.NoError(t, os.WriteFile(dst, []byte("val2"), 0600)) ce := <-watchChannel + watchDone <- struct{}{} assert.NoError(t, ce.Error) require.NoError(t, r.Close(context.Background()))