Skip to content

Commit b680c80

Browse files
authored
fix: increase render interval to 30s if CI env var is true (#2440)
Fixes #2251 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent d004b2c commit b680c80

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

.release/buildspec_e2e.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,6 @@ phases:
155155
docker run --privileged -v /tmp/.aws:/home/.aws -e "HOME=/home"
156156
-e "TEST_SUITE=$TEST_SUITE"
157157
-e "DOCKERHUB_USERNAME=$DOCKERHUB_USERNAME"
158-
-e "DOCKERHUB_TOKEN=$DOCKERHUB_TOKEN"
158+
-e "DOCKERHUB_TOKEN=$DOCKERHUB_TOKEN"
159+
-e "CI=true"
159160
copilot-cli/e2e:latest

internal/pkg/term/progress/render_interval.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55

66
package progress
77

8-
import "time"
8+
import (
9+
"os"
10+
"time"
11+
)
912

10-
const (
13+
var (
1114
renderInterval = 100 * time.Millisecond // How frequently Render should be invoked.
1215
)
16+
17+
func init() {
18+
// The CI environment variable is set to "true" by default by GitHub actions and GitLab.
19+
if os.Getenv("CI") == "true" {
20+
renderInterval = 30 * time.Second
21+
}
22+
}

internal/pkg/term/progress/render_interval_windows.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33

44
package progress
55

6-
import "time"
6+
import (
7+
"os"
8+
"time"
9+
)
710

8-
const (
11+
var (
912
// Windows flickers too frequently if the interval is too short.
1013
renderInterval = 500 * time.Millisecond // How frequently Render should be invoked.
1114
)
15+
16+
func init() {
17+
if os.Getenv("CI") == "true" {
18+
renderInterval = 30 * time.Second
19+
}
20+
}

internal/pkg/term/progress/render_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ func (m *mockFileWriter) Fd() uintptr {
6262
}
6363

6464
func TestRender(t *testing.T) {
65+
renderInterval = 100 * time.Millisecond // Ensure that even when CI=true we are testing with default interval.
66+
6567
t.Run("stops the renderer when context is canceled", func(t *testing.T) {
6668
t.Parallel()
6769
// GIVEN

0 commit comments

Comments
 (0)