Actually, that doesn't work. My apologies. If I figure it out, I will reply.

On Fri, Aug 21, 2020 at 11:27 AM Mike P <mpesce...@opploans.com> wrote:

> I was able to accomplish this via the flag library in my testing function:
>
> flag.Set("test.timeout", "30m0s")
>
> ​
>
> I found that being read from here:
>
> https://github.com/golang/go/blob/d21953df047868ed3bcfd0172a6c1672642f5b4a/src/cmd/go/testdata/script/test_timeout.txt#L22
>
> So then I just changed the Lookup() function to the Set() function. Here's
> my working example when using go test to execute some terragrunt /
> terraform tests:
>
> func TestBasicRun(t *testing.T) {
>         flag.Set("test.timeout", "30m0s")
>         fmt.Println("timeout: " + flag.Lookup("test.timeout").Value.String())
>
>         terraformOptions := &terraform.Options{
>                 TerraformBinary: "terragrunt",
>                 TerraformDir:    "./basic-run",
>                 Lock:            true,
>         }
>
>         defer terraform.Destroy(t, terraformOptions)
>
>         terraform.InitAndApplyAndIdempotent(t, terraformOptions)
> }
>
> ​
>
> I think you can disable it by setting it to something like:
>
> "0m0s"
> ​
> On Monday, January 20, 2020 at 7:03:36 PM UTC-6 Jason E. Aten wrote:
>
>> I have a long running test where I would like to set the testing package
>> timeout to 30 minutes from with the my_test.go code.
>>
>> This would prevent me from forgetting to add the timeout flag, and then
>> discovering 10 minutes later that it was needed.
>>
>> Is this possible? Or just a way to disable the timeouts all together from
>> Go _test.go code.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/so01nDZLnIQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/5a36865f-436b-4fab-8d44-64795e77a5bcn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/5a36865f-436b-4fab-8d44-64795e77a5bcn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
____________________
Mike Pescetto
Senior Site Reliability Engineer
mpesce...@opploans.com

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2B-r-KXuToCbZ2Wh9xDqk%3DP5Kw1XBk4dAwEWOJrOrpdNuNZf1g%40mail.gmail.com.

Reply via email to