From 5962d300c34bfc765fbd074c883187e12d207a58 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 1 Sep 2022 18:23:03 +0100 Subject: [PATCH] ci: enable windows for testing heartbeat (#32937) (cherry picked from commit 8552e34a6ad31c9f7ed3bf2a1202a00c401cfa43) # Conflicts: # x-pack/heartbeat/monitors/browser/source/source.go --- x-pack/heartbeat/Jenkinsfile.yml | 58 ++++++++++--------- .../monitors/browser/source/inline.go | 2 + .../monitors/browser/source/inline_test.go | 2 + .../monitors/browser/source/local.go | 3 + .../monitors/browser/source/local_test.go | 3 + .../monitors/browser/source/offline.go | 2 + .../monitors/browser/source/project.go | 2 + .../monitors/browser/source/project_test.go | 2 + .../monitors/browser/source/source.go | 6 ++ .../browser/source/validatepackage.go | 3 + .../browser/source/validatepackage_test.go | 3 + .../monitors/browser/source/zipurl.go | 3 + .../monitors/browser/source/zipurl_test.go | 3 + x-pack/heartbeat/scenarios/basics_test.go | 1 - x-pack/heartbeat/scenarios/scenarios.go | 26 --------- 15 files changed, 64 insertions(+), 55 deletions(-) diff --git a/x-pack/heartbeat/Jenkinsfile.yml b/x-pack/heartbeat/Jenkinsfile.yml index 1bd04921e05..b2c2035734c 100644 --- a/x-pack/heartbeat/Jenkinsfile.yml +++ b/x-pack/heartbeat/Jenkinsfile.yml @@ -34,34 +34,36 @@ stages: - "macosTest" tags: true ## for all the tags stage: extended -# TODO: there are windows test failures already reported -# https://github.com/elastic/beats/issues/23957 and https://github.com/elastic/beats/issues/23958 -# waiting for being fixed. -# windows-2019: -# mage: "mage build test" -# platforms: ## override default labels in this specific stage. -# - "windows-2019" -# stage: extended_win -# windows-2016: -# mage: "mage build test" -# platforms: ## override default labels in this specific stage. -# - "windows-2016" -# stage: mandatory -# windows-2012: -# mage: "mage build test" -# platforms: ## override default labels in this specific stage. -# - "windows-2012-r2" -# stage: extended_win -# windows-10: -# mage: "mage build test" -# platforms: ## override default labels in this specific stage. -# - "windows-10" -# stage: extended_win -# windows-8: -# mage: "mage build test" -# platforms: ## override default labels in this specific stage. -# - "windows-8" -# stage: extended_win + windows-2022: + mage: "mage build test" + platforms: ## override default labels in this specific stage. + - "windows-2022" + stage: mandatory + windows-2019: + mage: "mage build test" + platforms: ## override default labels in this specific stage. + - "windows-2019" + stage: extended_win + windows-2016: + mage: "mage build test" + platforms: ## override default labels in this specific stage. + - "windows-2016" + stage: mandatory + windows-2012: + mage: "mage build test" + platforms: ## override default labels in this specific stage. + - "windows-2012-r2" + stage: extended_win + windows-10: + mage: "mage build test" + platforms: ## override default labels in this specific stage. + - "windows-10" + stage: extended_win + windows-8: + mage: "mage build test" + platforms: ## override default labels in this specific stage. + - "windows-8" + stage: extended_win packaging-linux: packaging-linux: "mage package" e2e: diff --git a/x-pack/heartbeat/monitors/browser/source/inline.go b/x-pack/heartbeat/monitors/browser/source/inline.go index 890d1902e0d..27fb84bfdac 100644 --- a/x-pack/heartbeat/monitors/browser/source/inline.go +++ b/x-pack/heartbeat/monitors/browser/source/inline.go @@ -1,6 +1,8 @@ // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin package source diff --git a/x-pack/heartbeat/monitors/browser/source/inline_test.go b/x-pack/heartbeat/monitors/browser/source/inline_test.go index d97dbd8a120..24f9a6efa94 100644 --- a/x-pack/heartbeat/monitors/browser/source/inline_test.go +++ b/x-pack/heartbeat/monitors/browser/source/inline_test.go @@ -1,6 +1,8 @@ // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin package source diff --git a/x-pack/heartbeat/monitors/browser/source/local.go b/x-pack/heartbeat/monitors/browser/source/local.go index ebaf628214d..44104ac60e9 100644 --- a/x-pack/heartbeat/monitors/browser/source/local.go +++ b/x-pack/heartbeat/monitors/browser/source/local.go @@ -2,6 +2,9 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin + package source import ( diff --git a/x-pack/heartbeat/monitors/browser/source/local_test.go b/x-pack/heartbeat/monitors/browser/source/local_test.go index 40a9b9b1aff..c391b49719d 100644 --- a/x-pack/heartbeat/monitors/browser/source/local_test.go +++ b/x-pack/heartbeat/monitors/browser/source/local_test.go @@ -2,6 +2,9 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin + package source import ( diff --git a/x-pack/heartbeat/monitors/browser/source/offline.go b/x-pack/heartbeat/monitors/browser/source/offline.go index 0347958a812..a16ed88ff52 100644 --- a/x-pack/heartbeat/monitors/browser/source/offline.go +++ b/x-pack/heartbeat/monitors/browser/source/offline.go @@ -1,6 +1,8 @@ // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin package source diff --git a/x-pack/heartbeat/monitors/browser/source/project.go b/x-pack/heartbeat/monitors/browser/source/project.go index effea44eb8a..421b54f2d7c 100644 --- a/x-pack/heartbeat/monitors/browser/source/project.go +++ b/x-pack/heartbeat/monitors/browser/source/project.go @@ -1,6 +1,8 @@ // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin package source diff --git a/x-pack/heartbeat/monitors/browser/source/project_test.go b/x-pack/heartbeat/monitors/browser/source/project_test.go index b3aa25eedbf..e9a3caec246 100644 --- a/x-pack/heartbeat/monitors/browser/source/project_test.go +++ b/x-pack/heartbeat/monitors/browser/source/project_test.go @@ -1,6 +1,8 @@ // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin package source diff --git a/x-pack/heartbeat/monitors/browser/source/source.go b/x-pack/heartbeat/monitors/browser/source/source.go index adcc7b17159..9ea864896a5 100644 --- a/x-pack/heartbeat/monitors/browser/source/source.go +++ b/x-pack/heartbeat/monitors/browser/source/source.go @@ -1,6 +1,12 @@ // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +<<<<<<< HEAD +======= + +//go:build linux || darwin +// +build linux darwin +>>>>>>> 8552e34a6a (ci: enable windows for testing heartbeat (#32937)) package source diff --git a/x-pack/heartbeat/monitors/browser/source/validatepackage.go b/x-pack/heartbeat/monitors/browser/source/validatepackage.go index c6740423212..7492580f8cd 100644 --- a/x-pack/heartbeat/monitors/browser/source/validatepackage.go +++ b/x-pack/heartbeat/monitors/browser/source/validatepackage.go @@ -2,6 +2,9 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin + package source import ( diff --git a/x-pack/heartbeat/monitors/browser/source/validatepackage_test.go b/x-pack/heartbeat/monitors/browser/source/validatepackage_test.go index 014e1fd2fa9..ab2b298efcc 100644 --- a/x-pack/heartbeat/monitors/browser/source/validatepackage_test.go +++ b/x-pack/heartbeat/monitors/browser/source/validatepackage_test.go @@ -2,6 +2,9 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin + package source import ( diff --git a/x-pack/heartbeat/monitors/browser/source/zipurl.go b/x-pack/heartbeat/monitors/browser/source/zipurl.go index ebd5a1c547f..553cbe6662f 100644 --- a/x-pack/heartbeat/monitors/browser/source/zipurl.go +++ b/x-pack/heartbeat/monitors/browser/source/zipurl.go @@ -2,6 +2,9 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin + package source import ( diff --git a/x-pack/heartbeat/monitors/browser/source/zipurl_test.go b/x-pack/heartbeat/monitors/browser/source/zipurl_test.go index 6f6da1f159a..6c2ba843cfb 100644 --- a/x-pack/heartbeat/monitors/browser/source/zipurl_test.go +++ b/x-pack/heartbeat/monitors/browser/source/zipurl_test.go @@ -2,6 +2,9 @@ // or more contributor license agreements. Licensed under the Elastic License; // you may not use this file except in compliance with the Elastic License. +//go:build linux || darwin +// +build linux darwin + package source import ( diff --git a/x-pack/heartbeat/scenarios/basics_test.go b/x-pack/heartbeat/scenarios/basics_test.go index 36e5abf7776..38dec26b4dd 100644 --- a/x-pack/heartbeat/scenarios/basics_test.go +++ b/x-pack/heartbeat/scenarios/basics_test.go @@ -17,7 +17,6 @@ import ( _ "github.com/elastic/beats/v7/heartbeat/monitors/active/http" _ "github.com/elastic/beats/v7/heartbeat/monitors/active/icmp" _ "github.com/elastic/beats/v7/heartbeat/monitors/active/tcp" - _ "github.com/elastic/beats/v7/x-pack/heartbeat/monitors/browser" ) func TestSimpleScenariosBasicFields(t *testing.T) { diff --git a/x-pack/heartbeat/scenarios/scenarios.go b/x-pack/heartbeat/scenarios/scenarios.go index f4474643cc4..3ab193c4f55 100644 --- a/x-pack/heartbeat/scenarios/scenarios.go +++ b/x-pack/heartbeat/scenarios/scenarios.go @@ -8,7 +8,6 @@ import ( "fmt" "net/http/httptest" "net/url" - "os" "sync" "github.com/elastic/elastic-agent-libs/mapstr" @@ -70,30 +69,5 @@ var Scenarios = &ScenarioDB{ }, func() {}, nil }, }, - { - Name: "simple-browser", - Type: "browser", - Tags: []string{"browser", "browser-inline"}, - Runner: func() (config mapstr.M, close func(), err error) { - err = os.Setenv("ELASTIC_SYNTHETICS_CAPABLE", "true") - if err != nil { - return nil, nil, err - } - server := httptest.NewServer(hbtest.HelloWorldHandler(200)) - config = mapstr.M{ - "id": "browser-test-id", - "name": "browser-test-name", - "type": "browser", - "schedule": "@every 1m", - "hosts": []string{"127.0.0.1"}, - "source": mapstr.M{ - "inline": mapstr.M{ - "script": fmt.Sprintf("step('load server', async () => {await page.goto('%s')})", server.URL), - }, - }, - } - return config, server.Close, nil - }, - }, }, }