Merge "Remove EnsureComplete config object validation from GetCurrentContext"

This commit is contained in:
Zuul 2020-05-20 04:01:46 +00:00 committed by Gerrit Code Review
commit 99234bad5d
2 changed files with 0 additions and 18 deletions

View File

@ -615,9 +615,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

View File

@ -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) {