Skip to content

Commit

Permalink
Stripping hard-coded eri prefix from pub-sub subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynom committed Apr 10, 2020
1 parent a3a121a commit 5edaf51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/web/pubsub/gcp/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewPubSubSvc(logger logrus.FieldLogger, client *gcppubsub.Client, topicName
}

labels := svc.subscriptionLabels
svc.subscriptionLabels = svc.subscriptionLabels[0:0]
for _, l := range labels {
if l == "" {
continue
Expand Down
8 changes: 4 additions & 4 deletions cmd/web/pubsub/gcp/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ func TestPubSubSvc_getSubscriptionID(t *testing.T) {
labels []string
want string
}{
{name: "no label", labels: []string{}, want: "eri"},
{name: "single label", labels: []string{"a"}, want: "eri-a"},
{name: "multi label", labels: []string{"a", "b"}, want: "eri-a-b"},
{name: "multi label skip empty", labels: []string{"a", "", "b"}, want: "eri-a-b"},
{name: "no label", labels: []string{}, want: ""},
{name: "single label", labels: []string{"a"}, want: "a"},
{name: "multi label", labels: []string{"a", "b"}, want: "a-b"},
{name: "multi label skip empty", labels: []string{"a", "", "b"}, want: "a-b"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 5edaf51

Please sign in to comment.