Skip to content
Snippets Groups Projects
Commit dfd4f31b authored by bryanl's avatar bryanl
Browse files

update app env with no k8s spec flag


when updating an app env with no k8s spec flag,
don't attempt to check the lib path

Signed-off-by: default avatarbryanl <bryanliles@gmail.com>
parent e3806408
No related branches found
No related tags found
No related merge requests found
......@@ -92,12 +92,14 @@ func (a *App010) AddEnvironment(name, k8sSpecFlag string, spec *EnvironmentSpec)
a.spec.Environments[name] = spec
ver, err := LibUpdater(a.fs, k8sSpecFlag, app010LibPath(a.root), true)
if err != nil {
return err
}
if k8sSpecFlag != "" {
ver, err := LibUpdater(a.fs, k8sSpecFlag, app010LibPath(a.root), true)
if err != nil {
return err
}
a.spec.Environments[name].KubernetesVersion = ver
a.spec.Environments[name].KubernetesVersion = ver
}
return a.save()
}
......
......@@ -194,6 +194,35 @@ func TestApp010_AddEnvironment(t *testing.T) {
})
}
func TestApp010_AddEnvironment_empty_spec_flag(t *testing.T) {
withApp010Fs(t, "app010_app.yaml", func(fs afero.Fs) {
app, err := NewApp010(fs, "/")
require.NoError(t, err)
envs, err := app.Environments()
require.NoError(t, err)
envLen := len(envs)
env, err := app.Environment("default")
require.NoError(t, err)
env.Destination.Namespace = "updated"
err = app.AddEnvironment("default", "", env)
require.NoError(t, err)
envs, err = app.Environments()
require.NoError(t, err)
require.Len(t, envs, envLen)
env, err = app.Environment("default")
require.NoError(t, err)
require.Equal(t, "v1.7.0", env.KubernetesVersion)
require.Equal(t, "updated", env.Destination.Namespace)
})
}
func TestApp010_RemoveEnvironment(t *testing.T) {
withApp010Fs(t, "app010_app.yaml", func(fs afero.Fs) {
app, err := NewApp010(fs, "/")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment