Skip to content

Commit

Permalink
[envoy/test] Health Check integration test [fixes #5289] (#5589)
Browse files Browse the repository at this point in the history
This picks up where we left off in #5448 but with:
- validation of the health check struct being constructed(this is good bc we don't have api validation in integration tests so would be good to just ensure we're creating valid objects
- noticed some shitty logging in the v1 envoy parser that i missed in my previous commit so just throwing that in here

fbshipit-source-id: c67cc4b
  • Loading branch information
brirams authored and tbnbot committed Jul 3, 2018
1 parent f185c3b commit 277d94e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions plugins/envoy/v1/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,24 @@ func (p *parser) parse(r io.Reader) ([]api.Cluster, error) {
clusters := map[string]api.Cluster{}
for _, c := range envoyClusters {
if _, exists := clusters[c.Name]; exists {
return nil, fmt.Errorf("duplicate cluster: %s", c.Name)
return nil, fmt.Errorf("duplicate cluster: %q", c.Name)
}

instances := api.Instances{}
switch {
case c.Type == "sds" && resolve == nil:
console.Error().Printf("No SDS defined. Skipping cluster %s", c.Name)
console.Error().Printf("No SDS defined. Skipping cluster %q", c.Name)
continue

case c.Type == "sds":
sdsInstances, errs := resolve(c.ServiceName)
if len(errs) > 0 {
for _, e := range errs {
console.Error().Printf("Error getting SDS instances: %v", e)
console.Error().Printf(
"Error getting SDS instances for cluster %q: %s",
c.Name,
e,
)
}

continue
Expand All @@ -109,7 +113,11 @@ func (p *parser) parse(r io.Reader) ([]api.Cluster, error) {
for _, h := range c.Hosts {
i, err := mkInstance(h.URL)
if err != nil {
console.Error().Printf("Invalid cluster host: %s", err)
console.Error().Printf(
"Invalid host for cluster %q: %s",
c.Name,
err,
)
}

instances = append(instances, i)
Expand All @@ -118,7 +126,11 @@ func (p *parser) parse(r io.Reader) ([]api.Cluster, error) {

hc, err := mkHealthChecks(c.HealthCheck)
if err != nil {
console.Error().Printf("Skipping health checks: %v", err)
console.Error().Printf(
"Skipping health checks for cluster %s: %v",
c.Name,
err,
)
}

cluster := api.Cluster{
Expand Down

0 comments on commit 277d94e

Please sign in to comment.