mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-10 17:57:29 +00:00
minimize diff
Signed-off-by: h3nryc0ding <hr.richterhenry@gmail.com>
This commit is contained in:
parent
8093ad7fef
commit
92e5884664
16 changed files with 24 additions and 24 deletions
|
|
@ -45,7 +45,7 @@ func TestCreateHelmRelease(t *testing.T) {
|
|||
{
|
||||
name: "unknown source kind",
|
||||
args: "create helmrelease podinfo --source foobar/podinfo --chart podinfo --export",
|
||||
assert: assertError(`invalid argument "foobar/podinfo" for "--source" flag: source kind 'foobar' is not supported, must be one of: HelmRepository|GitRepository|Bucket`),
|
||||
assert: assertError(`invalid argument "foobar/podinfo" for "--source" flag: source kind 'foobar' is not supported, must be one of: HelmRepository, GitRepository, Bucket`),
|
||||
},
|
||||
{
|
||||
name: "unknown chart reference kind",
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ func TestCreateSourceChart(t *testing.T) {
|
|||
{
|
||||
name: "unknown source kind",
|
||||
args: "create source chart podinfo --source foobar/podinfo --export",
|
||||
assert: assertError(`invalid argument "foobar/podinfo" for "--source" flag: source kind 'foobar' is not supported, must be one of: HelmRepository|GitRepository|Bucket`),
|
||||
assert: assertError(`invalid argument "foobar/podinfo" for "--source" flag: source kind 'foobar' is not supported, must be one of: HelmRepository, GitRepository, Bucket`),
|
||||
},
|
||||
{
|
||||
name: "basic chart",
|
||||
|
|
|
|||
|
|
@ -147,12 +147,12 @@ func TestCreateSourceGitExport(t *testing.T) {
|
|||
{
|
||||
name: "source with invalid provider",
|
||||
args: "create source git podinfo --namespace=flux-system --url=https://dev.azure.com/foo/bar/_git/podinfo --provider dummy --branch=test --interval=1m0s --export",
|
||||
assert: assertError("invalid argument \"dummy\" for \"--provider\" flag: source Git provider 'dummy' is not supported, must be one of: generic|azure"),
|
||||
assert: assertError("invalid argument \"dummy\" for \"--provider\" flag: source Git provider 'dummy' is not supported, must be one of: generic, azure"),
|
||||
},
|
||||
{
|
||||
name: "source with empty provider",
|
||||
args: "create source git podinfo --namespace=flux-system --url=https://dev.azure.com/foo/bar/_git/podinfo --provider \"\" --branch=test --interval=1m0s --export",
|
||||
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, must be one of: generic|azure"),
|
||||
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, please specify the Git provider name"),
|
||||
},
|
||||
{
|
||||
name: "source with no provider",
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ func (a *CRDsPolicy) String() string {
|
|||
func (a *CRDsPolicy) Set(str string) error {
|
||||
if strings.TrimSpace(str) == "" {
|
||||
return fmt.Errorf("no upgrade CRDs policy given, must be one of: %s",
|
||||
a.Type())
|
||||
strings.Join(supportedCRDsPolicies, ", "))
|
||||
}
|
||||
if !utils.ContainsItemString(supportedCRDsPolicies, str) {
|
||||
return fmt.Errorf("unsupported upgrade CRDs policy '%s', must be one of: %s",
|
||||
str, a.Type())
|
||||
str, strings.Join(supportedCRDsPolicies, ", "))
|
||||
|
||||
}
|
||||
*a = CRDsPolicy(str)
|
||||
|
|
|
|||
|
|
@ -34,12 +34,11 @@ func (d *DecryptionProvider) String() string {
|
|||
func (d *DecryptionProvider) Set(str string) error {
|
||||
if strings.TrimSpace(str) == "" {
|
||||
return fmt.Errorf("no decryption provider given, must be one of: %s",
|
||||
d.Type())
|
||||
strings.Join(supportedDecryptionProviders, ", "))
|
||||
}
|
||||
if !utils.ContainsItemString(supportedDecryptionProviders, str) {
|
||||
return fmt.Errorf("unsupported decryption provider '%s', must be one of: %s",
|
||||
str, d.Type())
|
||||
|
||||
str, strings.Join(supportedDecryptionProviders, ", "))
|
||||
}
|
||||
*d = DecryptionProvider(str)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func (c *ECDSACurve) Set(str string) error {
|
|||
*c = ECDSACurve{v}
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unsupported curve '%s', must be one of: %s", str, c.Type())
|
||||
return fmt.Errorf("unsupported curve '%s', must be one of: %s", str, strings.Join(ecdsaCurves(), ", "))
|
||||
}
|
||||
|
||||
func (c *ECDSACurve) Type() string {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ func (d *GitLabVisibility) Set(str string) error {
|
|||
}
|
||||
var visibility = gitprovider.RepositoryVisibility(str)
|
||||
if ValidateRepositoryVisibility(visibility) != nil {
|
||||
return fmt.Errorf("unsupported visibility '%s', must be one of: %s", str, d.Type())
|
||||
return fmt.Errorf("unsupported visibility '%s', must be one of: %s",
|
||||
str, strings.Join(gitLabVisibilities(), ", "))
|
||||
}
|
||||
*d = GitLabVisibility(visibility)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func (s *HelmChartSource) Set(str string) error {
|
|||
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedHelmChartSourceKinds, sourceKind)
|
||||
if !ok {
|
||||
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s",
|
||||
sourceKind, s.Type())
|
||||
sourceKind, strings.Join(supportedHelmChartSourceKinds, ", "))
|
||||
}
|
||||
|
||||
s.Kind = cleanSourceKind
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ func (s *KustomizationSource) Set(str string) error {
|
|||
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedKustomizationSourceKinds, sourceKind)
|
||||
if !ok {
|
||||
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s",
|
||||
sourceKind, s.Type())
|
||||
sourceKind, strings.Join(supportedKustomizationSourceKinds, ", "))
|
||||
}
|
||||
|
||||
s.Kind = cleanSourceKind
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func (s *LocalHelmChartSource) Set(str string) error {
|
|||
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedHelmChartSourceKinds, sourceKind)
|
||||
if !ok {
|
||||
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s",
|
||||
sourceKind, s.Type())
|
||||
sourceKind, strings.Join(supportedHelmChartSourceKinds, ", "))
|
||||
}
|
||||
|
||||
s.Kind = cleanSourceKind
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ func (l *LogLevel) String() string {
|
|||
func (l *LogLevel) Set(str string) error {
|
||||
if strings.TrimSpace(str) == "" {
|
||||
return fmt.Errorf("no log level given, must be one of: %s",
|
||||
l.Type())
|
||||
strings.Join(supportedLogLevels, ", "))
|
||||
}
|
||||
if !utils.ContainsItemString(supportedLogLevels, str) {
|
||||
return fmt.Errorf("unsupported log level '%s', must be one of: %s",
|
||||
str, l.Type())
|
||||
str, strings.Join(supportedLogLevels, ", "))
|
||||
|
||||
}
|
||||
*l = LogLevel(str)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ func (a *PublicKeyAlgorithm) String() string {
|
|||
func (a *PublicKeyAlgorithm) Set(str string) error {
|
||||
if strings.TrimSpace(str) == "" {
|
||||
return fmt.Errorf("no public key algorithm given, must be one of: %s",
|
||||
a.Type())
|
||||
strings.Join(supportedPublicKeyAlgorithms, ", "))
|
||||
}
|
||||
for _, v := range supportedPublicKeyAlgorithms {
|
||||
if str == v {
|
||||
|
|
@ -41,7 +41,7 @@ func (a *PublicKeyAlgorithm) Set(str string) error {
|
|||
}
|
||||
}
|
||||
return fmt.Errorf("unsupported public key algorithm '%s', must be one of: %s",
|
||||
str, a.Type())
|
||||
str, strings.Join(supportedPublicKeyAlgorithms, ", "))
|
||||
}
|
||||
|
||||
func (a *PublicKeyAlgorithm) Type() string {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func (p *SourceBucketProvider) Set(str string) error {
|
|||
}
|
||||
if !utils.ContainsItemString(supportedSourceBucketProviders, str) {
|
||||
return fmt.Errorf("source bucket provider '%s' is not supported, must be one of: %v",
|
||||
str, p.Type())
|
||||
str, strings.Join(supportedSourceBucketProviders, ", "))
|
||||
}
|
||||
*p = SourceBucketProvider(str)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ func (p *SourceGitProvider) String() string {
|
|||
|
||||
func (p *SourceGitProvider) Set(str string) error {
|
||||
if strings.TrimSpace(str) == "" {
|
||||
return fmt.Errorf("no source Git provider given, must be one of: %s",
|
||||
p.Type())
|
||||
return fmt.Errorf("no source Git provider given, please specify %s",
|
||||
p.Description())
|
||||
}
|
||||
if !utils.ContainsItemString(supportedSourceGitProviders, str) {
|
||||
return fmt.Errorf("source Git provider '%s' is not supported, must be one of: %v",
|
||||
str, p.Type())
|
||||
str, strings.Join(supportedSourceGitProviders, ", "))
|
||||
}
|
||||
*p = SourceGitProvider(str)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ func (p *SourceOCIProvider) Set(str string) error {
|
|||
}
|
||||
if !utils.ContainsItemString(supportedSourceOCIProviders, str) {
|
||||
return fmt.Errorf("source OCI provider '%s' is not supported, must be one of: %v",
|
||||
str, p.Type())
|
||||
str, strings.Join(supportedSourceOCIProviders, ", "))
|
||||
}
|
||||
*p = SourceOCIProvider(str)
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func (p *SourceOCIVerifyProvider) Set(str string) error {
|
|||
}
|
||||
if !utils.ContainsItemString(supportedSourceOCIVerifyProviders, str) {
|
||||
return fmt.Errorf("source OCI verify provider '%s' is not supported, must be one of: %v",
|
||||
str, p.Type())
|
||||
str, strings.Join(supportedSourceOCIVerifyProviders, ", "))
|
||||
}
|
||||
*p = SourceOCIVerifyProvider(str)
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue