mirror of https://github.com/helm/helm
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>pull/6070/head
parent
b3fd254991
commit
2045fab01f
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright The Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package action
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"helm.sh/helm/pkg/registry"
|
||||
)
|
||||
|
||||
func chartSaveAction(t *testing.T) *ChartSave {
|
||||
t.Helper()
|
||||
config := actionConfigFixture(t)
|
||||
action := NewChartSave(config)
|
||||
return action
|
||||
}
|
||||
|
||||
func TestChartSave(t *testing.T) {
|
||||
action := chartSaveAction(t)
|
||||
|
||||
input := buildChart()
|
||||
if err := action.Run(ioutil.Discard, input, "localhost:5000/test:0.2.0"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
ref, err := registry.ParseReference("localhost:5000/test:0.2.0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := action.cfg.RegistryClient.LoadChart(ref); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
// now let's check if `helm chart save` can use the chart version when the tag is not present
|
||||
if err := action.Run(ioutil.Discard, input, "localhost:5000/test"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
ref, err = registry.ParseReference("localhost:5000/test:0.1.0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := action.cfg.RegistryClient.LoadChart(ref); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
Loading…
Reference in new issue