forked from grafana/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HTTPClientConfig to discovery.ec2 (grafana#5767)
Co-authored-by: Paschalis Tsilias <[email protected]>
- Loading branch information
Showing
4 changed files
with
46 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package aws | ||
|
||
import ( | ||
"net/url" | ||
"testing" | ||
|
||
"github.com/grafana/agent/component/common/config" | ||
"github.com/stretchr/testify/require" | ||
"gotest.tools/assert" | ||
) | ||
|
||
func TestConvert(t *testing.T) { | ||
// parse example proxy | ||
u, err := url.Parse("http://example:8080") | ||
require.NoError(t, err) | ||
httpClientConfig := config.DefaultHTTPClientConfig | ||
httpClientConfig.ProxyURL = config.URL{URL: u} | ||
|
||
// example configuration | ||
riverArgs := EC2Arguments{ | ||
Region: "us-east-1", | ||
HTTPClientConfig: httpClientConfig, | ||
} | ||
|
||
// ensure values are set | ||
promArgs := riverArgs.Convert() | ||
assert.Equal(t, "us-east-1", promArgs.Region) | ||
assert.Equal(t, "http://example:8080", promArgs.HTTPClientConfig.ProxyURL.String()) | ||
} |
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