Skip to content

Commit

Permalink
Merge pull request #1003 from weaveworks/add-pr-string-to-suffix
Browse files Browse the repository at this point in the history
Add the `pr` string to suffix
  • Loading branch information
Chanwit Kaewkasi authored Sep 19, 2023
2 parents ca4543b + f27e67d commit a65b947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions internal/server/polling/poll_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ func Test_poll_reconcile_objects(t *testing.T) {

// Ignore the first one as it's the original resource.
for idx, item := range tfList.Items[1:] {
expectToEqual(g, item.Name, fmt.Sprintf("%s-%d", original.Name, idx+1))
expectToEqual(g, item.Spec.SourceRef.Name, fmt.Sprintf("%s-source-%d", original.Name, idx+1))
expectToEqual(g, item.Name, fmt.Sprintf("%s-pr-%d", original.Name, idx+1))
expectToEqual(g, item.Spec.SourceRef.Name, fmt.Sprintf("%s-source-pr-%d", original.Name, idx+1))
expectToEqual(g, item.Spec.SourceRef.Namespace, ns.Name)
expectToEqual(g, item.Spec.PlanOnly, true)
expectToEqual(g, item.Spec.StoreReadablePlan, "human")
Expand All @@ -217,7 +217,7 @@ func Test_poll_reconcile_objects(t *testing.T) {

// Ignore the first one as it's the original resource.
for idx, item := range srcList.Items[1:] {
expectToEqual(g, item.Name, fmt.Sprintf("%s-%d", source.Name, idx+1))
expectToEqual(g, item.Name, fmt.Sprintf("%s-pr-%d", source.Name, idx+1))
expectToEqual(g, item.Spec.Reference.Branch, fmt.Sprintf("test-branch-%d", idx+1))
expectToEqual(g, item.Labels[bpconfig.LabelKey], bpconfig.LabelValue)
expectToEqual(g, item.Labels["test-label"], "123")
Expand Down Expand Up @@ -260,7 +260,7 @@ func Test_poll_reconcile_objects(t *testing.T) {

expectToEqual(g, len(tfList.Items), 2)
expectToEqual(g, tfList.Items[0].Name, original.Name)
expectToEqual(g, tfList.Items[1].Name, original.Name+"-3")
expectToEqual(g, tfList.Items[1].Name, original.Name+"-pr-3")

srcList.Items = nil

Expand All @@ -270,7 +270,7 @@ func Test_poll_reconcile_objects(t *testing.T) {

expectToEqual(g, len(srcList.Items), 2)
expectToEqual(g, srcList.Items[0].Name, source.Name)
expectToEqual(g, srcList.Items[1].Name, source.Name+"-3")
expectToEqual(g, srcList.Items[1].Name, source.Name+"-pr-3")

t.Cleanup(func() { expectToSucceed(g, k8sClient.Delete(context.TODO(), ns)) })
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/polling/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (s *Server) reconcileSource(ctx context.Context, originalSource *sourcev1.G
}

func (s *Server) createObjectName(name string, prID string) string {
return fmt.Sprintf("%s-%s", name, prID)
return fmt.Sprintf("%s-pr-%s", name, prID)
}

func (s *Server) createLabels(labels map[string]string, originalName string, branch string, prID string) map[string]string {
Expand Down

0 comments on commit a65b947

Please # to comment.