mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +02:00
core/autocert: fix flaky test (#4899)
* core/autocert: fix flaky test * add comment
This commit is contained in:
parent
915c230d8d
commit
b3cb21e13c
1 changed files with 7 additions and 4 deletions
|
@ -18,6 +18,7 @@ import (
|
|||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -26,6 +27,7 @@ import (
|
|||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/google/uuid"
|
||||
"github.com/mholt/acmez/acme"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -215,12 +217,13 @@ func TestConfig(t *testing.T) {
|
|||
|
||||
mockACME = newMockACME(ca, srv)
|
||||
|
||||
tmpdir := t.TempDir()
|
||||
// avoid using t.TempDir so tests don't fail: https://github.com/pomerium/pomerium/issues/4757
|
||||
tmpdir := filepath.Join(os.TempDir(), uuid.New().String())
|
||||
_ = os.MkdirAll(tmpdir, 0o755)
|
||||
defer os.RemoveAll(tmpdir)
|
||||
|
||||
li, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
addr := li.Addr().String()
|
||||
_ = li.Close()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue