main: Mock file system and add getFile tests
This uses afero to proxy all file system accesses and then injects an in-memory file system in order to test the getFile
function.
I'm not very familiar with Go so there might be a better way to do this. Afero turned up in my Google search for "mock file system in go". It is (mostly) compatible with the system package interfaces which made it relatively easy to replace the various calls.
This could also be used to write unit tests against other parts of the program but I limited it to getFile
for now as POC.
Merge request reports
Activity
mentioned in merge request !14 (merged)
By Johannes Marbach on 2021-12-30T13:34:47
19 19 "strings" 20 20 "time" 21 21 22 "github.com/spf13/afero" 23 22 24 "gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/archive" 23 25 "gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/deviceinfo" 24 26 "gitlab.com/postmarketOS/postmarketos-mkinitfs/pkgs/misc" 25 27 ) 26 28 29 var appFs afero.Fs 30 31 func initFs(fs afero.Fs) { added 1 commit
- 91529b73 - main: Mock file system and add getFile tests
By Johannes Marbach on 2021-12-30T13:40:56
changed milestone to %v2.0
removed milestone %v2.0
mentioned in issue #40
By clayton craft on 2024-03-11T17:21:58
added status::mr-stale label
Sorry to bother you @cherrypicker,
but we've detected that this merge request hasn't seen any recent activity. If you need help or want to discuss your approach with developers you can ping
@postmarketOS
. You can also ask on matrix in #devel:postmarketos.org or #postmarketos-devel on OFTC. If no further activity occurs in this MR, postmarketOS developers may close it in the future.Thanks for your contribution.
By * postmarketOS Bot on 2024-06-17T16:44:52