Skip to content

Commit

Permalink
Merge pull request #3 from segmentio/list-stop-matching-prefix
Browse files Browse the repository at this point in the history
List should match service exactly
  • Loading branch information
dfuentes authored Jun 15, 2017
2 parents 68969f1 + 07103ba commit 389a404
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion store/ssmstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *SSMStore) List(service string, includeValues bool) ([]Secret, error) {
Filters: []*ssm.ParametersFilter{
{
Key: aws.String("Name"),
Values: []*string{aws.String(service)},
Values: []*string{aws.String(service + ".")},
},
},
NextToken: nextToken,
Expand Down
10 changes: 10 additions & 0 deletions store/ssmstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@ func TestList(t *testing.T) {
assert.Equal(t, "value", *secret.Value)
}
})

t.Run("List should only return exact matches on service name", func(t *testing.T) {
store.Write(SecretId{Service: "match", Key: "a"}, "val")
store.Write(SecretId{Service: "matchlonger", Key: "a"}, "val")

s, err := store.List("match", false)
assert.Nil(t, err)
assert.Equal(t, 1, len(s))
assert.Equal(t, "match.a", s[0].Meta.Key)
})
}

func TestHistory(t *testing.T) {
Expand Down

0 comments on commit 389a404

Please sign in to comment.