DietPi-Dashboard
DietPi-Dashboard copied to clipboard
test(backend): add Rust tests
Sadly, since we can't make any assumptions about the computer DietPi is running on, most of these tests will have to be incredibly basic, and some of them won't even run on the GitHub Actions Ubuntu VM.
- [x] Add tests for
round_percent
- [x] Add tests for
cpu
- [x] Add tests for
ram
- [x] Add tests for
swap
- [x] Add tests for
disk
- [x] Add tests for
network
- [x] Add tests for
processes
- [x] Add tests for
dpsoftware
- [x] Add tests for
host
- [x] Add tests for
services
- [ ] Add tests for
browser_handler
(Test all functions of file browser) - [ ] Add tests for
file_handler
- [ ] Add tests for
term_handler
- [ ] Add tests for
config
Is there any issue merging the tests which are there now? No need to implement all of them in a single PR IMO. Could be also done on demand when a certain bug was found or certain page/feature code touched anyway.
A few of them still use Warp, which would be a problem. But I could probably fix them up and merge them soon (though I'd probably scrap them and start again actually, too much has changed). The problem is that it's really hard to test functions that return things like CPU percentage, which is in no way fixed. The only thing I've found to do is bounds checking and making sure the function doesn't panic.
I just resolved conflicts with main
, hopefully didn't break something, but since it was really the tests at the bottom of scripts + tempfile
dependency only, pretty clean.
use warp::Filter;
I see, so they need to be updated 😉.