Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func runImageUpdater(cfg *ImageUpdaterConfig, warmUp bool) (argocd.ImageUpdaterR
wg.Add(len(appList))

for app, curApplication := range appList {
lockErr := sem.Acquire(context.TODO(), 1)
lockErr := sem.Acquire(context.Background(), 1)
if lockErr != nil {
log.Errorf("Could not acquire semaphore for application %s: %v", app, lockErr)
// Release entry in wait group on error, too - we're never gonna execute
Expand Down
2 changes: 1 addition & 1 deletion cmd/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestGetKubeConfig(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client, err := getKubeConfig(context.TODO(), tt.namespace, tt.configPath)
client, err := getKubeConfig(context.Background(), tt.namespace, tt.configPath)
if tt.expectError {
require.Error(t, err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/argocd/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (client *k8sClient) getApplicationInAllNamespaces(appName string) (*v1alpha

// ListApplications lists all applications across all namespaces.
func (client *k8sClient) ListApplications(labelSelector string) ([]v1alpha1.Application, error) {
list, err := client.kubeClient.ApplicationsClientset.ArgoprojV1alpha1().Applications(*client.appNamespace).List(context.TODO(), v1.ListOptions{LabelSelector: labelSelector})
list, err := client.kubeClient.ApplicationsClientset.ArgoprojV1alpha1().Applications(*client.appNamespace).List(context.Background(), v1.ListOptions{LabelSelector: labelSelector})
if err != nil {
return nil, fmt.Errorf("error listing applications: %w", err)
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/argocd/argocd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,19 +1035,19 @@ func TestKubernetesClient(t *testing.T) {
})

t.Run("Get application test-app1 successful", func(t *testing.T) {
app, err := client.GetApplication(context.TODO(), "test-app1")
app, err := client.GetApplication(context.Background(), "test-app1")
require.NoError(t, err)
assert.Equal(t, "test-app1", app.GetName())
})

t.Run("Get application test-app2 successful", func(t *testing.T) {
app, err := client.GetApplication(context.TODO(), "test-app2")
app, err := client.GetApplication(context.Background(), "test-app2")
require.NoError(t, err)
assert.Equal(t, "test-app2", app.GetName())
})

t.Run("Get application not found", func(t *testing.T) {
_, err := client.GetApplication(context.TODO(), "test-app-non-existent")
_, err := client.GetApplication(context.Background(), "test-app-non-existent")
require.Error(t, err)
assert.Contains(t, err.Error(), "application test-app-non-existent not found")
})
Expand All @@ -1073,7 +1073,7 @@ func TestKubernetesClient(t *testing.T) {
assert.EqualError(t, err, "error listing applications: Internal error occurred: list error")

// Test GetApplication error handling
_, err = client.GetApplication(context.TODO(), "test-app")
_, err = client.GetApplication(context.Background(), "test-app")
assert.Error(t, err)
assert.Contains(t, err.Error(), "error listing applications: Internal error occurred: list error")
})
Expand All @@ -1098,7 +1098,7 @@ func TestKubernetesClient(t *testing.T) {
require.NoError(t, err)

// Test GetApplication with multiple matching applications
_, err = client.GetApplication(context.TODO(), "test-app")
_, err = client.GetApplication(context.Background(), "test-app")
assert.Error(t, err)
assert.EqualError(t, err, "multiple applications found matching test-app")
})
Expand Down Expand Up @@ -1128,7 +1128,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
require.NoError(t, err)

appName := "test-app"
spec, err := client.UpdateSpec(context.TODO(), &application.ApplicationUpdateSpecRequest{
spec, err := client.UpdateSpec(context.Background(), &application.ApplicationUpdateSpecRequest{
Name: &appName,
Spec: &v1alpha1.ApplicationSpec{Source: &v1alpha1.ApplicationSource{
RepoURL: "https://github.com/argoproj/argocd-example-apps",
Expand Down Expand Up @@ -1156,7 +1156,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
Spec: &v1alpha1.ApplicationSpec{},
}

_, err = client.UpdateSpec(context.TODO(), spec)
_, err = client.UpdateSpec(context.Background(), spec)
assert.Error(t, err)
assert.Contains(t, err.Error(), "error getting application: application test-app not found")
})
Expand Down Expand Up @@ -1185,7 +1185,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
Spec: &v1alpha1.ApplicationSpec{},
}

_, err = client.UpdateSpec(context.TODO(), spec)
_, err = client.UpdateSpec(context.Background(), spec)
assert.Error(t, err)
assert.Contains(t, err.Error(), "max retries(0) reached while updating application: test-app")
})
Expand Down Expand Up @@ -1213,7 +1213,7 @@ func TestKubernetesClientUpdateSpec(t *testing.T) {
Spec: &v1alpha1.ApplicationSpec{},
}

_, err = client.UpdateSpec(context.TODO(), spec)
_, err = client.UpdateSpec(context.Background(), spec)
assert.Error(t, err)
assert.Contains(t, err.Error(), "error updating application: non-conflict error")
})
Expand Down
2 changes: 1 addition & 1 deletion registry-scanner/pkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (endpoint *RegistryEndpoint) GetTags(img *image.ContainerImage, regClient R

logCtx.Tracef("Getting manifest for image %s:%s (operation %d/%d)", nameInRegistry, tagStr, i, len(tags))

lockErr := sem.Acquire(context.TODO(), 1)
lockErr := sem.Acquire(context.Background(), 1)
if lockErr != nil {
log.Warnf("could not acquire semaphore: %v", lockErr)
wg.Done()
Expand Down