github.com/Lephar/snapd@v0.0.0-20210825215435-c7fba9cef4d2/overlord/standby/export_test.go (about) 1 // -*- Mode: Go; indent-tabs-mode: t -*- 2 /* 3 * Copyright (C) 2018 Canonical Ltd 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 3 as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * 17 */ 18 19 package standby 20 21 import ( 22 "time" 23 24 "github.com/snapcore/snapd/overlord/state" 25 ) 26 27 func (m *StandbyOpinions) SetStartTime(t time.Time) { 28 m.startTime = t 29 } 30 31 func MockStateRequestRestart(newStateRequestRestart func(*state.State, state.RestartType)) (restore func()) { 32 oldStateRequestRestart := stateRequestRestart 33 stateRequestRestart = newStateRequestRestart 34 return func() { 35 stateRequestRestart = oldStateRequestRestart 36 } 37 }