From 94ba6d3826243a59ed0a27491476c50001b8cb98 Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Wed, 22 Jul 2020 09:36:25 +0200 Subject: [PATCH 1/4] remove skip --- .../elastic-agent/pkg/agent/application/action_store_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/x-pack/elastic-agent/pkg/agent/application/action_store_test.go b/x-pack/elastic-agent/pkg/agent/application/action_store_test.go index a3ccb5b9e48..4205deda8b6 100644 --- a/x-pack/elastic-agent/pkg/agent/application/action_store_test.go +++ b/x-pack/elastic-agent/pkg/agent/application/action_store_test.go @@ -9,7 +9,6 @@ import ( "io/ioutil" "os" "path/filepath" - "runtime" "testing" "github.com/stretchr/testify/require" @@ -20,10 +19,6 @@ import ( ) func TestActionStore(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("Skipping on windows see https://github.com/elastic/beats/issues/19919") - } - log, _ := logger.New("action_store") withFile := func(fn func(t *testing.T, file string)) func(*testing.T) { return func(t *testing.T) { From a838749b86524002a4ec0f0e996ea3aecb6118a9 Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Wed, 22 Jul 2020 10:20:43 +0200 Subject: [PATCH 2/4] close properly --- x-pack/elastic-agent/pkg/agent/application/action_store.go | 1 + x-pack/elastic-agent/pkg/config/config.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/x-pack/elastic-agent/pkg/agent/application/action_store.go b/x-pack/elastic-agent/pkg/agent/application/action_store.go index a0b008d9623..25dbf7a5b82 100644 --- a/x-pack/elastic-agent/pkg/agent/application/action_store.go +++ b/x-pack/elastic-agent/pkg/agent/application/action_store.go @@ -33,6 +33,7 @@ func newActionStore(log *logger.Logger, store storeLoad) (*actionStore, error) { if err != nil { return &actionStore{log: log, store: store}, nil } + defer reader.Close() var action actionConfigChangeSerializer diff --git a/x-pack/elastic-agent/pkg/config/config.go b/x-pack/elastic-agent/pkg/config/config.go index e8845840137..f230e3f100e 100644 --- a/x-pack/elastic-agent/pkg/config/config.go +++ b/x-pack/elastic-agent/pkg/config/config.go @@ -49,6 +49,11 @@ func NewConfigFrom(from interface{}) (*Config, error) { } if in, ok := from.(io.Reader); ok { + + if closer, ok := from.(io.Closer); ok { + defer closer.Close() + } + content, err := ioutil.ReadAll(in) if err != nil { return nil, err From 3a3805da63d1cdf9c938e80a3332d01ff62fd56f Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Wed, 22 Jul 2020 10:24:27 +0200 Subject: [PATCH 3/4] changelog --- x-pack/elastic-agent/CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/elastic-agent/CHANGELOG.asciidoc b/x-pack/elastic-agent/CHANGELOG.asciidoc index 2324ccaf873..2cc968ae12d 100644 --- a/x-pack/elastic-agent/CHANGELOG.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.asciidoc @@ -52,6 +52,7 @@ - Avoid comparing uncomparable types on enroll {issue}19976[19976] - Fix issues with merging of elastic-agent.yml and fleet.yml {pull}20026[20026] - Unzip failures on Windows 8/Windows server 2012 {pull}20088[20088] +- Fix failing unit tests on windows {pull}20127[20127] ==== New features From 0063347b8cfee4573aee980a92fc439a71f59dca Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Wed, 22 Jul 2020 12:43:50 +0200 Subject: [PATCH 4/4] space --- x-pack/elastic-agent/pkg/config/config.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/elastic-agent/pkg/config/config.go b/x-pack/elastic-agent/pkg/config/config.go index f230e3f100e..a7620a7f630 100644 --- a/x-pack/elastic-agent/pkg/config/config.go +++ b/x-pack/elastic-agent/pkg/config/config.go @@ -49,7 +49,6 @@ func NewConfigFrom(from interface{}) (*Config, error) { } if in, ok := from.(io.Reader); ok { - if closer, ok := from.(io.Closer); ok { defer closer.Close() }