AW: AW: AW: AW: Possible pattern for reducing the negative effects of using singletons and improving testability

2024-07-18 Thread Christofer Dutz
Ok … guess my numbers were not 100% correct. It was pointed out that it says: “that you are part of” at the top of the page. So from all project that I’m a committer of (it shows 9) IoTDB consumed 95% of the resources. Not quite as bad as I thought at first, but still not good. Chris Von:

AW: AW: AW: AW: Possible pattern for reducing the negative effects of using singletons and improving testability

2024-07-18 Thread Christofer Dutz
And just so you know how huge this problem is: https://infra-reports.apache.org/#ghactions For all non-members, that don’t have access to that resource: It shows how much of the GitHub Actions resources each project is using. Apache IoTDB is currently using 95% of all GitHub Actions resources,

AW: AW: AW: AW: Possible pattern for reducing the negative effects of using singletons and improving testability

2024-07-18 Thread Christofer Dutz
I think for some tests, it might be worth migrating them back from an IT to an UT. I’m currently trying to get resource-consumption stats from infra and wanted to start finding out which are our most “expensive” Its and possibly start a discussion on converting them to unit-tests. Right now, it

Re: AW: AW: AW: Possible pattern for reducing the negative effects of using singletons and improving testability

2024-07-18 Thread Tian Jiang
Certainly, I am not actually expecting a really perfect solution, just hoping when someone else sees this discussion, he may provide a better trade-off. And as I have said, I am happy with both solutions, as long as they can get rid of the singletons. Mocking is helpful in tests. But the

AW: AW: AW: Possible pattern for reducing the negative effects of using singletons and improving testability

2024-07-18 Thread Christofer Dutz
Hi Tian, I think – as usual – there probably is no perfect solution. I guess it comes down to deciding which things you are willing to do in order to solve some other problems on the other side. I personally think our biggest problem right now (At least this is what’s making my Life a lot

Re: AW: AW: Possible pattern for reducing the negative effects of using singletons and improving testability

2024-07-18 Thread Tian Jiang
A template (or util) method can provide basic contexts, and the developers just need to override the parts they need (of course they should know which parts they need). In the constructor-way, the developer should know what instances they will use, create them, and pass them to the

AW: AW: Possible pattern for reducing the negative effects of using singletons and improving testability

2024-07-18 Thread Christofer Dutz
However, then you need to construct these contexts with loads of parameters for unit tests … I personally don’t think passing in explicitly what you need into a constructor is bad. So, if you have this service that you want to test: How can you tell the developer writing the test which services