Exemplo n.º 1
0
func TestFindIndicesForDateRange(t *testing.T) {
	indices := [...]string{
		"logstash-2016.06.15",
		"logstash-2016.06.16",
		"logstash-2016.06.17",
		"logstash-2016.06.18",
		"logstash-2016.06.19",
		"logstash-2016.06.20",
	}
	x := findIndicesForDateRange(indices[0:], "logstash.*", "2016-06-16", "2016-06-18")
	t.Log(x)
	tu.AssertEqualsInt(t, 3, len(x))

}
Exemplo n.º 2
0
func TestNewSSHTunnelFromHostStrings(t *testing.T) {
	InitLogging(os.Stderr, os.Stderr, os.Stderr, true)
	tunnel := NewSSHTunnelFromHostStrings("[email protected]:2222", "9200:localhost:9200")
	testutils.AssertEqualsString(t, tunnel.Server.Host, "test1.example.com")
	testutils.AssertEqualsString(t, tunnel.Remote.Host, "localhost")
	testutils.AssertEqualsInt(t, tunnel.Server.Port, 2222)
	testutils.AssertEqualsInt(t, tunnel.Remote.Port, 9200)
	testutils.AssertEqualsInt(t, tunnel.Local.Port, 9200)

	tunnel = NewSSHTunnelFromHostStrings("test1.example.com:2222", "")
	testutils.AssertEqualsString(t, tunnel.Server.Host, "test1.example.com")
	testutils.AssertEqualsInt(t, tunnel.Server.Port, 2222)

	tunnel = NewSSHTunnelFromHostStrings("*****@*****.**", "")
	testutils.AssertEqualsString(t, tunnel.Server.Host, "test1.example.com")
	testutils.AssertEqualsInt(t, tunnel.Server.Port, 22)

	tunnel = NewSSHTunnelFromHostStrings("test1.example.com", "")
	testutils.AssertEqualsString(t, tunnel.Server.Host, "test1.example.com")
	testutils.AssertEqualsInt(t, tunnel.Server.Port, 22)

}