mirror of
https://github.com/juanfont/headscale.git
synced 2025-11-29 05:18:48 -05:00
Add support for renaming namespaces.
This commit is contained in:
@@ -46,3 +46,32 @@ func (s *Suite) TestDestroyNamespaceErrors(c *check.C) {
|
||||
err = h.DestroyNamespace("test")
|
||||
c.Assert(err, check.Equals, errorNamespaceNotEmpty)
|
||||
}
|
||||
|
||||
func (s *Suite) TestRenameNamespace(c *check.C) {
|
||||
n, err := h.CreateNamespace("test")
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(n.Name, check.Equals, "test")
|
||||
|
||||
ns, err := h.ListNamespaces()
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(len(*ns), check.Equals, 1)
|
||||
|
||||
err = h.RenameNamespace("test", "test_renamed")
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
_, err = h.GetNamespace("test")
|
||||
c.Assert(err, check.Equals, errorNamespaceNotFound)
|
||||
|
||||
_, err = h.GetNamespace("test_renamed")
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
err = h.RenameNamespace("test_does_not_exit", "test")
|
||||
c.Assert(err, check.Equals, errorNamespaceNotFound)
|
||||
|
||||
n2, err := h.CreateNamespace("test2")
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(n2.Name, check.Equals, "test2")
|
||||
|
||||
err = h.RenameNamespace("test2", "test_renamed")
|
||||
c.Assert(err, check.Equals, errorNamespaceExists)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user