kubeshop / tracetest

🔭 Tracetest - Build integration and end-to-end tests in minutes, instead of days, using OpenTelemetry and trace-based testing.
https://docs.tracetest.io/
Other
1.07k stars 73 forks source link

Tracetest Server APIs not accessible #4045

Open cb645j opened 1 month ago

cb645j commented 1 month ago

I am running the tracetest server in a k8 environment using the official tracetest helm chart. When I try to access any of the APIs outlined in the documentation (openapi), I receive back a javascript error or a message saying "moved permanently". How do you access the json apis? What is the path to the api backend server? Urls ive tried are below. It seems all these paths hit the frontend javascript, i want to access the json apis directly.

Request: GET http://tracetest:11633/api/testsuites/ Response: <a href="/api/testsuites">Moved Permanently</a>.

Request: GET http://tracetest:11633/testsuites/ Response: <!doctype html>Tracetest

To reproduce: start tracetest server using helm chart. Using postman or curl or http client, try to access any of the apis outlined in the openapi docs.

mathnogueira commented 1 month ago

Hello @cb645j. Did you install Tracetest via helm install tracetest kubeshop/tracetest?

Are you using a production-ready k8s or a testing one like minikube or kind?

I tried installing tracetest locally and I could access the API at http://localhost:11633/api/testsuites. But for that, I used port-forward.

Edit: running a curl command from inside the cluster using the coreDNS also works for me image

mathnogueira commented 1 month ago

Oh, you are adding a trailing slash at the end. Try removing it:

http://tracetest:11633/api/testsuites/ ==> http://tracetest:11633/api/testsuites
mathnogueira commented 1 month ago

@cb645j did you try removing the trailing slash in your URL? Did it work?

cb645j commented 1 month ago

oh wow, that actually fixed it. thanks a bunch!! im surprised putting a slash at the end would cause that, usually apps can support trailing slashes... I do have another question. Does tracetest cli support proxy if you have proxy env variables set? When I run tracetest locally along with the tracetest cli I am able to connect fine. However when i try to configure tracetest cli to connect to a tracetest server running in a k8 test environment I get the "Cannot reach "http://tracetest-ingress:11633". Please verify the url and enter it again." error. I try to run the configure command with -d flag but that does nothing. Does the cli write logs anywhere? How do you suggest debugging?

mathnogueira commented 1 month ago

"Cannot reach "http://tracetest-ingress:11633/"

The CLI must have access to the address. This looks like an internal DNS name for kubernetes. In this case, you would need to either:

  1. Expose the service via ingress
  2. Port-forward and use the created tunnel to connect your CLI to the server

For debugging, there's a --verbose (or -v) option that you can use to get more logs.

cb645j commented 1 month ago

@mathnogueira Thank you. Is there a way to access the latest version of a testsuite via the api?? If I access /testsuites/{testsuiteid} it does not return any specific version nor does it return the summary (despite the documentation showing it should). Im assuming this api is supposed to return the latest version of the specified testsuite but the documentation is unclear on that. So the only way to get the summary block is to query a specific version, i.e. /testsuites/{testsuiteid}/version/{versionnumber}.

/testsuites/{testsuiteid} response (does not match documenation)

{
    "type": "TestSuite",
    "spec": {
        "id": "smokeTestsSuite",
        "name": "Smoke Tests",
        "description": "Runs all cricial test cases",
        "steps": [
            "jettyDmeNukeServer",
            "jettyDmeNukeServer_nuke"
        ]
    }
}

/testsuites/{testsuiteid}/version/{versionnum} response

{
    "id": "smokeTestsSuite",
    "createdAt": "2024-10-08T17:57:01.034191Z",
    "name": "Smoke Tests",
    "description": "Runs all cricial test cases",
    "version": 3,
    "steps": [
        "jettyDmeNukeServer",
        "jettyDmeNukeServer_nuke"
    ],
    "fullSteps": [
        {
            .............
            }
    ],
    "summary": {
        "runs": 12,
        "lastRun": {
            "time": "2024-10-09T19:02:14.763736Z",
            "passes": 14,
            "fails": 3,
            "analyzerScore": 0
        }
    }
}

Also there seems to be a bug regarding asserations. My test fails because it says attribute "kind" does not exist but you can clearly see that it does exit. See pic below. I can open up a seperate ticket for this if you would like.

tractest bug