mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 13:33:23 +02:00
Bugfix: do not print registry password to stdout when running (#1275)
* Bugfix: do not print registry password to stdout when running Resolves #1274 Signed-off-by: Pascal Rivard <privard@rbbn.com> * Update exec.go Signed-off-by: yxxhero <11087727+yxxhero@users.noreply.github.com> * fix lint issues Signed-off-by: yxxhero <aiopsclub@163.com> * Add unit test Signed-off-by: Pascal Rivard <privard@rbbn.com> --------- Signed-off-by: Pascal Rivard <privard@rbbn.com> Signed-off-by: yxxhero <11087727+yxxhero@users.noreply.github.com> Signed-off-by: yxxhero <aiopsclub@163.com> Co-authored-by: Pascal Rivard <privard@rbbn.com> Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> Co-authored-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
co-authored by
Pascal Rivard
yxxhero
yxxhero
parent
2dee2cffef
commit
dabbe5e7d4
@@ -283,6 +283,43 @@ exec: helm --kube-context dev repo update
|
||||
}
|
||||
}
|
||||
|
||||
func Test_RegistryLogin(t *testing.T) {
|
||||
var buffer bytes.Buffer
|
||||
logger := NewLogger(&buffer, "debug")
|
||||
helm := &execer{
|
||||
helmBinary: "helm",
|
||||
version: semver.MustParse("v3.12.0"),
|
||||
logger: logger,
|
||||
kubeContext: "dev",
|
||||
runner: &mockRunner{},
|
||||
}
|
||||
err := helm.RegistryLogin("repo.example.com", "example_user", "example_password", "example_ca", "example_cert", "example_key", true)
|
||||
expected := `Logging in to registry
|
||||
exec: helm --kube-context dev registry login repo.example.com --cert-file example_cert --key-file example_key --ca-file example_ca --insecure --username example_user --password-stdin
|
||||
`
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if buffer.String() != expected {
|
||||
t.Errorf("helmexec.RegistryLogin()\nactual = %v\nexpect = %v", buffer.String(), expected)
|
||||
}
|
||||
|
||||
// Test helm version prior to v3.12.0, without support for TLS
|
||||
buffer.Reset()
|
||||
helm.version = semver.MustParse("v3.11.0")
|
||||
|
||||
err = helm.RegistryLogin("repo.example.com", "example_user", "example_password", "example_ca", "example_cert", "example_key", true)
|
||||
expected = `Logging in to registry
|
||||
exec: helm --kube-context dev registry login repo.example.com --insecure --username example_user --password-stdin
|
||||
`
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
if buffer.String() != expected {
|
||||
t.Errorf("helmexec.RegistryLogin()\nactual = %v\nexpect = %v", buffer.String(), expected)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_SyncRelease(t *testing.T) {
|
||||
var buffer bytes.Buffer
|
||||
logger := NewLogger(&buffer, "debug")
|
||||
|
||||
Reference in New Issue
Block a user