Remove EnsureComplete config object validation from GetCurrentContext
It's redundant and contradictory to call EnsureComplete method from GetCurrentContext function since this method is called twice during config load and we perform this check inside of appropriate action function (like phase apply or cluster init). Change-Id: Idb9ab7e7665dcc6d199bc96c21ae1dc6d059ac2e Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This commit is contained in:
parent
8c378d186d
commit
9616cd0756
@ -610,9 +610,6 @@ func (c *Config) ModifyContext(context *Context, theContext *ContextOptions) {
|
||||
// Manifest is the default manifest to be use with this context
|
||||
// Purpose for this method is simplifying the current context information
|
||||
func (c *Config) GetCurrentContext() (*Context, error) {
|
||||
if err := c.EnsureComplete(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
currentContext, err := c.GetContext(c.CurrentContext)
|
||||
if err != nil {
|
||||
// this should not happen since Ensure Complete checks for this
|
||||
|
@ -420,21 +420,6 @@ func TestGetCurrentContext(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, conf.Contexts[currentContextName], context)
|
||||
})
|
||||
|
||||
t.Run("getCurrentContextIncomplete", func(t *testing.T) {
|
||||
conf, cleanup := testutil.InitConfig(t)
|
||||
defer cleanup(t)
|
||||
|
||||
context, err := conf.GetCurrentContext()
|
||||
require.Error(t, err)
|
||||
assert.Nil(t, context)
|
||||
|
||||
conf.CurrentContext = currentContextName
|
||||
|
||||
context, err = conf.GetCurrentContext()
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, context)
|
||||
})
|
||||
}
|
||||
|
||||
func TestCurrentContextCluster(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user