fix: prevent possible null pointer dereference error in TestAddHelmRepoInsecureSkipVerify test (#3650)

This commit is contained in:
Alexander Matyushentsev 2020-05-26 10:52:12 -07:00 committed by GitHub
parent 91d5d7e37b
commit 22dcc1e87d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,15 +121,24 @@ func TestAddHelmRepoInsecureSkipVerify(t *testing.T) {
"--insecure-skip-server-verification",
"--tls-client-cert-path", repos.CertPath,
"--tls-client-cert-key-path", repos.CertKeyPath)
assert.NoError(t, err)
if !assert.NoError(t, err) {
return
}
conn, repoClient, err := fixture.ArgoCDClientset.NewRepoClient()
assert.NoError(t, err)
if !assert.NoError(t, err) {
return
}
defer argoio.Close(conn)
repo, err := repoClient.List(context.Background(), &repositorypkg.RepoQuery{})
assert.NoError(t, err)
if !assert.NoError(t, err) {
return
}
exists := false
for i := range repo.Items {
if repo.Items[i].Repo == fixture.RepoURL(fixture.RepoURLTypeHelm) {