|
|
|
@ -388,19 +388,26 @@ func TestTmpChartsDirConcurrent(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
const concurrency = 32
|
|
|
|
const concurrency = 32
|
|
|
|
paths := make([]string, concurrency)
|
|
|
|
paths := make([]string, concurrency)
|
|
|
|
|
|
|
|
errs := make([]error, concurrency)
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
for i := 0; i < concurrency; i++ {
|
|
|
|
for i := 0; i < concurrency; i++ {
|
|
|
|
wg.Add(1)
|
|
|
|
wg.Add(1)
|
|
|
|
go func(i int) {
|
|
|
|
go func(i int) {
|
|
|
|
defer wg.Done()
|
|
|
|
defer wg.Done()
|
|
|
|
path, err := tmpChartsDir(chartPath)
|
|
|
|
path, err := tmpChartsDir(chartPath)
|
|
|
|
require.NoError(t, err)
|
|
|
|
if err == nil {
|
|
|
|
paths[i] = path
|
|
|
|
paths[i] = path
|
|
|
|
require.NoError(t, os.RemoveAll(path))
|
|
|
|
err = os.RemoveAll(path)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
errs[i] = err
|
|
|
|
}(i)
|
|
|
|
}(i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wg.Wait()
|
|
|
|
wg.Wait()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i, err := range errs {
|
|
|
|
|
|
|
|
require.NoError(t, err, "tmpChartsDir goroutine %d failed", i)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
seen := make(map[string]struct{}, concurrency)
|
|
|
|
seen := make(map[string]struct{}, concurrency)
|
|
|
|
for _, path := range paths {
|
|
|
|
for _, path := range paths {
|
|
|
|
require.NotEmpty(t, path)
|
|
|
|
require.NotEmpty(t, path)
|
|
|
|
@ -408,7 +415,6 @@ func TestTmpChartsDirConcurrent(t *testing.T) {
|
|
|
|
require.False(t, dup, "duplicate tmp dir: %s", path)
|
|
|
|
require.False(t, dup, "duplicate tmp dir: %s", path)
|
|
|
|
seen[path] = struct{}{}
|
|
|
|
seen[path] = struct{}{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestLockForChartPathEquivalentPaths(t *testing.T) {
|
|
|
|
func TestLockForChartPathEquivalentPaths(t *testing.T) {
|
|
|
|
chartPath := t.TempDir()
|
|
|
|
chartPath := t.TempDir()
|
|
|
|
|