Skip to content

Commit 220e7b9

Browse files
committed
fix(6208): set default to https, updated unit tests
1 parent f1fdbe7 commit 220e7b9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

internal/pkg/config/config_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ func defaultFleet() Fleet {
583583

584584
func defaultElastic() Elasticsearch {
585585
return Elasticsearch{
586-
Protocol: "http",
586+
Protocol: "https",
587587
ServiceToken: "test-token",
588588
Hosts: []string{"localhost:9200"},
589589
MaxRetries: 3,

internal/pkg/config/output.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ import (
2626

2727
// The timeout would be driven by the server for long poll.
2828
// Giving it some sane long value.
29-
const httpTransportLongPollTimeout = 10 * time.Minute
30-
const schemeHTTP = "http"
29+
const (
30+
httpTransportLongPollTimeout = 10 * time.Minute
31+
schemeHTTP = "https"
32+
)
3133

3234
var hasScheme = regexp.MustCompile(`^([a-z][a-z0-9+\-.]*)://`)
3335

internal/pkg/config/output_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// or more contributor license agreements. Licensed under the Elastic License;
33
// you may not use this file except in compliance with the Elastic License.
44

5-
//go:build !integration
6-
75
//nolint:dupl // duplicated lines used for test cases
86
package config
97

@@ -225,7 +223,7 @@ func TestToESConfig(t *testing.T) {
225223
require.NoError(t, err)
226224

227225
expect := elasticsearch.Config{
228-
Addresses: []string{"http://localhost:9200"},
226+
Addresses: []string{"https://localhost:9200"},
229227
ServiceToken: "test-token",
230228
Header: http.Header{"X-Elastic-Product-Origin": []string{"fleet"}},
231229
MaxRetries: 3,
@@ -258,7 +256,7 @@ func TestToESConfig(t *testing.T) {
258256
require.NoError(t, err)
259257

260258
expect := elasticsearch.Config{
261-
Addresses: []string{"http://localhost:9200"},
259+
Addresses: []string{"https://localhost:9200"},
262260
Header: http.Header{"X-Elastic-Product-Origin": []string{"fleet"}},
263261
MaxRetries: 3,
264262
Transport: &http.Transport{

0 commit comments

Comments
 (0)