~egtann/lanhttp

a749d5e32eb033703f23e4c547eb50751c867a6d — Evan Tann 1 year, 2 months ago ced0903
add getIP test
1 files changed, 22 insertions(+), 1 deletions(-)

M lanhttp_test.go
M lanhttp_test.go => lanhttp_test.go +22 -1
@@ 1,6 1,8 @@
package lanhttp

import "testing"
import (
	"testing"
)

func TestDiff(t *testing.T) {
	t.Parallel()


@@ 68,3 70,22 @@ func TestDiff(t *testing.T) {
		})
	}
}

func TestGetIP(t *testing.T) {
	c := NewClient(nil)
	c.UpdateRoutes(Routes{
		"a.internal": []string{"1", "2"},
	})
	if got := c.getIP("a.internal"); got != "2" {
		t.Fatal("expected 2 (1st)")
	}
	if got := c.getIP("a.internal"); got != "1" {
		t.Fatal("expected 1 (1st)")
	}
	if got := c.getIP("a.internal"); got != "2" {
		t.Fatal("expected 2 (2nd)")
	}
	if got := c.getIP("a.internal"); got != "1" {
		t.Fatal("expected 1 (2nd)")
	}
}