|
|
|
@ -24,6 +24,7 @@ import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"helm.sh/helm/v3/pkg/chart"
|
|
|
|
|
"helm.sh/helm/v3/pkg/storage/driver"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
@ -451,3 +452,33 @@ func TestUpgradeRelease_Labels(t *testing.T) {
|
|
|
|
|
is.Equal(initialRes.Info.Status, release.StatusSuperseded)
|
|
|
|
|
is.Equal(initialRes.Labels, rel.Labels)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestUpgradeRelease_SystemLabels(t *testing.T) {
|
|
|
|
|
is := assert.New(t)
|
|
|
|
|
upAction := upgradeAction(t)
|
|
|
|
|
|
|
|
|
|
rel := releaseStub()
|
|
|
|
|
rel.Name = "labels"
|
|
|
|
|
// It's needed to check that suppressed release would keep original labels
|
|
|
|
|
rel.Labels = map[string]string{
|
|
|
|
|
"key1": "val1",
|
|
|
|
|
"key2": "val2.1",
|
|
|
|
|
}
|
|
|
|
|
rel.Info.Status = release.StatusDeployed
|
|
|
|
|
|
|
|
|
|
err := upAction.cfg.Releases.Create(rel)
|
|
|
|
|
is.NoError(err)
|
|
|
|
|
|
|
|
|
|
upAction.Labels = map[string]string{
|
|
|
|
|
"key1": "null",
|
|
|
|
|
"key2": "val2.2",
|
|
|
|
|
"owner": "val3",
|
|
|
|
|
}
|
|
|
|
|
// setting newValues and upgrading
|
|
|
|
|
_, err = upAction.Run(rel.Name, buildChart(), nil)
|
|
|
|
|
if err == nil {
|
|
|
|
|
t.Fatal("expected an error")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
is.Equal(fmt.Errorf("user suplied labels contains system reserved label name. System labels: %+v", driver.GetSystemLabels()), err)
|
|
|
|
|
}
|
|
|
|
|