Skip to content

Commit

Permalink
apply review
Browse files Browse the repository at this point in the history
Signed-off-by: Ling Samuel (WSL) <lingsamuelgrace@gmail.com>
  • Loading branch information
lingsamuel committed Sep 22, 2023
1 parent 9515d9f commit 0fedf19
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ func sync(cmd *cobra.Command, dryRun bool) error {
}
}

color.Green("Summary: created %d, updated %d, deleted %d", summary.created, summary.updated, summary.deleted)
if dryRun {
color.Green("Summary: create %d, update %d, delete %d", summary.created, summary.updated, summary.deleted)
} else {
color.Green("Summary: created %d, updated %d, deleted %d", summary.created, summary.updated, summary.deleted)
}

return nil
}
2 changes: 1 addition & 1 deletion pkg/data/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (e *Event) Output(diffOnly bool) (string, error) {
edits := myers.ComputeEdits(span.URIFromPath("remote"), string(remote), string(local))
diff := fmt.Sprint(gotextdiff.ToUnified("remote", "local", string(remote), edits))
if diffOnly {
output = fmt.Sprintf("diff %s: \"%s\"\n%s", e.ResourceType, apisix.GetResourceUniqueKey(e.Value), diff)
output = fmt.Sprintf("update %s: \"%s\"\n%s", e.ResourceType, apisix.GetResourceUniqueKey(e.Value), diff)
} else {
output = fmt.Sprintf("updating %s: \"%s\"\n%s", e.ResourceType, apisix.GetResourceUniqueKey(e.Value), diff)
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli/suites-basic/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var _ = ginkgo.Describe("`adc diff` tests", func() {
+++ service: "svc2"
+++ route: "route1"
+++ route: "route2"
Summary: created 4, updated 0, deleted 0
Summary: create 4, update 0, delete 0
`))
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/cli/suites-consumer-group/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var _ = ginkgo.Describe("`adc diff` consumer group tests", func() {
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(out).To(gomega.Equal(`+++ consumer_group: "company_a"
+++ consumer: "jack"
Summary: created 2, updated 0, deleted 0
Summary: create 2, update 0, delete 0
`))
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/cli/suites-consumer/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var _ = ginkgo.Describe("`adc diff` consumer tests", func() {
out, err := s.Diff("suites-consumer/testdata/test.yaml")
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(out).To(gomega.Equal(`+++ consumer: "jack"
Summary: created 1, updated 0, deleted 0
Summary: create 1, update 0, delete 0
`))
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/cli/suites-global-rule/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var _ = ginkgo.Describe("`adc diff` global rule tests", func() {
out, err := s.Diff("suites-global-rule/testdata/test.yaml")
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(out).To(gomega.Equal(`+++ global_rule: "1"
Summary: created 1, updated 0, deleted 0
Summary: create 1, update 0, delete 0
`))
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/cli/suites-plugin-config/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var _ = ginkgo.Describe("`adc diff` plugin config tests", func() {
out, err := s.Diff("suites-plugin-config/testdata/test.yaml")
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(out).To(gomega.Equal(`+++ plugin_config: "1"
Summary: created 1, updated 0, deleted 0
Summary: create 1, update 0, delete 0
`))
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/cli/suites-plugin-metadata/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var _ = ginkgo.Describe("`adc diff` plugin metadata tests", func() {
out, err := s.Diff("suites-plugin-metadata/testdata/test.yaml")
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(out).To(gomega.Equal(`+++ plugin_metadata: "http-logger"
Summary: created 1, updated 0, deleted 0
Summary: create 1, update 0, delete 0
`))
})
})
Expand Down
2 changes: 1 addition & 1 deletion test/mtls/suites-basic/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var _ = ginkgo.Describe("`adc diff` tests", func() {
+++ service: "svc2"
+++ route: "route1"
+++ route: "route2"
Summary: created 4, updated 0, deleted 0
Summary: create 4, update 0, delete 0
`))
})
})
Expand Down

0 comments on commit 0fedf19

Please sign in to comment.