Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
rboyer committed Nov 2, 2023
1 parent c66728b commit 28a740b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/integration/consul-container/libs/assert/envoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func AssertUpstreamEndpointStatusWithClient(
clusterName, healthStatus)
results, err := utils.JQFilter(clusters, filter)
require.NoErrorf(r, err, "could not find cluster name %q: %v \n%s", clusterName, err, clusters)
require.Len(r, results, 1) // the final part of the pipeline is "length" which only ever returns 1 result
require.Len(r, results, 1, "clusters: "+clusters) // the final part of the pipeline is "length" which only ever returns 1 result

result, err := strconv.Atoi(results[0])
assert.NoError(r, err)
Expand Down
1 change: 0 additions & 1 deletion test/integration/consul-container/libs/assert/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func CatalogV2ServiceDoesNotExist(t *testing.T, client pbresource.ResourceServic
// number of workload endpoints.
func CatalogV2ServiceHasEndpointCount(t *testing.T, client pbresource.ResourceServiceClient, svc string, tenancy *pbresource.Tenancy, count int) {
t.Helper()
require.False(t, count == 0)

ctx := testutil.TestContext(t)
retry.Run(t, func(r *retry.R) {
Expand Down
13 changes: 6 additions & 7 deletions testing/deployer/sprawl/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ func (s *Sprawl) registerServicesForDataplaneInstances(cluster *topology.Cluster
if node.IsV2() {
pending := serviceInstanceToResources(node, svc)

if _, ok := identityInfo[svc.ID]; !ok {
identityInfo[svc.ID] = pending.WorkloadIdentity
workloadID := topology.NewServiceID(svc.WorkloadIdentity, svc.ID.Namespace, svc.ID.Partition)
if _, ok := identityInfo[workloadID]; !ok {
identityInfo[workloadID] = pending.WorkloadIdentity
}

// Write workload
Expand Down Expand Up @@ -545,15 +546,13 @@ func serviceInstanceToResources(
},
},
}

worloadIdentityRes = &Resource[*pbauth.WorkloadIdentity]{
workloadIdentityRes = &Resource[*pbauth.WorkloadIdentity]{
Resource: &pbresource.Resource{
Id: &pbresource.ID{
Type: pbauth.WorkloadIdentityType,
Name: svc.ID.Name,
Name: svc.WorkloadIdentity,
Tenancy: tenancy,
},
Metadata: svc.Meta,
},
Data: &pbauth.WorkloadIdentity{},
}
Expand Down Expand Up @@ -646,7 +645,7 @@ func serviceInstanceToResources(
Workload: workloadRes,
HealthStatuses: healthResList,
Destinations: destinationsRes,
WorkloadIdentity: worloadIdentityRes,
WorkloadIdentity: workloadIdentityRes,
ProxyConfiguration: proxyConfigRes,
}
}
Expand Down
6 changes: 3 additions & 3 deletions testing/deployer/topology/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,14 @@ func compile(logger hclog.Logger, raw *Config, prev *Topology) (*Topology, error
}
}

if len(svc.WorkloadIdentities) == 0 {
svc.WorkloadIdentities = []string{svc.ID.Name}
if svc.WorkloadIdentity == "" {
svc.WorkloadIdentity = svc.ID.Name
}
} else {
if len(svc.V2Services) > 0 {
return nil, fmt.Errorf("cannot specify v2 services for v1")
}
if len(svc.WorkloadIdentities) > 0 {
if svc.WorkloadIdentity != "" {
return nil, fmt.Errorf("cannot specify workload identities for v1")
}
}
Expand Down
4 changes: 2 additions & 2 deletions testing/deployer/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,14 @@ type Service struct {
// This only applies for multi-port (v2).
V2Services []string `json:",omitempty"`

// WorkloadIdentities contains named WorkloadIdentities to assign to this
// WorkloadIdentity contains named WorkloadIdentity to assign to this
// workload.
//
// If omitted it is inferred that the ID.Name field is the singular
// identity for this workload.
//
// This only applies for multi-port (v2).
WorkloadIdentities []string `json:",omitempty"`
WorkloadIdentity string `json:",omitempty"`

Disabled bool `json:",omitempty"` // TODO

Expand Down

0 comments on commit 28a740b

Please sign in to comment.