import: move bib files to correct path
Moves the files imported from `bootc-image-builder` directly under `pkg` so they can be imported in reverse. Also fix up any import paths at the same time. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
parent
7ac659490c
commit
f4bbd3e048
5 changed files with 2 additions and 2 deletions
44
pkg/progress/syncwriter_test.go
Normal file
44
pkg/progress/syncwriter_test.go
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package progress_test
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/osbuild/image-builder-cli/pkg/progress"
|
||||
)
|
||||
|
||||
func TestSyncWriter(t *testing.T) {
|
||||
var mu sync.Mutex
|
||||
var buf bytes.Buffer
|
||||
var wg sync.WaitGroup
|
||||
|
||||
for id := 0; id < 100; id++ {
|
||||
wg.Add(1)
|
||||
w := progress.NewSyncedWriter(&mu, &buf)
|
||||
go func(id int) {
|
||||
defer wg.Done()
|
||||
for i := 0; i < 500; i++ {
|
||||
fmt.Fprintln(w, strings.Repeat(fmt.Sprintf("%v", id%10), 60))
|
||||
time.Sleep(10 * time.Nanosecond)
|
||||
}
|
||||
}(id)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
scanner := bufio.NewScanner(&buf)
|
||||
for {
|
||||
if !scanner.Scan() {
|
||||
break
|
||||
}
|
||||
line := scanner.Text()
|
||||
assert.True(t, len(line) == 60, fmt.Sprintf("len %v: line: %v", len(line), line))
|
||||
}
|
||||
assert.NoError(t, scanner.Err())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue