Sha256: 5a0f78ffeaaccc3d118444bdb14f97d30d1437674d868cfef033f03dfbda227e

Contents?: true

Size: 914 Bytes

Versions: 3

Compression:

Stored size: 914 Bytes

Contents

package flapjack

import "testing"

func TestDialFails(t *testing.T) {
	address := "localhost:55555" // non-existent Redis server
	database := 0
	_, err := Dial(address, database)

	if err == nil {
		t.Error("Dial should fail")
	}
}

func TestSendSucceeds(t *testing.T) {
	transport, err := Dial("localhost:6379", 9)
	if err != nil {
		t.Fatalf("Couldn't establish connection to testing Redis: %s", err)
	}
	event := Event{
		Entity:  "hello",
		Check:   "world",
		State:   "ok",
		Summary: "hello world",
	}

	_, err = transport.Send(event)
	if err != nil {
		t.Fatalf("Error when sending event: %s", err)
	}
}

func TestSendFails(t *testing.T) {
	transport, err := Dial("localhost:0", 9)
	if err == nil {
		t.Fatal("Expected error when connecting to testing Redis, got none.")
	}
	event := Event{}

	_, err = transport.Send(event)
	if err == nil {
		t.Fatal("Expected error when sending event, got none.")
	}
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flapjack-2.0.0 src/flapjack/transport_test.go
flapjack-2.0.0rc1 src/flapjack/transport_test.go
flapjack-2.0.0b1 src/flapjack/transport_test.go