mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-05 04:13:11 +02:00
core/envoy: clean up temporary directory on start (#4914)
This commit is contained in:
parent
4301da3648
commit
2a9e76eb7c
2 changed files with 64 additions and 3 deletions
31
pkg/envoy/extract_test.go
Normal file
31
pkg/envoy/extract_test.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package envoy
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestClean(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tmpDir := t.TempDir()
|
||||
d1, err := os.MkdirTemp(tmpDir, envoyPrefix)
|
||||
require.NoError(t, err)
|
||||
d2, err := os.MkdirTemp(tmpDir, envoyPrefix)
|
||||
require.NoError(t, err)
|
||||
d3, err := os.MkdirTemp(tmpDir, envoyPrefix)
|
||||
require.NoError(t, err)
|
||||
|
||||
cleanTempDir(tmpDir)
|
||||
|
||||
_, err = os.Stat(d1)
|
||||
assert.ErrorIs(t, err, fs.ErrNotExist)
|
||||
_, err = os.Stat(d2)
|
||||
assert.ErrorIs(t, err, fs.ErrNotExist)
|
||||
_, err = os.Stat(d3)
|
||||
assert.ErrorIs(t, err, fs.ErrNotExist)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue