Skip to content

Commit e0870f7

Browse files
committed
[Ingest Manager] Fix failing unit tests on windows (elastic#20127)
* remove skip * close properly * changelog * space
1 parent 632dd18 commit e0870f7

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

x-pack/elastic-agent/CHANGELOG.asciidoc

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
- Remove support for logs type and use logfile {pull}19761[19761]
5353
- Avoid comparing uncomparable types on enroll {issue}19976[19976]
5454
- Fix issues with merging of elastic-agent.yml and fleet.yml {pull}20026[20026]
55+
<<<<<<< HEAD
56+
=======
57+
- Unzip failures on Windows 8/Windows server 2012 {pull}20088[20088]
58+
- Fix failing unit tests on windows {pull}20127[20127]
59+
>>>>>>> fe79a0720... [Ingest Manager] Fix failing unit tests on windows (#20127)
5560
5661
==== New features
5762

x-pack/elastic-agent/pkg/agent/application/action_store.go

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func newActionStore(log *logger.Logger, store storeLoad) (*actionStore, error) {
3333
if err != nil {
3434
return &actionStore{log: log, store: store}, nil
3535
}
36+
defer reader.Close()
3637

3738
var action actionConfigChangeSerializer
3839

x-pack/elastic-agent/pkg/agent/application/action_store_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"io/ioutil"
1010
"os"
1111
"path/filepath"
12-
"runtime"
1312
"testing"
1413

1514
"github.com/stretchr/testify/require"
@@ -20,10 +19,6 @@ import (
2019
)
2120

2221
func TestActionStore(t *testing.T) {
23-
if runtime.GOOS == "windows" {
24-
t.Skip("Skipping on windows see https://github.com/elastic/beats/issues/19919")
25-
}
26-
2722
log, _ := logger.New("action_store")
2823
withFile := func(fn func(t *testing.T, file string)) func(*testing.T) {
2924
return func(t *testing.T) {

x-pack/elastic-agent/pkg/config/config.go

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ func NewConfigFrom(from interface{}) (*Config, error) {
4949
}
5050

5151
if in, ok := from.(io.Reader); ok {
52+
if closer, ok := from.(io.Closer); ok {
53+
defer closer.Close()
54+
}
55+
5256
content, err := ioutil.ReadAll(in)
5357
if err != nil {
5458
return nil, err

0 commit comments

Comments
 (0)