Skip to content

Commit

Permalink
Add a test for query string support
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bresson committed Aug 11, 2016
1 parent 7a78bf4 commit e41b70c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion command/agent/consul/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ var (
Interval: 3 * time.Second,
Timeout: 1 * time.Second,
}
check3 = structs.ServiceCheck{
Name: "check3",
Type: "http",
PortLabel: "port3",
Path: "/health?p1=1&p2=2",
Interval: 3 * time.Second,
Timeout: 1 * time.Second,
}
service1 = structs.Service{
Name: "foo-1",
Tags: []string{"tag1", "tag2"},
Expand Down Expand Up @@ -61,6 +69,7 @@ func TestCheckRegistration(t *testing.T) {
srvReg, _ := cs.createService(&service1, "domain", "key")
check1Reg, _ := cs.createCheckReg(&check1, srvReg)
check2Reg, _ := cs.createCheckReg(&check2, srvReg)
check3Reg, _ := cs.createCheckReg(&check3, srvReg)

expected := "10.10.11.5:20002"
if check1Reg.TCP != expected {
Expand All @@ -69,8 +78,14 @@ func TestCheckRegistration(t *testing.T) {

expected = "10.10.11.5:20003"
if check2Reg.TCP != expected {
t.Fatalf("expected: %v, actual: %v", expected, check1Reg.TCP)
t.Fatalf("expected: %v, actual: %v", expected, check2Reg.TCP)
}

expected = "http://10.10.11.5:20004/health?p1=1&p2=2"
if check3Reg.HTTP != expected {
t.Fatalf("expected: %v, actual: %v", expected, check3Reg.HTTP)
}

}

func TestConsulServiceRegisterServices(t *testing.T) {
Expand Down Expand Up @@ -208,6 +223,10 @@ func mockTask() *structs.Task {
Label: "port2",
Value: 20003,
},
structs.Port{
Label: "port3",
Value: 20004,
},
},
},
},
Expand Down

0 comments on commit e41b70c

Please sign in to comment.