-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unpacking of artifact config #776
Merged
michalpristas
merged 22 commits into
elastic:main
from
michalpristas:fix/artifact-config
Aug 1, 2022
Merged
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f1d98a0
added source uri reloading
michalpristas 319bd63
typo
michalpristas 78cd614
typo
michalpristas 19082fc
typo
michalpristas 635f75b
typo
michalpristas 3b89b2b
use reloadable
michalpristas 48aa387
use reloadable
michalpristas 0649adf
use reloadable
michalpristas 5d08d67
fleet compatibility
michalpristas 10fa7b2
typo
michalpristas c61abb3
divide and conquer
michalpristas 6d3c94f
wrap
michalpristas c834057
conflicts
michalpristas 6952e6f
vet
michalpristas 4aaff68
lint
michalpristas 9e0d2d5
few other test cases
michalpristas 0522a3e
few other test cases
michalpristas 790888d
few other test cases
michalpristas 6037332
fixed unpack
michalpristas 0923823
fixed lint
michalpristas 099ee22
fixed lint
michalpristas 1fdaeb1
comments resolved, trim optimised, error context back
michalpristas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// 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. | ||
|
||
package artifact | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/elastic/elastic-agent/internal/pkg/config" | ||
"github.com/elastic/elastic-agent/pkg/core/logger" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestReload(t *testing.T) { | ||
cfg := DefaultConfig() | ||
l, _ := logger.NewTesting("t") | ||
reloader := NewReloader(cfg, l) | ||
|
||
input := `agent.download: | ||
sourceURI: "testing.uri" | ||
target_directory: "a/b/c" | ||
install_path: "i/p" | ||
drop_path: "d/p" | ||
proxy_disable: true | ||
ssl.enabled: true | ||
ssl.ca_trusted_fingerprint: "my_finger_print" | ||
` | ||
|
||
c, err := config.NewConfigFrom(input) | ||
require.NoError(t, err) | ||
|
||
require.NoError(t, reloader.Reload(c)) | ||
|
||
require.Equal(t, "testing.uri", cfg.SourceURI) | ||
require.Equal(t, "a/b/c", cfg.TargetDirectory) | ||
require.NotNil(t, cfg.TLS) | ||
require.Equal(t, true, *cfg.TLS.Enabled) | ||
require.Equal(t, "my_finger_print", cfg.TLS.CATrustedFingerprint) | ||
require.NotNil(t, cfg.Proxy) | ||
require.Equal(t, true, cfg.Proxy.Disable) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the benefit of removing the additional context from the the error here? it was wrapping the error before the change