Skip to content

Conversation

@aagbsn
Copy link
Contributor

@aagbsn aagbsn commented Nov 7, 2025

No description provided.

assert "net-tests" in j
for v in j["net-tests"]:
for x in ["collector", "input-hashes", "name", "test-helpers", "test-helpers-alternate", "version"]:
assert x in v
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also port the other tests that are here:

def test_bouncer_net_tests(client):
?

Mostly to be sure we're not breaking the API

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the other tests - thank you for pointing those out - but I changed the expected response code because FastAPI returns error 422 rather than errorcode 400. Legacy probes may or may not check for a specific errorcode so we need to confirm that before merging this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather go with the safe route in this one, let's change it to 400.
I was looking into how this can be done and it seems like parsing the request manually is the way to go in this case, sorry for asking you to change it in another comment

We could do something like

    try:
        j = await req.json()
        m = NetTestsRequest(**j)
    except pydantic.ValidationError as e:
        raise HTTPException(400, detail=e.errors())

(or you could manually parse the json like you had before, any choice is good to me)

It would mess the api docs for this endpoint but in this case it doesn't really matter since this endpoint is not used by new clients and we keep it just for backwards compatibility

@LDiazN
Copy link
Contributor

LDiazN commented Nov 12, 2025

related to #807

I modified the tests to expect any error (other than http response 200)
because FastAPI returns HTTP error 422 Unprocessable Entity instead of 400,
as the tests do not supply a request that the model can validate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants