From eda8ab2dfdaf4209ea445a47a9a11a3d9a3610ae Mon Sep 17 00:00:00 2001 From: Adam Fisk Date: Fri, 25 Oct 2024 12:23:09 -0600 Subject: [PATCH] set waittime on tests --- context.go | 5 ++--- fronted_test.go | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/context.go b/context.go index 46559c0..86432a1 100644 --- a/context.go +++ b/context.go @@ -73,13 +73,12 @@ func (fctx *FrontingContext) ConfigureWithHello(pool *x509.CertPool, providers m existing.closeCache() } - f, err := newFronted(pool, providers, defaultProviderID, cacheFile, clientHelloID, func(f *fronted) { - + _, err := newFronted(pool, providers, defaultProviderID, cacheFile, clientHelloID, func(f *fronted) { + fctx.instance.Set(f) }) if err != nil { return err } - fctx.instance.Set(f) return nil } diff --git a/fronted_test.go b/fronted_test.go index 7d200f0..ab88d3f 100644 --- a/fronted_test.go +++ b/fronted_test.go @@ -57,7 +57,7 @@ func TestDirectDomainFrontingWithSNIConfig(t *testing.T) { }) Configure(certs, p, testProviderID, cacheFile) - transport, ok := NewFronted(0) + transport, ok := NewFronted(30 * time.Second) require.True(t, ok) client := &http.Client{ Transport: transport, @@ -94,7 +94,7 @@ func doTestDomainFronting(t *testing.T, cacheFile string, expectedMasqueradesAtE } require.True(t, doCheck(client, http.MethodPost, http.StatusAccepted, pingURL)) - transport, ok = NewFronted(0) + transport, ok = NewFronted(30 * time.Second) require.True(t, ok) client = &http.Client{ Transport: transport, @@ -238,7 +238,7 @@ func TestHostAliasesBasic(t *testing.T) { certs.AddCert(cloudSack.Certificate()) Configure(certs, map[string]*Provider{"cloudsack": p}, "cloudsack", "") - rt, ok := NewFronted(10 * time.Second) + rt, ok := NewFronted(30 * time.Second) if !assert.True(t, ok, "failed to obtain direct roundtripper") { return } @@ -349,7 +349,7 @@ func TestHostAliasesMulti(t *testing.T) { } Configure(certs, providers, "cloudsack", "") - rt, ok := NewFronted(10 * time.Second) + rt, ok := NewFronted(30 * time.Second) if !assert.True(t, ok, "failed to obtain direct roundtripper") { return } @@ -475,7 +475,7 @@ func TestPassthrough(t *testing.T) { certs.AddCert(cloudSack.Certificate()) Configure(certs, map[string]*Provider{"cloudsack": p}, "cloudsack", "") - rt, ok := NewFronted(10 * time.Second) + rt, ok := NewFronted(30 * time.Second) if !assert.True(t, ok, "failed to obtain direct roundtripper") { return } @@ -615,7 +615,7 @@ func TestCustomValidators(t *testing.T) { for _, test := range tests { setup(test.validator) - direct, ok := NewFronted(1 * time.Second) + direct, ok := NewFronted(30 * time.Second) if !assert.True(t, ok) { return }