Skip to content

Commit

Permalink
Fix test in lib/services
Browse files Browse the repository at this point in the history
  • Loading branch information
strideynet committed Jan 10, 2025
1 parent 6264b33 commit 79d181d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/services/workload_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func ValidateWorkloadIdentity(s *workloadidentityv1pb.WorkloadIdentity) error {
return trace.BadParameter("spec.rules.allow[%d].conditions[%d].attribute: must be non-empty", i, j)
}
if condition.Operator == nil {
return trace.BadParameter("spec.rules.allow[%d].conditions[%d]: at least one operator must be provided", i, j)
return trace.BadParameter("spec.rules.allow[%d].conditions[%d]: operator must be specified", i, j)
}
}
}
Expand Down
14 changes: 11 additions & 3 deletions lib/services/workload_identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ func TestValidateWorkloadIdentity(t *testing.T) {
Conditions: []*workloadidentityv1pb.WorkloadIdentityCondition{
{
Attribute: "example",
Equals: "foo",
Operator: &workloadidentityv1pb.WorkloadIdentityCondition_Eq{
Eq: &workloadidentityv1pb.WorkloadIdentityConditionEq{
Value: "foo",
},
},
},
},
},
Expand Down Expand Up @@ -180,7 +184,11 @@ func TestValidateWorkloadIdentity(t *testing.T) {
Conditions: []*workloadidentityv1pb.WorkloadIdentityCondition{
{
Attribute: "",
Equals: "foo",
Operator: &workloadidentityv1pb.WorkloadIdentityCondition_Eq{
Eq: &workloadidentityv1pb.WorkloadIdentityConditionEq{
Value: "foo",
},
},
},
},
},
Expand Down Expand Up @@ -218,7 +226,7 @@ func TestValidateWorkloadIdentity(t *testing.T) {
},
},
},
requireErr: errContains("spec.rules.allow[0].conditions[0]: exactly one operator must be specified, found 0"),
requireErr: errContains("spec.rules.allow[0].conditions[0]: operator must be specified"),
},
}

Expand Down

0 comments on commit 79d181d

Please sign in to comment.