-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually use tls alloy and not yaml. (#2461)
* Actually use tls alloy and not yaml. * remove bad test
- Loading branch information
1 parent
1136b7f
commit 419e997
Showing
3 changed files
with
32 additions
and
18 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 |
---|---|---|
@@ -1,20 +1,26 @@ | ||
package queue | ||
|
||
import ( | ||
common "github.com/prometheus/common/config" | ||
"github.com/grafana/alloy/syntax" | ||
"github.com/stretchr/testify/require" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestBasicAuthAndTLSBothSetError(t *testing.T) { | ||
args := defaultArgs() | ||
args.Endpoints = make([]EndpointConfig, 1) | ||
args.Endpoints[0] = defaultEndpointConfig() | ||
args.Endpoints[0].Name = "test" | ||
args.Endpoints[0].TLSConfig = &common.TLSConfig{} | ||
args.Endpoints[0].BasicAuth = &BasicAuth{} | ||
err := args.Validate() | ||
require.Error(t, err) | ||
require.True(t, strings.Contains(err.Error(), "cannot have both BasicAuth and TLSConfig")) | ||
func TestParsingTLSConfig(t *testing.T) { | ||
var args Arguments | ||
err := syntax.Unmarshal([]byte(` | ||
endpoint "cloud" { | ||
url = "http://example.com" | ||
basic_auth { | ||
username = 12345 | ||
password = "password" | ||
} | ||
tls_config { | ||
insecure_skip_verify = true | ||
} | ||
} | ||
`), &args) | ||
|
||
require.NoError(t, err) | ||
} |