2022-01-23 17:49:35 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/franela/goblin"
|
2022-01-31 00:31:04 +00:00
|
|
|
"github.com/pterodactyl/wings/system"
|
2022-01-23 17:49:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestPower(t *testing.T) {
|
|
|
|
g := Goblin(t)
|
|
|
|
|
|
|
|
g.Describe("Server#ExecutingPowerAction", func() {
|
|
|
|
g.It("should return based on locker status", func() {
|
2022-01-31 00:31:04 +00:00
|
|
|
s := &Server{powerLock: system.NewLocker()}
|
2022-01-23 17:49:35 +00:00
|
|
|
|
|
|
|
g.Assert(s.ExecutingPowerAction()).IsFalse()
|
|
|
|
s.powerLock.Acquire()
|
|
|
|
g.Assert(s.ExecutingPowerAction()).IsTrue()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|