mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
feat(libhelm) import libhelm into CE pkg directory [EE-4650] (#8138)
* import libhelm and update some paths * remove file * update readme
This commit is contained in:
parent
9cdc0da615
commit
4fee359247
29 changed files with 1328 additions and 0 deletions
49
pkg/libhelm/validate_repo_test.go
Normal file
49
pkg/libhelm/validate_repo_test.go
Normal file
|
@ -0,0 +1,49 @@
|
|||
package libhelm
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/portainer/portainer/pkg/libhelm/libhelmtest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_ValidateHelmRepositoryURL(t *testing.T) {
|
||||
libhelmtest.EnsureIntegrationTest(t)
|
||||
is := assert.New(t)
|
||||
|
||||
type testCase struct {
|
||||
name string
|
||||
url string
|
||||
invalid bool
|
||||
}
|
||||
|
||||
tests := []testCase{
|
||||
{"blank", "", true},
|
||||
{"slashes", "//", true},
|
||||
{"slash", "/", true},
|
||||
{"invalid scheme", "garbage://a.b.c", true},
|
||||
{"invalid domain", "https://invaliddomain/", true},
|
||||
{"not helm repo", "http://google.com", true},
|
||||
{"not valid repo with trailing slash", "http://google.com/", true},
|
||||
{"not valid repo with trailing slashes", "http://google.com////", true},
|
||||
{"bitnami helm repo", "https://charts.bitnami.com/bitnami/", false},
|
||||
{"gitlap helm repo", "https://charts.gitlab.io/", false},
|
||||
{"portainer helm repo", "https://portainer.github.io/k8s/", false},
|
||||
{"elastic helm repo", "https://helm.elastic.co/", false},
|
||||
{"redirect", "https://charts.jetstack.io/", false},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
func(tc testCase) {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := ValidateHelmRepositoryURL(tc.url)
|
||||
if tc.invalid {
|
||||
is.Errorf(err, "error expected: %s", tc.url)
|
||||
} else {
|
||||
is.NoError(err, "no error expected: %s", tc.url)
|
||||
}
|
||||
})
|
||||
}(test)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue