edgebox-iot / edgebox-iot/edgeboxctl
[TESTS] Implement Mocking where needed
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Using mocking to be able to test some of the functions in modules that depend on dynamic functionality (measuring available disks and disk sizes, getting a list of running apps, etc).
This is an iteration on our efforts to provide complete app testing.
There are two types of mocking we will be interested in doing:
- function return mocking, which mocks the return value of a function, be it internally or in external dependencies / apis. This can be achieve through clever implementation of Interfaces in Golang. More[ information about Interfaces here](https://golangdocs.com/interfaces-in-golang), and a[ tutorial on mocking using Interfaces here](https://medium.com/@ankur_anand/how-to-mock-in-your-go-golang-tests-b9eee7d7c266).
- DB call mocking, that we can leverage to simulate the existence of various states within the application. [MORE INFORMATION AND REFERENCES NEEDED HERE]
Some task guidelines for a PR:
- [ ] Implement interfaces for mocking data that is called within `storage.getDevicesSpaceUsage` and `storage.getDevices`.
- [ ] Reliably test all branches of those functions
- [ ] Gather information about what in the codebase can benefit from this approach
- [ ] Research DB call mocking to test `edgeapps.go`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.