Skip to content

Commit

Permalink
protect the fake EC2 API Reset() with a mutex (#1947)
Browse files Browse the repository at this point in the history
prevents an occasional data race
  • Loading branch information
tzneal committed Jun 16, 2022
1 parent 205c4db commit 405ad5c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/cloudprovider/aws/fake/ec2api.go
Expand Up @@ -80,6 +80,8 @@ var DefaultSupportedUsageClasses = aws.StringSlice([]string{"on-demand", "spot"}
// Reset must be called between tests otherwise tests will pollute
// each other.
func (e *EC2API) Reset() {
e.mu.Lock()
defer e.mu.Unlock()
e.DescribeInstancesOutput = nil
e.DescribeLaunchTemplatesOutput = nil
e.DescribeSubnetsOutput = nil
Expand Down

0 comments on commit 405ad5c

Please sign in to comment.