romanovskyj / gongfig

Import and export Kong configuration tool written in Go
Apache License 2.0
25 stars 5 forks source link

Implement test coverage functionality #43

Closed romanovskyj closed 5 years ago

romanovskyj commented 5 years ago

Currently, it is quite hard to apply test coverage for the project as there are many places where log.fatalf is used. It means that the command exits on this step, so coverage could not be counted as the only way to run such test it envolve separate process.

The solution is to redefine log.fatalf and mock it in tests (see example here https://stackoverflow.com/questions/40615641/testing-os-exit-scenarios-in-go-with-coverage-information-coveralls-io-goverall/40801733)

romanovskyj commented 5 years ago

Done