Skip to content

Commit fdb9234

Browse files
authored
Update Compute 'TestInit` test to use 'threadsafe.Buffer' (#1601)
### Change summary This PR eliminates the intermittent behavior of the `TestInit` function failing on the `windows-latest` test, which was caused by a race condition associated with the CLI `yacspin spinner`. Replacing the output capture from `bytes.Buffer` to `threadsafe.Buffer` ensures that race conditions are no longer occur by removing potential unsafe access to the buffer. All Submissions: * [x] Have you followed the guidelines in our Contributing document? * [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/fastly/cli/pulls) for the same update/change?
1 parent 0188b60 commit fdb9234

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

pkg/commands/compute/init_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package compute_test
22

33
import (
4-
"bytes"
54
"context"
65
"errors"
76
"io"
@@ -454,7 +453,7 @@ func TestInit(t *testing.T) {
454453
}
455454
}
456455

457-
var stdout bytes.Buffer
456+
var stdout threadsafe.Buffer
458457
app.Init = func(_ []string, _ io.Reader) (*global.Data, error) {
459458
opts := testutil.MockGlobalData(testcase.args, &stdout)
460459
opts.Config = testcase.configFile

0 commit comments

Comments
 (0)