File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
internal/pkg/term/progress Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package progress
6
6
import (
7
7
"fmt"
8
8
"io"
9
+ "os"
9
10
"time"
10
11
11
12
"github.com/briandowns/spinner"
@@ -37,7 +38,11 @@ type Spinner struct {
37
38
38
39
// NewSpinner returns a spinner that outputs to w.
39
40
func NewSpinner (w io.Writer ) * Spinner {
40
- s := spinner .New (charset , 125 * time .Millisecond , spinner .WithHiddenCursor (true ))
41
+ interval := 125 * time .Millisecond
42
+ if os .Getenv ("CI" ) == "true" {
43
+ interval = 30 * time .Second
44
+ }
45
+ s := spinner .New (charset , interval , spinner .WithHiddenCursor (true ))
41
46
s .Writer = w
42
47
return & Spinner {
43
48
spin : s ,
Original file line number Diff line number Diff line change 4
4
package progress
5
5
6
6
import (
7
+ "os"
7
8
"strings"
8
9
"testing"
9
10
"time"
@@ -18,12 +19,16 @@ func TestNew(t *testing.T) {
18
19
t .Run ("it should initialize the spin spinner" , func (t * testing.T ) {
19
20
buf := new (strings.Builder )
20
21
got := NewSpinner (buf )
22
+ wantedInterval := 125 * time .Millisecond
23
+ if os .Getenv ("CI" ) == "true" {
24
+ wantedInterval = 30 * time .Second
25
+ }
21
26
22
27
v , ok := got .spin .(* spin.Spinner )
23
28
require .True (t , ok )
24
29
25
30
require .Equal (t , buf , v .Writer )
26
- require .Equal (t , 125 * time . Millisecond , v .Delay )
31
+ require .Equal (t , wantedInterval , v .Delay )
27
32
})
28
33
}
29
34
You can’t perform that action at this time.
0 commit comments