DietPi-Dashboard icon indicating copy to clipboard operation
DietPi-Dashboard copied to clipboard

test(backend): add Rust tests

Open ravenclaw900 opened this issue 2 years ago • 3 comments

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

ravenclaw900 avatar Dec 31 '21 14:12 ravenclaw900

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.

MichaIng avatar Mar 18 '23 00:03 MichaIng

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.

ravenclaw900 avatar Mar 18 '23 00:03 ravenclaw900

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 😉.

MichaIng avatar Mar 18 '23 00:03 MichaIng