Skip to content

Commit

Permalink
test/e2e: update receive e2e tests to use GRPC
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Servén Marín <[email protected]>
  • Loading branch information
squat committed Jan 10, 2020
1 parent 018d262 commit d2706dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions test/e2e/receive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ func TestReceive(t *testing.T) {
// receiver in the hashring than the one handling the request.
// The querier queries all the receivers and the test verifies
// the time series are forwarded to the correct receive node.
receiveHTTP1, receiveHTTP2, receiveHTTP3 := a.New(), a.New(), a.New()
receiveGRPC1, receiveGRPC2, receiveGRPC3 := a.New(), a.New(), a.New()

h := receive.HashringConfig{
Endpoints: []string{remoteWriteEndpoint(receiveHTTP1), remoteWriteEndpoint(receiveHTTP2), remoteWriteEndpoint(receiveHTTP3)},
Endpoints: []string{receiveGRPC1.HostPort(), receiveGRPC2.HostPort(), receiveGRPC3.HostPort()},
}

r1 := receiver(receiveHTTP1, a.New(), a.New(), 1, h)
r2 := receiver(receiveHTTP2, a.New(), a.New(), 1, h)
r3 := receiver(receiveHTTP3, a.New(), a.New(), 1, h)
r1 := receiver(a.New(), receiveGRPC1, a.New(), 1, h)
r2 := receiver(a.New(), receiveGRPC2, a.New(), 1, h)
r3 := receiver(a.New(), receiveGRPC3, a.New(), 1, h)

prom1 := prometheus(a.New(), defaultPromConfig("prom1", 1, remoteWriteEndpoint(r1.HTTP)))
prom2 := prometheus(a.New(), defaultPromConfig("prom2", 1, remoteWriteEndpoint(r2.HTTP)))
Expand Down Expand Up @@ -79,15 +79,15 @@ func TestReceive(t *testing.T) {
// receives Prometheus remote-written data. The querier queries all
// receivers and the test verifies that the time series are
// replicated to all of the nodes.
receiveHTTP1, receiveHTTP2, receiveHTTP3 := a.New(), a.New(), a.New()
receiveGRPC1, receiveGRPC2, receiveGRPC3 := a.New(), a.New(), a.New()

h := receive.HashringConfig{
Endpoints: []string{remoteWriteEndpoint(receiveHTTP1), remoteWriteEndpoint(receiveHTTP2), remoteWriteEndpoint(receiveHTTP3)},
Endpoints: []string{receiveGRPC1.HostPort(), receiveGRPC2.HostPort(), receiveGRPC3.HostPort()},
}

r1 := receiver(receiveHTTP1, a.New(), a.New(), 3, h)
r2 := receiver(receiveHTTP2, a.New(), a.New(), 3, h)
r3 := receiver(receiveHTTP3, a.New(), a.New(), 3, h)
r1 := receiver(a.New(), receiveGRPC1, a.New(), 3, h)
r2 := receiver(a.New(), receiveGRPC2, a.New(), 3, h)
r3 := receiver(a.New(), receiveGRPC3, a.New(), 3, h)

prom1 := prometheus(a.New(), defaultPromConfig("prom1", 1, remoteWriteEndpoint(r1.HTTP)))

Expand Down Expand Up @@ -122,14 +122,14 @@ func TestReceive(t *testing.T) {
// The replication suite creates a three-node hashring but one of the
// receivers is dead. In this case, replication should still
// succeed and the time series should be replicated to the other nodes.
receiveHTTP1, receiveHTTP2, receiveHTTP3 := a.New(), a.New(), a.New()
receiveGRPC1, receiveGRPC2, receiveGRPC3 := a.New(), a.New(), a.New()

h := receive.HashringConfig{
Endpoints: []string{remoteWriteEndpoint(receiveHTTP1), remoteWriteEndpoint(receiveHTTP2), remoteWriteEndpoint(receiveHTTP3)},
Endpoints: []string{receiveGRPC1.HostPort(), receiveGRPC2.HostPort(), receiveGRPC3.HostPort()},
}

r1 := receiver(receiveHTTP1, a.New(), a.New(), 3, h)
r2 := receiver(receiveHTTP2, a.New(), a.New(), 3, h)
r1 := receiver(a.New(), receiveGRPC1, a.New(), 3, h)
r2 := receiver(a.New(), receiveGRPC2, a.New(), 3, h)

prom1 := prometheus(a.New(), defaultPromConfig("prom1", 1, remoteWriteEndpoint(r1.HTTP)))

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/spinup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func sidecar(http, grpc address, prom *prometheusScheduler) *serverScheduler {

func receiver(http, grpc, metric address, replicationFactor int, hashring ...receive.HashringConfig) *serverScheduler {
if len(hashring) == 0 {
hashring = []receive.HashringConfig{{Endpoints: []string{remoteWriteEndpoint(http)}}}
hashring = []receive.HashringConfig{{Endpoints: []string{grpc.HostPort()}}}
}

return &serverScheduler{
Expand Down Expand Up @@ -198,7 +198,7 @@ func receiver(http, grpc, metric address, replicationFactor int, hashring ...rec
"--tsdb.path", filepath.Join(receiveDir, "tsdb"),
"--log.level", "debug",
"--receive.replication-factor", strconv.Itoa(replicationFactor),
"--receive.local-endpoint", remoteWriteEndpoint(http),
"--receive.local-endpoint", grpc.HostPort(),
"--receive.hashrings-file", filepath.Join(receiveDir, "hashrings.json"),
"--receive.hashrings-file-refresh-interval", "5s")), nil
},
Expand Down

0 comments on commit d2706dc

Please sign in to comment.