Skip to content

Running integration tests with go fails for argocd cli login to the cluster #256

@rklonner

Description

@rklonner

I am not sure if this is a problem with my setup but I can't get the go integration tests to run.

Sun, 26 Oct 2025 21:26:39 CET WRN Argo CD login attempt 9/10 failed. error="argocd command failed: time=\"2025-10-26T21:26:39+01:00\" level=fatal msg=\"cannot find pod with selector: [app.kubernetes.io/name=] - use the --{component}-name flag in this command or set the environmental variable (Refer to https://argo-cd.readthedocs.io/en/stable/user-guide/environment-variables), to change the Argo CD component name in the CLI\"\n: exit status 1"
Sun, 26 Oct 2025 21:26:40 CET DBG Login attempt 10/10 to Argo CD...
Sun, 26 Oct 2025 21:26:40 CET ERR ❌ Failed to login to Argo CD after 10 attempts error="argocd command failed: time=\"2025-10-26T21:26:40+01:00\" level=fatal msg=\"cannot find pod with selector: [app.kubernetes.io/name=] - use the --{component}-name flag in this command or set the environmental variable (Refer to https://argo-cd.readthedocs.io/en/stable/user-guide/environment-variables), to change the Argo CD component name in the CLI\"\n: exit status 1"
Sun, 26 Oct 2025 21:26:40 CET ERR ❌ Failed to install Argo CD
Sun, 26 Oct 2025 21:26:40 CET INF 🧟‍♂️ Cluster will be kept alive after the tool finishes
Sun, 26 Oct 2025 21:26:40 CET ERR ❌ failed to login: failed to login after 10 attempts
Sun, 26 Oct 2025 21:26:40 CET INF 🐛 If you believe this error is caused by a bug, please open an issue on GitHub
make[3]: *** [makefile:31: run-single-test-go] Error 1
make[3]: Leaving directory '/home/klonner/git/github/rklonner/argocd-diff-preview/tests'
make[2]: *** [makefile:112: run-test-all-with-go] Error 2
make[2]: Leaving directory '/home/klonner/git/github/rklonner/argocd-diff-preview/tests'
make[1]: *** [makefile:137: run-test-all-go] Error 2
make[1]: Leaving directory '/home/klonner/git/github/rklonner/argocd-diff-preview/tests'
make: *** [makefile:84: run-integration-tests-go] Error 2

As the kind cluster still lives afterwards I had a look, seems it does not have the argocd-initial-admin-secret inside that the login process relies on.

k -n argocd get secrets

NAME                           TYPE                 DATA   AGE
argocd-redis                   Opaque               1      3s
argocd-secret                  Opaque               0      0s
sh.helm.release.v1.argocd.v1   helm.sh/release.v1   1      56s

When I mnaully retrieve the secret from there with (not sure if this is enough to reproduce what the script does):

export ARGOCD_OPTS="--port-forward --port-forward-namespace=argocd"
argocd login --insecure --username admin --password

I get the same error message as from the integration tests.

error="argocd command failed: time="2025-10-26T21:26:39+01:00" level=fatal msg="cannot find pod with selector: [app.kubernetes.io/name=] - use the --{component}-name flag in this command or set the environmental variable (Refer to https://argo-cd.readthedocs.io/en/stable/user-guide/environment-variables), to change the Argo CD component name in the CLI"\n: exit status 1"

Steps to reproduce:

git clone https://github.com/dag-andersen/argocd-diff-preview.git
cd argocd-diff-preview
make run-integration-tests-go

Attached you can find the full output of a run.
integration-tests-go-error-messages.log

Do I need to consider something before executing the tests?
If not, do you have a hint what could be the issue with my environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions