File tree 2 files changed +13
-12
lines changed
2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 2
2
// or more contributor license agreements. Licensed under the Elastic License;
3
3
// you may not use this file except in compliance with the Elastic License.
4
4
5
- package testrunner
5
+ package stack
6
6
7
7
import "os"
8
8
9
- // StackSettings encapsulate the various settings required to connect to the Elastic Stack.
10
- type StackSettings struct {
9
+ // Settings encapsulate the various settings required to connect to the Elastic Stack.
10
+ type Settings struct {
11
11
Elasticsearch struct {
12
12
Host string
13
13
Username string
@@ -18,20 +18,20 @@ type StackSettings struct {
18
18
}
19
19
}
20
20
21
- // GetStackSettingsFromEnv loads Elastic stack connnection settings from
21
+ // CurrentSettings loads Elastic stack connection settings from
22
22
// environment variables and returns them.
23
- func GetStackSettingsFromEnv () StackSettings {
24
- s := StackSettings {}
23
+ func CurrentSettings () Settings {
24
+ s := Settings {}
25
25
26
- s .Elasticsearch .Host = os .Getenv ("ELASTIC_PACKAGE_ELASTICSEARCH_HOST" )
26
+ s .Elasticsearch .Host = os .Getenv (ElasticsearchHostEnv )
27
27
if s .Elasticsearch .Host == "" {
28
28
s .Elasticsearch .Host = "http://localhost:9200"
29
29
}
30
30
31
- s .Elasticsearch .Username = os .Getenv ("ELASTIC_PACKAGE_ELASTICSEARCH_USERNAME" )
32
- s .Elasticsearch .Password = os .Getenv ("ELASTIC_PACKAGE_ELASTICSEARCH_PASSWORD" )
31
+ s .Elasticsearch .Username = os .Getenv (ElasticsearchUsernameEnv )
32
+ s .Elasticsearch .Password = os .Getenv (ElasticsearchPasswordEnv )
33
33
34
- s .Kibana .Host = os .Getenv ("ELASTIC_PACKAGE_KIBANA_HOST" )
34
+ s .Kibana .Host = os .Getenv (KibanaHostEnv )
35
35
if s .Kibana .Host == "" {
36
36
s .Kibana .Host = "http://localhost:5601"
37
37
}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
15
15
"github.com/elastic/elastic-package/internal/kibana/ingestmanager"
16
16
"github.com/elastic/elastic-package/internal/logger"
17
17
"github.com/elastic/elastic-package/internal/packages"
18
+ "github.com/elastic/elastic-package/internal/stack"
18
19
"github.com/elastic/elastic-package/internal/testrunner"
19
20
)
20
21
@@ -30,7 +31,7 @@ const (
30
31
type runner struct {
31
32
testFolder testrunner.TestFolder
32
33
packageRootPath string
33
- stackSettings testrunner. StackSettings
34
+ stackSettings stack. Settings
34
35
esClient * es.Client
35
36
36
37
// Execution order of following handlers is defined in runner.tearDown() method.
@@ -62,7 +63,7 @@ func (r runner) IsConfigRequired() bool {
62
63
func (r runner ) Run (options testrunner.TestOptions ) ([]testrunner.TestResult , error ) {
63
64
r .testFolder = options .TestFolder
64
65
r .packageRootPath = options .PackageRootPath
65
- r .stackSettings = testrunner . GetStackSettingsFromEnv ()
66
+ r .stackSettings = stack . CurrentSettings ()
66
67
r .esClient = options .ESClient
67
68
68
69
return r .run ()
You can’t perform that action at this time.
0 commit comments