Merge new implementation of robot ri api with unit tests into dev. #6
Reference in New Issue
Block a user
Delete Branch "feat/cb2ui-robot-connections"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This merge adds the new agent structure into dev, focussing on the robot ri api. It includes unit tests and communication agents that check the respective sockets and can handle negotiation for the ports and binds.
In order to test this merge you should do the following:
To use the certificate follow these steps (In the correct map:):
sudo prosodyctl cert generate localhostGenerates a certificate, asking you for the parameters...commonNamehas(localHost)next to it, or enter it yourself. The rest of the parameters canbe the default value, by pressing
Enter.cp /var/lib/prosody/localhost.crt /etc/prosody/certs/localhost.crtandcp /var/lib/prosody/localhost.key /etc/prosody/certs/localhost.keyto copy the certificate and key to the correct map.sudo chown prosody /etc/prosody/certs/localhost.{key,crt}to change 'ownership' to prosody and enable the certificate.(If any of these steps need additional permissions, make sure to use
sudobefore the command)In order to test this environment you can use the pytest library (make sure you are in the virtual environment):
─
PYTHONPATH=src pytest test/If you want additional feedback on coverage you can use this command:
─
PYTHONPATH=src pytest --cov=control_backend.agents.ri_communication_agent --cov=control_backend.agents.ri_command_agent --cov-report=term-missing test/In order to approve of this merge you can follow this checklist:
uv run fastapi dev src/control_backend/main.pyshould result in the following log:and after initializing with the RI, the message stream should look like this:
This means that the agents are correctly setup, and that the ping system is working correctly.
ref:N25B-170
ref:N25B-205
assigned to @9828273
.vscode/ should be added to the .gitignore I think.
The test/ directory structure should mirror that of src/. This means that your tests should be under test/control_backend/agents/...
added 1 commit
d71cb605- fix: gitignore + testing map structureCompare with previous version
added 1 commit
530fc42c- fix: router changes + hopefully gitignoreCompare with previous version
requested review from @0950726
Ter verduidelijking: in dev staat nu een geautomatiseerd testsysteem, en daar is de PYTHONPATH al goed geregeld. Die hoef je er dus niet meer actief bij te zetten. Daarnaast: je kunt beter de tests runnen met
uv run --only-group test pytestom ervoor te zorgen dat alleen de benodigde dependencies (libraries) in de venv staan. Waarschijnlijk gaat dat niet in 1x goed, dan moet je even kijken hoe ik het heb gefixt met deconftest.pydoor de libraries te mocken. Voor dat command met de gescheiden dependencies moet je ook je environment updaten, maar dat kan in principe ook door degene te kopieren die nu in dev staat.I think we should not log every ping message, definitely not as
logger.info, maybe withlogger.debug.Messageis not the right model for the RI. Instead of{"message": "something"}, it should be something like{"endpoint": "actuate/...", "data": "some data"}You could make a pydantic model like:
If it's in the scope of your tickets, make an endpoint in the
control_backend.api.v1.endpoints, like "command.py" to replace "message.py". "message.py" is dependent on thisMessagemodel, so maybe "command.py" can use a newSpeechCommandmodel.Making a web request to "/command/speak" or "/command/gesture" would be nice and more descriptive than "/message"
For example:
Edit:
SpeechCommandshould inherit fromRIMessage.changed this line in version 5 of the diff
changed this line in version 5 of the diff
added 1 commit
1f8d7697- chore: adjust message/command structure and write unit testsCompare with previous version
added 1 commit
a2a04740- chore: add unit test for router and implement command routerCompare with previous version
added 14 commits
devd599f71c- Merge remote-tracking branch 'origin/dev' into feat/cb2ui-robot-connectionsCompare with previous version
added 1 commit
87bd12d7- fix: restructure tests for integrationCompare with previous version
added 1 commit
c1217a90- fix: fixed duplicate entry in uv.lockCompare with previous version
added 1 commit
31e77de2- chore: fix style guide max charactersCompare with previous version
I had to make some changes to be able to send a speech message to the RI from an HTTP request. I believe all contents of a
send_multipartmessage need to bebytes, so:recv_multipartgives only bytes, so:Perhaps make an integration test for this: mocking the
pubsocket.send_jsonofri_command_agentand checking whether it gets called and whether the argument is correct.We now have a linter in the
devbranch. Could you merge that and format your code with:There might be things it cannot change automatically. If it doesn't tell you which things, try
ruff checkto find them and then change them manually.changed this line in version 11 of the diff
changed this line in version 11 of the diff
added 1 commit
149d20e7- chore: apply recommended changes for mergingCompare with previous version
added 4 commits
dev52faa591- Merge remote-tracking branch 'origin/dev' into feat/cb2ui-robot-connectionsCompare with previous version
added 1 commit
47a87d0b- fix: unit tests fixes and ruff formatingCompare with previous version
added 1 commit
473c0fdc- fix: fix gitlab ci pipelineCompare with previous version
added 1 commit
c75f5de9- fix: fix only group integration testing to exclude missing dependenciesCompare with previous version
added 1 commit
423309e0- fix: unit test refactoring with conftest and more mocksCompare with previous version
added 1 commit
acb6a694- fix: quick fix for pydantic import for testsCompare with previous version
added 1 commit
3730943b- fix: quick fix for fastapi import for testsCompare with previous version
added 1 commit
a1b8a7a0- Revert "fix: quick fix for fastapi import for tests"Compare with previous version
added 3 commits
437b21a6- Revert "fix: quick fix for pydantic import for tests"fd11e63b- Revert "fix: unit test refactoring with conftest and more mocks"e196609e- Revert "fix: fix only group integration testing to exclude missing dependencies"Compare with previous version
added 1 commit
bea6bf2a- fix: Reverted to different branch and updated gitlab cicd for this branchCompare with previous version
added 1 commit
2b8a3967- fix: just dont do integration tests. :(Compare with previous version
added 1 commit
158911b1- fix: change conftest placeCompare with previous version
Tests pass, my end to end system tests with
And RI running also works. I'm gonna merge!
mentioned in commit
b551e4e042