-
Notifications
You must be signed in to change notification settings - Fork 101
[sops] Allow encode=base64 config for sops provider #1064
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,6 +238,30 @@ func TestNewProviderDefaultKeyType(t *testing.T) { | |
| } | ||
| } | ||
|
|
||
| func TestNewProviderDefaultEncode(t *testing.T) { | ||
| cfg := config.MapConfig{M: map[string]interface{}{}} | ||
|
|
||
| p := New(log.New(log.Config{}), cfg, "") | ||
|
|
||
| if p.Encode != "raw" { | ||
| t.Errorf("Encode = %q, want %q (default)", p.Encode, "raw") | ||
| } | ||
| } | ||
|
|
||
| func TestNewProviderReadsEncodeBase64(t *testing.T) { | ||
| cfg := config.MapConfig{ | ||
| M: map[string]interface{}{ | ||
| "encode": "base64", | ||
| }, | ||
| } | ||
|
|
||
| p := New(log.New(log.Config{}), cfg, "") | ||
|
|
||
| if p.Encode != "base64" { | ||
| t.Errorf("Encode = %q, want %q", p.Encode, "base64") | ||
| } | ||
|
Comment on lines
+251
to
+262
|
||
| } | ||
|
|
||
| // staticCredProvider is a no-op aws.CredentialsProvider used in tests. | ||
| type staticCredProvider struct{} | ||
|
|
||
|
|
||
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.
New
encodebehavior inGetStringisn’t covered by unit tests (no tests callGetStringin this package). Please add a test that exercisesencode=base64(verifies output matchesbase64.StdEncoding.EncodeToStringof decrypted bytes) and the unsupported encode error path; this may require makingdecryptstub-able (e.g., via an injectable function field) or adding a small helper that can be tested directly.