Skip to content

Commit

Permalink
adding sameness-group to validation for query params for service calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurret committed Jun 3, 2024
1 parent edd0f73 commit 2896a99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dependency/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func GetConsulQueryOpts(queryMap map[string]string, endpointLabel string) (url.V
QuerySamenessGroup:
default:
return nil,
fmt.Errorf("%s: invalid query parameter key %q in query %q: supported keys: %s,%s,%s", endpointLabel, key, queryRaw, QueryNamespace, QueryPeer, QueryPartition)
fmt.Errorf("%s: invalid query parameter key %q in query %q: supported keys: %s,%s,%s,%s", endpointLabel, key, queryRaw, QueryNamespace, QueryPeer, QueryPartition, QuerySamenessGroup)
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions dependency/health_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestNewHealthServiceQuery(t *testing.T) {
tenancyHelper.AppendTenancyInfo("invalid query param (unsupported key)", tenancy),
"name?unsupported=test",
nil,
fmt.Errorf(`health.service: invalid query parameter key "unsupported" in query "unsupported=test": supported keys: ns,peer,partition`),
fmt.Errorf(`health.service: invalid query parameter key "unsupported" in query "unsupported=test": supported keys: ns,peer,partition,sameness-group`),
},
testCase{
tenancyHelper.AppendTenancyInfo("name", tenancy),
Expand Down Expand Up @@ -758,9 +758,9 @@ func TestHealthServiceQuery_Fetch_SamenessGroup(t *testing.T) {
t.Fatal(err)
}

// Assert that the service instance returned is from the first listed partition.
// This is expected because the service is healthy so it shouldn't failover
// to other partitions.
// Assert that the service instance returned is from the first listed partition.
// This is expected because the service is healthy so it shouldn't failover
// to other partitions.
healthServices := svcs.([]*HealthService)
require.True(t, len(healthServices) == 1)
require.Equal(t, "node"+partitionOne, healthServices[0].Node)
Expand Down Expand Up @@ -803,7 +803,7 @@ func TestHealthServiceQuery_Fetch_SamenessGroup(t *testing.T) {
// Assert - verify the results
expectedResult := []*HealthService{
{
// The instance should now be from the failover partition.
// The instance should now be from the failover partition.
Node: nodeTwo,
NodeAddress: testConsul.Config.Bind,
ServiceMeta: map[string]string{},
Expand Down

0 comments on commit 2896a99

Please sign in to comment.