consul/connect: ensure proxyID in test case

This commit is contained in:
Seth Hoenig 2021-01-20 09:48:12 -06:00
parent a18e63ed55
commit 5abaf1b86d
1 changed files with 7 additions and 2 deletions

View File

@ -7,6 +7,7 @@ package taskrunner
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
@ -231,6 +232,7 @@ type envoyConfig struct {
} `json:"admin"` } `json:"admin"`
Node struct { Node struct {
Cluster string `json:"cluster"` Cluster string `json:"cluster"`
ID string `json:"id"`
Metadata struct { Metadata struct {
Namespace string `json:"namespace"` Namespace string `json:"namespace"`
Version string `json:"envoy_version"` Version string `json:"envoy_version"`
@ -516,8 +518,11 @@ func TestTaskRunner_EnvoyBootstrapHook_gateway_ok(t *testing.T) {
var out envoyConfig var out envoyConfig
require.NoError(t, json.NewDecoder(f).Decode(&out)) require.NoError(t, json.NewDecoder(f).Decode(&out))
// the only interesting thing on bootstrap is the presence of the cluster, // The only interesting thing on bootstrap is the presence of the cluster,
// everything is configured at runtime through xDS // and its associated ID that Nomad sets. Everything is configured at runtime
// through xDS.
expID := fmt.Sprintf("_nomad-task-%s-group-web-my-ingress-service-9999", alloc.ID)
require.Equal(t, expID, out.Node.ID)
require.Equal(t, "ingress-gateway", out.Node.Cluster) require.Equal(t, "ingress-gateway", out.Node.Cluster)
} }