ip_test.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright © 2022 Ettore Di Giacinto <[email protected]>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License along
  14. // with this program; if not, see <http://www.gnu.org/licenses/>.
  15. package utils_test
  16. import (
  17. . "github.com/onsi/ginkgo"
  18. . "github.com/onsi/gomega"
  19. . "github.com/mudler/edgevpn/pkg/utils"
  20. )
  21. var _ = Describe("IP", func() {
  22. Context("NextIP", func() {
  23. It("gives a new IP", func() {
  24. Expect(NextIP("10.1.1.0", []string{"1.1.0.1"})).To(Equal("1.1.0.2"))
  25. })
  26. It("return default", func() {
  27. Expect(NextIP("10.1.1.0", []string{})).To(Equal("10.1.1.0"))
  28. })
  29. })
  30. })