mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 17:03:06 +00:00
When attempting to unshare a node from the primary namespace, return
errorMachineNotShared, not errorSameNamespace. Add test for same.
This commit is contained in:
parent
6d162eeff9
commit
c8e1afb14b
2 changed files with 5 additions and 1 deletions
|
@ -43,7 +43,8 @@ func (h *Headscale) AddSharedMachineToNamespace(m *Machine, ns *Namespace) error
|
||||||
// RemoveSharedMachineFromNamespace removes a shared machine from a namespace
|
// RemoveSharedMachineFromNamespace removes a shared machine from a namespace
|
||||||
func (h *Headscale) RemoveSharedMachineFromNamespace(m *Machine, ns *Namespace) error {
|
func (h *Headscale) RemoveSharedMachineFromNamespace(m *Machine, ns *Namespace) error {
|
||||||
if m.NamespaceID == ns.ID {
|
if m.NamespaceID == ns.ID {
|
||||||
return errorSameNamespace
|
// Can't unshare from primary namespace
|
||||||
|
return errorMachineNotShared
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedMachine := SharedMachine{}
|
sharedMachine := SharedMachine{}
|
||||||
|
|
|
@ -86,6 +86,9 @@ func (s *Suite) TestUnshare(c *check.C) {
|
||||||
|
|
||||||
err = h.RemoveSharedMachineFromNamespace(m2, n1)
|
err = h.RemoveSharedMachineFromNamespace(m2, n1)
|
||||||
c.Assert(err, check.Equals, errorMachineNotShared)
|
c.Assert(err, check.Equals, errorMachineNotShared)
|
||||||
|
|
||||||
|
err = h.RemoveSharedMachineFromNamespace(m1, n1)
|
||||||
|
c.Assert(err, check.Equals, errorMachineNotShared)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Suite) TestAlreadyShared(c *check.C) {
|
func (s *Suite) TestAlreadyShared(c *check.C) {
|
||||||
|
|
Loading…
Reference in a new issue