feat: update repo Spec var type skipTLSVerify to bool (#877)

* feat: update repo Spec var type skipTLSVerify to bool

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2023-06-01 12:05:53 +08:00
committed by GitHub
parent d9e303befa
commit e8f9bbbf9d
8 changed files with 30 additions and 37 deletions
+2 -2
View File
@@ -210,7 +210,7 @@ type RepositorySpec struct {
Managed string `yaml:"managed,omitempty"`
OCI bool `yaml:"oci,omitempty"`
PassCredentials string `yaml:"passCredentials,omitempty"`
SkipTLSVerify string `yaml:"skipTLSVerify,omitempty"`
SkipTLSVerify bool `yaml:"skipTLSVerify,omitempty"`
}
type Inherit struct {
@@ -499,7 +499,7 @@ func (st *HelmState) ApplyOverrides(spec *ReleaseSpec) {
type RepoUpdater interface {
IsHelm3() bool
AddRepo(name, repository, cafile, certfile, keyfile, username, password string, managed string, passCredentials string, skipTLSVerify string) error
AddRepo(name, repository, cafile, certfile, keyfile, username, password string, managed string, passCredentials string, skipTLSVerify bool) error
UpdateRepo() error
RegistryLogin(name string, username string, password string) error
}
+9 -16
View File
@@ -1093,11 +1093,10 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "",
Password: "",
PassCredentials: "",
SkipTLSVerify: "",
},
},
helm: &exectest.Helm{},
want: []string{"name", "http://example.com/", "", "", "", "", "", "", "", ""},
want: []string{"name", "http://example.com/", "", "", "", "", "", "", "", "false"},
},
{
name: "ACR hosted repository",
@@ -1108,7 +1107,7 @@ func TestHelmState_SyncRepos(t *testing.T) {
},
},
helm: &exectest.Helm{},
want: []string{"name", "", "", "", "", "", "", "acr", "", ""},
want: []string{"name", "", "", "", "", "", "", "acr", "", "false"},
},
{
name: "repository with cert and key",
@@ -1121,11 +1120,10 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "",
Password: "",
PassCredentials: "",
SkipTLSVerify: "",
},
},
helm: &exectest.Helm{},
want: []string{"name", "http://example.com/", "", "certfile", "keyfile", "", "", "", "", ""},
want: []string{"name", "http://example.com/", "", "certfile", "keyfile", "", "", "", "", "false"},
},
{
name: "repository with ca file",
@@ -1137,11 +1135,10 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "",
Password: "",
PassCredentials: "",
SkipTLSVerify: "",
},
},
helm: &exectest.Helm{},
want: []string{"name", "http://example.com/", "cafile", "", "", "", "", "", "", ""},
want: []string{"name", "http://example.com/", "cafile", "", "", "", "", "", "", "false"},
},
{
name: "repository with username and password",
@@ -1154,11 +1151,10 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "example_user",
Password: "example_password",
PassCredentials: "",
SkipTLSVerify: "",
},
},
helm: &exectest.Helm{},
want: []string{"name", "http://example.com/", "", "", "", "example_user", "example_password", "", "", ""},
want: []string{"name", "http://example.com/", "", "", "", "example_user", "example_password", "", "", "false"},
},
{
name: "repository with username and password and pass-credentials",
@@ -1171,11 +1167,10 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "example_user",
Password: "example_password",
PassCredentials: "true",
SkipTLSVerify: "",
},
},
helm: &exectest.Helm{},
want: []string{"name", "http://example.com/", "", "", "", "example_user", "example_password", "", "true", ""},
want: []string{"name", "http://example.com/", "", "", "", "example_user", "example_password", "", "true", "false"},
},
{
name: "repository without username and password and environment with username and password",
@@ -1188,7 +1183,6 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "",
Password: "",
PassCredentials: "",
SkipTLSVerify: "",
},
},
envs: map[string]string{
@@ -1196,7 +1190,7 @@ func TestHelmState_SyncRepos(t *testing.T) {
"NAME_PASSWORD": "example_password",
},
helm: &exectest.Helm{},
want: []string{"name", "http://example.com/", "", "", "", "example_user", "example_password", "", "", ""},
want: []string{"name", "http://example.com/", "", "", "", "example_user", "example_password", "", "", "false"},
},
{
name: "repository with username and password and environment with username and password",
@@ -1209,7 +1203,6 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "example_user1",
Password: "example_password1",
PassCredentials: "",
SkipTLSVerify: "",
},
},
envs: map[string]string{
@@ -1217,7 +1210,7 @@ func TestHelmState_SyncRepos(t *testing.T) {
"NAME_PASSWORD": "example_password2",
},
helm: &exectest.Helm{},
want: []string{"name", "http://example.com/", "", "", "", "example_user1", "example_password1", "", "", ""},
want: []string{"name", "http://example.com/", "", "", "", "example_user1", "example_password1", "", "", "false"},
},
{
name: "repository with skip-tls-verify",
@@ -1230,7 +1223,7 @@ func TestHelmState_SyncRepos(t *testing.T) {
Username: "",
Password: "",
PassCredentials: "",
SkipTLSVerify: "true",
SkipTLSVerify: true,
},
},
helm: &exectest.Helm{},