MCPcopy
hub / github.com/argoproj/argo-cd / Test_CommitHydratedManifests

Function Test_CommitHydratedManifests

commitserver/commit/commit_test.go:19–445  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func Test_CommitHydratedManifests(t *testing.T) {
20 t.Parallel()
21
22 validRequest := &apiclient.CommitHydratedManifestsRequest{
23 Repo: &v1alpha1.Repository{
24 Repo: "https://github.com/argoproj/argocd-example-apps.git",
25 },
26 TargetBranch: "main",
27 SyncBranch: "env/test",
28 CommitMessage: "test commit message",
29 }
30
31 t.Run("missing repo", func(t *testing.T) {
32 t.Parallel()
33
34 service, _ := newServiceWithMocks(t)
35 request := &apiclient.CommitHydratedManifestsRequest{}
36 _, err := service.CommitHydratedManifests(t.Context(), request)
37 require.Error(t, err)
38 assert.ErrorContains(t, err, "repo is required")
39 })
40
41 t.Run("missing repo URL", func(t *testing.T) {
42 t.Parallel()
43
44 service, _ := newServiceWithMocks(t)
45 request := &apiclient.CommitHydratedManifestsRequest{
46 Repo: &v1alpha1.Repository{},
47 }
48 _, err := service.CommitHydratedManifests(t.Context(), request)
49 require.Error(t, err)
50 assert.ErrorContains(t, err, "repo URL is required")
51 })
52
53 t.Run("missing target branch", func(t *testing.T) {
54 t.Parallel()
55
56 service, _ := newServiceWithMocks(t)
57 request := &apiclient.CommitHydratedManifestsRequest{
58 Repo: &v1alpha1.Repository{
59 Repo: "https://github.com/argoproj/argocd-example-apps.git",
60 },
61 }
62 _, err := service.CommitHydratedManifests(t.Context(), request)
63 require.Error(t, err)
64 assert.ErrorContains(t, err, "target branch is required")
65 })
66
67 t.Run("missing sync branch", func(t *testing.T) {
68 t.Parallel()
69
70 service, _ := newServiceWithMocks(t)
71 request := &apiclient.CommitHydratedManifestsRequest{
72 Repo: &v1alpha1.Repository{
73 Repo: "https://github.com/argoproj/argocd-example-apps.git",
74 },
75 TargetBranch: "main",
76 }

Callers

nothing calls this directly

Calls 15

EXPECTMethod · 0.95
newServiceWithMocksFunction · 0.70
RunMethod · 0.65
ContextMethod · 0.65
NewClientMethod · 0.65
ErrorfMethod · 0.65
InitMethod · 0.65
FetchMethod · 0.65
SetAuthorMethod · 0.65
CheckoutOrOrphanMethod · 0.65
CheckoutOrNewMethod · 0.65

Tested by

no test coverage detected