-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[exporter/cassandra] Added authorization by username and password #27841
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
Merged
codeboten
merged 26 commits into
open-telemetry:main
from
go-follow:exporter/cassandra/added-authorization
Jan 15, 2024
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
d4a8080
[exporter/cassandra] close #27828 added authorization by username and…
go-follow ef40980
Update exporter/cassandraexporter/config.go
go-follow 7ee9b3d
add using configopaque.String instead string for auth.password
go-follow 29618d1
[exporter/cassandra] add test for authorization
go-follow 674fc25
add .chologgen/cassandraexporter-add-authorization.yaml
go-follow 280e6ed
fix check-collector-module-version
go-follow c4250e2
[exporter/cassandra] close #27828 added authorization by username and…
go-follow 3e27122
Update exporter/cassandraexporter/config.go
go-follow b9d79db
add using configopaque.String instead string for auth.password
go-follow ba8121d
[exporter/cassandra] add test for authorization
go-follow b973bed
add .chologgen/cassandraexporter-add-authorization.yaml
go-follow 1f9904e
Merge remote-tracking branch 'origin/exporter/cassandra/added-authori…
go-follow 98f0a83
add go.opentelemetry.io/collector/config/configopaque in go.mod
go-follow e0d4a38
Merge branch 'main' into exporter/cassandra/added-authorization
go-follow 21cdc42
[exporter/cassandra] close #27828 added authorization by username and…
go-follow 2c04534
Update exporter/cassandraexporter/config.go
go-follow c2492f0
add using configopaque.String instead string for auth.password
go-follow d77c91a
[exporter/cassandra] add test for authorization
go-follow 7fd8aba
add .chologgen/cassandraexporter-add-authorization.yaml
go-follow ed75f9e
add using configopaque.String instead string for auth.password
go-follow 6c771e1
Merge remote-tracking branch 'origin/exporter/cassandra/added-authori…
go-follow 54f14b7
Merge branch 'main' into exporter/cassandra/added-authorization
go-follow 7b643bd
[exporter/cassandra] add check fill auth.username and auth.password
go-follow 7764cbb
Merge remote-tracking branch 'remote-origin/main' into exporter/cassa…
go-follow 6ad5050
fix conflicts
go-follow 87a2217
fix check-collector-module-version
go-follow 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 hidden or 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,20 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
# If your change doesn't affect end users, such as a test fix or a tooling change, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: cassandraexporter | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: added authorization by username and password | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [27827] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,66 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package cassandraexporter | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/gocql/gocql" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNewCluster(t *testing.T) { | ||
testCases := map[string]struct { | ||
cfg *Config | ||
expectedAuthenticator gocql.Authenticator | ||
expectedErr error | ||
}{ | ||
"empty_auth": { | ||
cfg: withDefaultConfig(), | ||
expectedAuthenticator: nil, | ||
}, | ||
"empty_username": { | ||
cfg: withDefaultConfig(func(config *Config) { | ||
config.Auth.Password = "pass" | ||
}), | ||
expectedAuthenticator: nil, | ||
expectedErr: errors.New("empty auth.username"), | ||
}, | ||
"empty_password": { | ||
cfg: withDefaultConfig(func(config *Config) { | ||
config.Auth.UserName = "user" | ||
}), | ||
expectedAuthenticator: nil, | ||
expectedErr: errors.New("empty auth.password"), | ||
}, | ||
"success_auth": { | ||
cfg: withDefaultConfig(func(config *Config) { | ||
config.Auth.UserName = "user" | ||
config.Auth.Password = "pass" | ||
}), | ||
expectedAuthenticator: gocql.PasswordAuthenticator{ | ||
Username: "user", | ||
Password: "pass", | ||
}, | ||
}, | ||
} | ||
for name, test := range testCases { | ||
t.Run(name, func(t *testing.T) { | ||
c, err := newCluster(test.cfg) | ||
if err == nil { | ||
require.Equal(t, test.expectedAuthenticator, c.Authenticator) | ||
} | ||
require.Equal(t, test.expectedErr, err) | ||
}) | ||
} | ||
} | ||
|
||
func withDefaultConfig(fns ...func(*Config)) *Config { | ||
cfg := createDefaultConfig().(*Config) | ||
for _, fn := range fns { | ||
fn(cfg) | ||
} | ||
return cfg | ||
} |
This file contains hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.