New CLI Flag --devel To Include Development/Prerelease Versions of Charts (#139)

* Include devel Flag for Toggling Dev Chart Versions

The flag `--devel` for enabling/disabling dev versions
of charts in following endpoints:
1. /api/helm/repositories/kafka-operator
2. /api/helm/repositories/versions
3. /api/helm/repositories/latestver

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>

* Run Tests on Devel Flag Related Changes

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>

---------

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
This commit is contained in:
Bhargav Ravuri
2023-02-11 21:32:01 +05:30
committed by GitHub
parent 61b67f8bed
commit 6a4ca793c9
12 changed files with 348 additions and 55 deletions

View File

@@ -15,6 +15,7 @@ func TestNewDataLayer(t *testing.T) {
namespaces []string
version string
helmConfig HelmConfigGetter
devel bool
errorExpected bool
}{
{
@@ -22,6 +23,7 @@ func TestNewDataLayer(t *testing.T) {
namespaces: []string{"namespace1", "namespace2"},
version: "1.0.0",
helmConfig: nil,
devel: false,
errorExpected: true,
},
{
@@ -34,12 +36,13 @@ func TestNewDataLayer(t *testing.T) {
helmConfig: func(sett *cli.EnvSettings, ns string) (*action.Configuration, error) {
return &action.Configuration{}, nil
},
devel: false,
errorExpected: false,
},
}
for _, tt := range testCases {
t.Run(tt.name, func(t *testing.T) {
dl, err := NewDataLayer(tt.namespaces, tt.version, tt.helmConfig)
dl, err := NewDataLayer(tt.namespaces, tt.version, tt.helmConfig, tt.devel)
if tt.errorExpected {
assert.Error(t, err, "Expected error but got nil")
} else {