-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better timeout handling #111
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this is actually improving. IIUC this only adds the ability to set a default timeout via env variables?
reporter Reporter | ||
timedOut bool | ||
shouldContinue chan bool | ||
mutex sync.Mutex | ||
timer *time.Timer | ||
} | ||
|
||
func (g *G) SetDefaultTimeout(timeout time.Duration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is never called / used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, this is user-facing API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, in that case this needs to be tested. However don't add anything until we decide if it makes sense to add this functionality or not. I still don't quite understand what this is improving / fixing.
The issue I'm trying to address here is that if you have different tests written using different frameworks (eg. we have a bit of testify) then passing a CLI flag ( Re: Hope that makes sense? |
Interesting.. is
Kind of ... there's something that I'm not seeing here. You basically added a new We basically have:
Besides this PR needing docs and tests, it's hard to have a mental model about what happens if I set one or many of these variables. |
Correct:
Yeah, I see what you mean. TBH the main thing I care about is the ability to set the global timeout using an environment variable. Would you be open to accepting a PR with just that, obviously including tests? |
yes, that's ok. Out of curiosity, do you have a simple example to reproduce this case you have where you need goblin but sending the argument doesn't cut it? Seems like you ran into a particular case that might have a proper fix instead of adding a new feature. |
@marcosnils The problem is with using the |
In that case then maybe we can make Globin have it's own flagset through |
Sure, good idea in general, but that still does not make it possible to use Goblin with flags with other frameworks using the |
agree here
I don't agree here. It really depends on the use-case. In any case, I don't want this to become a debate a of when and how to use flags. Adding the support to the env variable SGTM so we can support this use-case |
OK let's not get into philosophical debates. I'll rewrite this PR into something that only covers the envvar, plus tests. |
No description provided.