@@ -1035,19 +1035,19 @@ func TestKubernetesClient(t *testing.T) {
1035
1035
})
1036
1036
1037
1037
t .Run ("Get application test-app1 successful" , func (t * testing.T ) {
1038
- app , err := client .GetApplication (context .TODO (), "test-app1" )
1038
+ app , err := client .GetApplication (context .Background (), "test-app1" )
1039
1039
require .NoError (t , err )
1040
1040
assert .Equal (t , "test-app1" , app .GetName ())
1041
1041
})
1042
1042
1043
1043
t .Run ("Get application test-app2 successful" , func (t * testing.T ) {
1044
- app , err := client .GetApplication (context .TODO (), "test-app2" )
1044
+ app , err := client .GetApplication (context .Background (), "test-app2" )
1045
1045
require .NoError (t , err )
1046
1046
assert .Equal (t , "test-app2" , app .GetName ())
1047
1047
})
1048
1048
1049
1049
t .Run ("Get application not found" , func (t * testing.T ) {
1050
- _ , err := client .GetApplication (context .TODO (), "test-app-non-existent" )
1050
+ _ , err := client .GetApplication (context .Background (), "test-app-non-existent" )
1051
1051
require .Error (t , err )
1052
1052
assert .Contains (t , err .Error (), "application test-app-non-existent not found" )
1053
1053
})
@@ -1073,7 +1073,7 @@ func TestKubernetesClient(t *testing.T) {
1073
1073
assert .EqualError (t , err , "error listing applications: Internal error occurred: list error" )
1074
1074
1075
1075
// Test GetApplication error handling
1076
- _ , err = client .GetApplication (context .TODO (), "test-app" )
1076
+ _ , err = client .GetApplication (context .Background (), "test-app" )
1077
1077
assert .Error (t , err )
1078
1078
assert .Contains (t , err .Error (), "error listing applications: Internal error occurred: list error" )
1079
1079
})
@@ -1098,7 +1098,7 @@ func TestKubernetesClient(t *testing.T) {
1098
1098
require .NoError (t , err )
1099
1099
1100
1100
// Test GetApplication with multiple matching applications
1101
- _ , err = client .GetApplication (context .TODO (), "test-app" )
1101
+ _ , err = client .GetApplication (context .Background (), "test-app" )
1102
1102
assert .Error (t , err )
1103
1103
assert .EqualError (t , err , "multiple applications found matching test-app" )
1104
1104
})
@@ -1128,7 +1128,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
1128
1128
require .NoError (t , err )
1129
1129
1130
1130
appName := "test-app"
1131
- spec , err := client .UpdateSpec (context .TODO (), & application.ApplicationUpdateSpecRequest {
1131
+ spec , err := client .UpdateSpec (context .Background (), & application.ApplicationUpdateSpecRequest {
1132
1132
Name : & appName ,
1133
1133
Spec : & v1alpha1.ApplicationSpec {Source : & v1alpha1.ApplicationSource {
1134
1134
RepoURL : "https://github.com/argoproj/argocd-example-apps" ,
@@ -1156,7 +1156,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
1156
1156
Spec : & v1alpha1.ApplicationSpec {},
1157
1157
}
1158
1158
1159
- _ , err = client .UpdateSpec (context .TODO (), spec )
1159
+ _ , err = client .UpdateSpec (context .Background (), spec )
1160
1160
assert .Error (t , err )
1161
1161
assert .Contains (t , err .Error (), "error getting application: application test-app not found" )
1162
1162
})
@@ -1185,7 +1185,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
1185
1185
Spec : & v1alpha1.ApplicationSpec {},
1186
1186
}
1187
1187
1188
- _ , err = client .UpdateSpec (context .TODO (), spec )
1188
+ _ , err = client .UpdateSpec (context .Background (), spec )
1189
1189
assert .Error (t , err )
1190
1190
assert .Contains (t , err .Error (), "max retries(0) reached while updating application: test-app" )
1191
1191
})
@@ -1213,7 +1213,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
1213
1213
Spec : & v1alpha1.ApplicationSpec {},
1214
1214
}
1215
1215
1216
- _ , err = client .UpdateSpec (context .TODO (), spec )
1216
+ _ , err = client .UpdateSpec (context .Background (), spec )
1217
1217
assert .Error (t , err )
1218
1218
assert .Contains (t , err .Error (), "error updating application: non-conflict error" )
1219
1219
})
0 commit comments