Skip to content

Commit bb1d04b

Browse files
committed
fix: unit tests
Signed-off-by: sivchari <[email protected]>
1 parent 4063088 commit bb1d04b

File tree

37 files changed

+226
-225
lines changed

37 files changed

+226
-225
lines changed

applicationset/controllers/applicationset_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ func TestRequeueGeneratorFails(t *testing.T) {
18921892
generatorMock := mocks.Generator{}
18931893
generatorMock.On("GetTemplate", &generator).
18941894
Return(&v1alpha1.ApplicationSetTemplate{})
1895-
generatorMock.On("GenerateParams", &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
1895+
generatorMock.On("GenerateParams", mock.Anything, &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
18961896
Return([]map[string]any{}, errors.New("Simulated error generating params that could be related to an external service/API call"))
18971897

18981898
metrics := appsetmetrics.NewFakeAppsetMetrics()

applicationset/controllers/template/template_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func TestGenerateApplications(t *testing.T) {
9191
List: &v1alpha1.ListGenerator{},
9292
}
9393

94-
generatorMock.On("GenerateParams", &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
94+
generatorMock.On("GenerateParams", mock.Anything, &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
9595
Return(cc.params, cc.generateParamsError)
9696

9797
generatorMock.On("GetTemplate", &generator).
@@ -205,7 +205,7 @@ func TestMergeTemplateApplications(t *testing.T) {
205205
List: &v1alpha1.ListGenerator{},
206206
}
207207

208-
generatorMock.On("GenerateParams", &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
208+
generatorMock.On("GenerateParams", mock.Anything, &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
209209
Return(cc.params, nil)
210210

211211
generatorMock.On("GetTemplate", &generator).
@@ -317,7 +317,7 @@ func TestGenerateAppsUsingPullRequestGenerator(t *testing.T) {
317317
PullRequest: &v1alpha1.PullRequestGenerator{},
318318
}
319319

320-
generatorMock.On("GenerateParams", &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
320+
generatorMock.On("GenerateParams", mock.Anything, &generator, mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).
321321
Return(cases.params, nil)
322322

323323
generatorMock.On("GetTemplate", &generator).

applicationset/generators/matrix_test.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func TestMatrixGenerate(t *testing.T) {
150150
Git: g.Git,
151151
List: g.List,
152152
}
153-
genMock.On("GenerateParamsWithContext", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{
153+
genMock.On("GenerateParams", mock.Anything, mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{
154154
{
155155
"path": "app1",
156156
"path.basename": "app1",
@@ -359,7 +359,7 @@ func TestMatrixGenerateGoTemplate(t *testing.T) {
359359
Git: g.Git,
360360
List: g.List,
361361
}
362-
genMock.On("GenerateParamsWithContext", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{
362+
genMock.On("GenerateParams", mock.Anything, mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{
363363
{
364364
"path": map[string]string{
365365
"path": "app1",
@@ -651,7 +651,7 @@ func TestInterpolatedMatrixGenerate(t *testing.T) {
651651
Git: g.Git,
652652
Clusters: g.Clusters,
653653
}
654-
genMock.On("GenerateParamsWithContext", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]any{
654+
genMock.On("GenerateParams", mock.Anything, mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]any{
655655
{
656656
"path": "examples/git-generator-files-discovery/cluster-config/dev/config.json",
657657
"path.basename": "dev",
@@ -834,7 +834,7 @@ func TestInterpolatedMatrixGenerateGoTemplate(t *testing.T) {
834834
Git: g.Git,
835835
Clusters: g.Clusters,
836836
}
837-
genMock.On("GenerateParamsWithContext", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]any{
837+
genMock.On("GenerateParams", mock.Anything, mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{
838838
{
839839
"path": map[string]string{
840840
"path": "examples/git-generator-files-discovery/cluster-config/dev/config.json",
@@ -985,7 +985,7 @@ func TestMatrixGenerateListElementsYaml(t *testing.T) {
985985
Git: g.Git,
986986
List: g.List,
987987
}
988-
genMock.On("GenerateParamsWithContext", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet).Return([]map[string]any{{
988+
genMock.On("GenerateParams", mock.Anything, mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), appSet, mock.Anything).Return([]map[string]any{{
989989
"foo": map[string]any{
990990
"bar": []any{
991991
map[string]any{
@@ -1048,14 +1048,8 @@ func (g *generatorMock) GetTemplate(appSetGenerator *v1alpha1.ApplicationSetGene
10481048
return args.Get(0).(*v1alpha1.ApplicationSetTemplate)
10491049
}
10501050

1051-
func (g *generatorMock) GenerateParams(_ context.Context, appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
1052-
args := g.Called(appSetGenerator, appSet)
1053-
1054-
return args.Get(0).([]map[string]any), args.Error(1)
1055-
}
1056-
1057-
func (g *generatorMock) GenerateParamsWithContext(_ context.Context, appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
1058-
args := g.Called(appSetGenerator, appSet)
1051+
func (g *generatorMock) GenerateParams(ctx context.Context, appSetGenerator *v1alpha1.ApplicationSetGenerator, appSet *v1alpha1.ApplicationSet, _ client.Client) ([]map[string]any, error) {
1052+
args := g.Called(ctx, appSetGenerator, appSet)
10591053

10601054
return args.Get(0).([]map[string]any), args.Error(1)
10611055
}
@@ -1066,7 +1060,7 @@ func (g *generatorMock) GetRequeueAfter(appSetGenerator *v1alpha1.ApplicationSet
10661060
return args.Get(0).(time.Duration)
10671061
}
10681062

1069-
func TestGitGenerator_GenerateParamsWithContext_list_x_git_matrix_generator(t *testing.T) {
1063+
func TestGitGenerator_GenerateParams_list_x_git_matrix_generator(t *testing.T) {
10701064
// Given a matrix generator over a list generator and a git files generator, the nested git files generator should
10711065
// be treated as a files generator, and it should produce parameters.
10721066

@@ -1080,7 +1074,7 @@ func TestGitGenerator_GenerateParamsWithContext_list_x_git_matrix_generator(t *t
10801074
// of that bug.
10811075

10821076
listGeneratorMock := &generatorMock{}
1083-
listGeneratorMock.On("GenerateParamsWithContext", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).Return([]map[string]any{
1077+
listGeneratorMock.On("GenerateParams", mock.Anything, mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator"), mock.AnythingOfType("*v1alpha1.ApplicationSet"), mock.Anything).Return([]map[string]any{
10841078
{"some": "value"},
10851079
}, nil)
10861080
listGeneratorMock.On("GetTemplate", mock.AnythingOfType("*v1alpha1.ApplicationSetGenerator")).Return(&v1alpha1.ApplicationSetTemplate{})

cmd/argocd/commands/account.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ has appropriate RBAC permissions to change other accounts.
9292
c.HelpFunc()(c, args)
9393
os.Exit(1)
9494
}
95-
acdClient := headless.NewClientOrDie(clientOpts, c)
95+
acdClient := headless.NewClientOrDie(c.Context(), clientOpts, c)
9696
conn, usrIf := acdClient.NewAccountClientOrDie(ctx)
9797
defer io.Close(conn)
9898

@@ -172,7 +172,7 @@ func NewAccountGetUserInfoCommand(clientOpts *argocdclient.ClientOptions) *cobra
172172
os.Exit(1)
173173
}
174174

175-
conn, client := headless.NewClientOrDie(clientOpts, c).NewSessionClientOrDie(ctx)
175+
conn, client := headless.NewClientOrDie(c.Context(), clientOpts, c).NewSessionClientOrDie(ctx)
176176
defer io.Close(conn)
177177

178178
response, err := client.GetUserInfo(ctx, &session.GetUserInfoRequest{})
@@ -228,7 +228,7 @@ Resources: %v
228228
os.Exit(1)
229229
}
230230

231-
conn, client := headless.NewClientOrDie(clientOpts, c).NewAccountClientOrDie(ctx)
231+
conn, client := headless.NewClientOrDie(c.Context(), clientOpts, c).NewAccountClientOrDie(ctx)
232232
defer io.Close(conn)
233233

234234
response, err := client.CanI(ctx, &accountpkg.CanIRequest{
@@ -266,7 +266,7 @@ func NewAccountListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Comman
266266
Run: func(c *cobra.Command, _ []string) {
267267
ctx := c.Context()
268268

269-
conn, client := headless.NewClientOrDie(clientOpts, c).NewAccountClientOrDie(ctx)
269+
conn, client := headless.NewClientOrDie(c.Context(), clientOpts, c).NewAccountClientOrDie(ctx)
270270
defer io.Close(conn)
271271

272272
response, err := client.ListAccounts(ctx, &accountpkg.ListAccountRequest{})
@@ -313,7 +313,7 @@ argocd account get --account <account-name>`,
313313
Run: func(c *cobra.Command, _ []string) {
314314
ctx := c.Context()
315315

316-
clientset := headless.NewClientOrDie(clientOpts, c)
316+
clientset := headless.NewClientOrDie(c.Context(), clientOpts, c)
317317

318318
if account == "" {
319319
account = getCurrentAccount(ctx, clientset).Username
@@ -386,7 +386,7 @@ argocd account generate-token --account <account-name>`,
386386
Run: func(c *cobra.Command, _ []string) {
387387
ctx := c.Context()
388388

389-
clientset := headless.NewClientOrDie(clientOpts, c)
389+
clientset := headless.NewClientOrDie(c.Context(), clientOpts, c)
390390
conn, client := clientset.NewAccountClientOrDie(ctx)
391391
defer io.Close(conn)
392392
if account == "" {
@@ -428,7 +428,7 @@ argocd account delete-token --account <account-name> ID`,
428428
}
429429
id := args[0]
430430

431-
clientset := headless.NewClientOrDie(clientOpts, c)
431+
clientset := headless.NewClientOrDie(c.Context(), clientOpts, c)
432432
conn, client := clientset.NewAccountClientOrDie(ctx)
433433
defer io.Close(conn)
434434
if account == "" {

cmd/argocd/commands/admin/app_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ func TestGetReconcileResults_Refresh(t *testing.T) {
106106
deployment := test.NewDeployment()
107107
kubeClientset := kubefake.NewClientset(deployment, argoCM, argoCDSecret)
108108
clusterCache := clustermocks.ClusterCache{}
109-
clusterCache.On("IsNamespaced", mock.Anything).Return(true, nil)
109+
clusterCache.On("IsNamespaced", mock.Anything, mock.Anything, mock.Anything).Return(true, nil)
110110
clusterCache.On("GetGVKParser", mock.Anything).Return(nil)
111111
repoServerClient := mocks.RepoServerServiceClient{}
112112
repoServerClient.On("GenerateManifest", mock.Anything, mock.Anything).Return(&argocdclient.ManifestResponse{
113113
Manifests: []string{test.DeploymentManifest},
114114
}, nil)
115115
repoServerClientset := mocks.Clientset{RepoServerServiceClient: &repoServerClient}
116116
liveStateCache := cachemocks.LiveStateCache{}
117-
liveStateCache.On("GetManagedLiveObjs", mock.Anything, mock.Anything, mock.Anything).Return(map[kube.ResourceKey]*unstructured.Unstructured{
117+
liveStateCache.On("GetManagedLiveObjs", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(map[kube.ResourceKey]*unstructured.Unstructured{
118118
kube.GetResourceKey(deployment): deployment,
119119
}, nil)
120-
liveStateCache.On("GetVersionsInfo", mock.Anything).Return("v1.2.3", nil, nil)
120+
liveStateCache.On("GetVersionsInfo", mock.Anything, mock.Anything).Return("v1.2.3", nil, nil)
121121
liveStateCache.On("Init").Return(nil, nil)
122-
liveStateCache.On("GetClusterCache", mock.Anything).Return(&clusterCache, nil)
123-
liveStateCache.On("IsNamespaced", mock.Anything, mock.Anything).Return(true, nil)
122+
liveStateCache.On("GetClusterCache", mock.Anything, mock.Anything).Return(&clusterCache, nil)
123+
liveStateCache.On("IsNamespaced", mock.Anything, mock.Anything, mock.Anything).Return(true, nil)
124124

125125
result, err := reconcileApplications(ctx, kubeClientset, appClientset, "default", &repoServerClientset, "",
126126
func(_ db.ArgoDB, _ cache.SharedIndexInformer, _ *settings.SettingsManager, _ *metrics.MetricsServer) statecache.LiveStateCache {

cmd/argocd/commands/app.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func NewApplicationCreateCommand(clientOpts *argocdclient.ClientOptions) *cobra.
153153
Run: func(c *cobra.Command, args []string) {
154154
ctx := c.Context()
155155

156-
argocdClient := headless.NewClientOrDie(clientOpts, c)
156+
argocdClient := headless.NewClientOrDie(ctx, clientOpts, c)
157157
apps, err := cmdutil.ConstructApps(fileURL, appName, labels, annotations, args, appOpts, c.Flags())
158158
errors.CheckError(err)
159159

@@ -387,7 +387,7 @@ func NewApplicationGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
387387
c.HelpFunc()(c, args)
388388
os.Exit(1)
389389
}
390-
acdClient := headless.NewClientOrDie(clientOpts, c)
390+
acdClient := headless.NewClientOrDie(ctx, clientOpts, c)
391391
conn, appIf := acdClient.NewApplicationClientOrDie(ctx)
392392
defer argoio.Close(conn)
393393

@@ -423,7 +423,7 @@ func NewApplicationGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
423423
}
424424
}
425425

426-
pConn, projIf := headless.NewClientOrDie(clientOpts, c).NewProjectClientOrDie(ctx)
426+
pConn, projIf := headless.NewClientOrDie(ctx, clientOpts, c).NewProjectClientOrDie(ctx)
427427
defer argoio.Close(pConn)
428428
proj, err := projIf.Get(ctx, &projectpkg.ProjectQuery{Name: app.Spec.Project})
429429
errors.CheckError(err)
@@ -539,7 +539,7 @@ func NewApplicationLogsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
539539
c.HelpFunc()(c, args)
540540
os.Exit(1)
541541
}
542-
acdClient := headless.NewClientOrDie(clientOpts, c)
542+
acdClient := headless.NewClientOrDie(ctx, clientOpts, c)
543543
conn, appIf := acdClient.NewApplicationClientOrDie(ctx)
544544
defer argoio.Close(conn)
545545
appName, appNs := argo.ParseFromQualifiedName(args[0], "")
@@ -833,7 +833,7 @@ func NewApplicationSetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
833833
os.Exit(1)
834834
}
835835
appName, appNs := argo.ParseFromQualifiedName(args[0], appNamespace)
836-
argocdClient := headless.NewClientOrDie(clientOpts, c)
836+
argocdClient := headless.NewClientOrDie(ctx, clientOpts, c)
837837
conn, appIf := argocdClient.NewApplicationClientOrDie(ctx)
838838
defer argoio.Close(conn)
839839
app, err := appIf.Get(ctx, &application.ApplicationQuery{Name: &appName, AppNamespace: &appNs})
@@ -949,7 +949,7 @@ func NewApplicationUnsetCommand(clientOpts *argocdclient.ClientOptions) *cobra.C
949949
}
950950

951951
appName, appNs := argo.ParseFromQualifiedName(args[0], appNamespace)
952-
conn, appIf := headless.NewClientOrDie(clientOpts, c).NewApplicationClientOrDie(ctx)
952+
conn, appIf := headless.NewClientOrDie(ctx, clientOpts, c).NewApplicationClientOrDie(ctx)
953953
defer argoio.Close(conn)
954954
app, err := appIf.Get(ctx, &application.ApplicationQuery{Name: &appName, AppNamespace: &appNs})
955955
errors.CheckError(err)
@@ -1270,7 +1270,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
12701270
errors.Fatal(errors.ErrorGeneric, "While using --revisions and --source-names, length of values for both flags should be same.")
12711271
}
12721272

1273-
clientset := headless.NewClientOrDie(clientOpts, c)
1273+
clientset := headless.NewClientOrDie(ctx, clientOpts, c)
12741274
conn, appIf := clientset.NewApplicationClientOrDie(ctx)
12751275
defer argoio.Close(conn)
12761276
appName, appNs := argo.ParseFromQualifiedName(args[0], appNamespace)
@@ -1545,7 +1545,7 @@ func NewApplicationDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.
15451545
c.HelpFunc()(c, args)
15461546
os.Exit(1)
15471547
}
1548-
acdClient := headless.NewClientOrDie(clientOpts, c)
1548+
acdClient := headless.NewClientOrDie(ctx, clientOpts, c)
15491549
conn, appIf := acdClient.NewApplicationClientOrDie(ctx)
15501550
defer argoio.Close(conn)
15511551
isTerminal := isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd())
@@ -1683,7 +1683,7 @@ func NewApplicationListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
16831683
Run: func(c *cobra.Command, _ []string) {
16841684
ctx := c.Context()
16851685

1686-
conn, appIf := headless.NewClientOrDie(clientOpts, c).NewApplicationClientOrDie(ctx)
1686+
conn, appIf := headless.NewClientOrDie(ctx, clientOpts, c).NewApplicationClientOrDie(ctx)
16871687
defer argoio.Close(conn)
16881688
apps, err := appIf.List(ctx, &application.ApplicationQuery{
16891689
Selector: ptr.To(selector),
@@ -1875,7 +1875,7 @@ func NewApplicationWaitCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
18751875
selectedResources, err := parseSelectedResources(resources)
18761876
errors.CheckError(err)
18771877
appNames := args
1878-
acdClient := headless.NewClientOrDie(clientOpts, c)
1878+
acdClient := headless.NewClientOrDie(ctx, clientOpts, c)
18791879
closer, appIf := acdClient.NewApplicationClientOrDie(ctx)
18801880
defer argoio.Close(closer)
18811881
if selector != "" {
@@ -2034,7 +2034,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
20342034
}
20352035
}
20362036

2037-
acdClient := headless.NewClientOrDie(clientOpts, c)
2037+
acdClient := headless.NewClientOrDie(ctx, clientOpts, c)
20382038
conn, appIf := acdClient.NewApplicationClientOrDie(ctx)
20392039
defer argoio.Close(conn)
20402040

@@ -2826,7 +2826,7 @@ func NewApplicationHistoryCommand(clientOpts *argocdclient.ClientOptions) *cobra
28262826
c.HelpFunc()(c, args)
28272827
os.Exit(1)
28282828
}
2829-
conn, appIf := headless.NewClientOrDie(clientOpts, c).NewApplicationClientOrDie(ctx)
2829+
conn, appIf := headless.NewClientOrDie(ctx, clientOpts, c).NewApplicationClientOrDie(ctx)
28302830
defer argoio.Close(conn)
28312831
appName, appNs := argo.ParseFromQualifiedName(args[0], appNamespace)
28322832
app, err := appIf.Get(ctx, &application.ApplicationQuery{
@@ -2888,7 +2888,7 @@ func NewApplicationRollbackCommand(clientOpts *argocdclient.ClientOptions) *cobr
28882888
depID, err = strconv.Atoi(args[1])
28892889
errors.CheckError(err)
28902890
}
2891-
acdClient := headless.NewClientOrDie(clientOpts, c)
2891+
acdClient := headless.NewClientOrDie(ctx, clientOpts, c)
28922892
conn, appIf := acdClient.NewApplicationClientOrDie(ctx)
28932893
defer argoio.Close(conn)
28942894
app, err := appIf.Get(ctx, &application.ApplicationQuery{
@@ -3007,7 +3007,7 @@ func NewApplicationManifestsCommand(clientOpts *argocdclient.ClientOptions) *cob
30073007
}
30083008

30093009
appName, appNs := argo.ParseFromQualifiedName(args[0], "")
3010-
clientset := headless.NewClientOrDie(clientOpts, c)
3010+
clientset := headless.NewClientOrDie(ctx, clientOpts, c)
30113011
conn, appIf := clientset.NewApplicationClientOrDie(ctx)
30123012
defer argoio.Close(conn)
30133013

@@ -3127,7 +3127,7 @@ func NewApplicationTerminateOpCommand(clientOpts *argocdclient.ClientOptions) *c
31273127
os.Exit(1)
31283128
}
31293129
appName, appNs := argo.ParseFromQualifiedName(args[0], "")
3130-
conn, appIf := headless.NewClientOrDie(clientOpts, c).NewApplicationClientOrDie(ctx)
3130+
conn, appIf := headless.NewClientOrDie(ctx, clientOpts, c).NewApplicationClientOrDie(ctx)
31313131
defer argoio.Close(conn)
31323132
_, err := appIf.TerminateOperation(ctx, &application.OperationTerminateRequest{
31333133
Name: &appName,
@@ -3154,7 +3154,7 @@ func NewApplicationEditCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
31543154
}
31553155

31563156
appName, appNs := argo.ParseFromQualifiedName(args[0], appNamespace)
3157-
conn, appIf := headless.NewClientOrDie(clientOpts, c).NewApplicationClientOrDie(ctx)
3157+
conn, appIf := headless.NewClientOrDie(ctx, clientOpts, c).NewApplicationClientOrDie(ctx)
31583158
defer argoio.Close(conn)
31593159
app, err := appIf.Get(ctx, &application.ApplicationQuery{
31603160
Name: &appName,
@@ -3224,7 +3224,7 @@ func NewApplicationPatchCommand(clientOpts *argocdclient.ClientOptions) *cobra.C
32243224
os.Exit(1)
32253225
}
32263226
appName, appNs := argo.ParseFromQualifiedName(args[0], appNamespace)
3227-
conn, appIf := headless.NewClientOrDie(clientOpts, c).NewApplicationClientOrDie(ctx)
3227+
conn, appIf := headless.NewClientOrDie(ctx, clientOpts, c).NewApplicationClientOrDie(ctx)
32283228
defer argoio.Close(conn)
32293229

32303230
patchedApp, err := appIf.Patch(ctx, &application.ApplicationPatchRequest{
@@ -3265,7 +3265,7 @@ func NewApplicationAddSourceCommand(clientOpts *argocdclient.ClientOptions) *cob
32653265
os.Exit(1)
32663266
}
32673267

3268-
argocdClient := headless.NewClientOrDie(clientOpts, c)
3268+
argocdClient := headless.NewClientOrDie(ctx, clientOpts, c)
32693269
conn, appIf := argocdClient.NewApplicationClientOrDie(ctx)
32703270
defer argoio.Close(conn)
32713271

@@ -3338,7 +3338,7 @@ func NewApplicationRemoveSourceCommand(clientOpts *argocdclient.ClientOptions) *
33383338
errors.Fatal(errors.ErrorGeneric, "Value of source-position must be greater than 0")
33393339
}
33403340

3341-
argocdClient := headless.NewClientOrDie(clientOpts, c)
3341+
argocdClient := headless.NewClientOrDie(ctx, clientOpts, c)
33423342
conn, appIf := argocdClient.NewApplicationClientOrDie(ctx)
33433343
defer argoio.Close(conn)
33443344

@@ -3413,7 +3413,7 @@ func NewApplicationConfirmDeletionCommand(clientOpts *argocdclient.ClientOptions
34133413
os.Exit(1)
34143414
}
34153415

3416-
argocdClient := headless.NewClientOrDie(clientOpts, c)
3416+
argocdClient := headless.NewClientOrDie(ctx, clientOpts, c)
34173417
conn, appIf := argocdClient.NewApplicationClientOrDie(ctx)
34183418
defer argoio.Close(conn)
34193419

0 commit comments

Comments
 (0)