github.com/meulengracht/snapd@v0.0.0-20210719210640-8bde69bcc84e/overlord/configstate/configcore/early_test.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2021 Canonical Ltd
     5   *
     6   * This program is free software: you can redistribute it and/or modify
     7   * it under the terms of the GNU General Public License version 3 as
     8   * published by the Free Software Foundation.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17   *
    18   */
    19  
    20  package configcore_test
    21  
    22  import (
    23  	. "gopkg.in/check.v1"
    24  
    25  	"github.com/snapcore/snapd/features"
    26  	"github.com/snapcore/snapd/overlord/configstate/configcore"
    27  )
    28  
    29  type earlySuite struct {
    30  	configcoreSuite
    31  }
    32  
    33  var _ = Suite(&earlySuite{})
    34  
    35  func (s *earlySuite) TestEarly(c *C) {
    36  	patch := map[string]interface{}{
    37  		"experimental.parallel-instances": true,
    38  		"experimental.user-daemons":       true,
    39  		"services.ssh.disable":            true,
    40  	}
    41  	tr := &mockConf{state: s.state}
    42  	err := configcore.Early(coreDev, tr, patch)
    43  	c.Assert(err, IsNil)
    44  
    45  	// only early options as described by flags earlyConfigFilters
    46  	// were processed
    47  
    48  	c.Check(tr.conf, DeepEquals, map[string]interface{}{
    49  		"experimental.parallel-instances": true,
    50  		"experimental.user-daemons":       true,
    51  	})
    52  	c.Check(features.ParallelInstances.IsEnabled(), Equals, true)
    53  }