Question regarding the file testutils/testing.go

10 views
Skip to first unread message

Augustin Husson

unread,
May 18, 2020, 12:25:39 PM5/18/20
to Prometheus Developers
Hello,

After changing some code in prometheus-community/promql-langserver, I figure out it was using some method coming from testutils/testing.go. And after looking at it, I was wondering why did you need these methods.

I mean it is a bit strange that prometheus has to implement for themself a sort of framework for the unit test. So I guess there is a good reason for that just would like to know which one if it's ok for you :).

I'm just asking because the methods coming from this particular file could be replaced by the one coming from the repository stretchr/testify. Specially with the package assert.

What do you think ? Is it completely stupid ^^ ?

Wish you the best.
Kinds regards,
Augustin.

Goutham Veeramachaneni

unread,
May 18, 2020, 12:34:54 PM5/18/20
to Augustin Husson, Prometheus Developers
Hi,

Yeah, one main reason is to avoid an entire huge dependency when you just need a small subset of the functionality. Funnily enough when we first did it, we had just a few lines of code, so it didn't make sense to import the dependency for ~20 lines of code :) See some more context here: https://github.com/prometheus/prometheus/issues/3242#issuecomment-334439064 

But overtime, we've added a little more functionality, but overall, the amount of functionality we need is quite small to import that big package.

Thanks,
Goutham.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/b4a70bf6-528f-44ba-92e9-62dead8eaac7%40googlegroups.com.

Augustin Husson

unread,
May 18, 2020, 1:10:03 PM5/18/20
to Goutham Veeramachaneni, Prometheus Developers
Thabk you for your answer :) that was interesting !

But well after two years, you don't want to reconsider it ?
With go mod, the treeshaking is pretty good and even if we are talking about few lines of code, it is still less code to maintain :)

And besides it won't increase the size of the binary

Kinds regards,
Augustin
Reply all
Reply to author
Forward
0 new messages