Skip to content

Commit

Permalink
fix: reviewdog review
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed Dec 29, 2023
1 parent 7d8151d commit c27f63a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/domain/model/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (s S3ObjectSets) Len() int {

// ToS3ObjectIdentifiers converts the S3ObjectSets to the ObjectIdentifiers.
func (s S3ObjectSets) ToS3ObjectIdentifiers() []types.ObjectIdentifier {
var ids []types.ObjectIdentifier
ids := make([]types.ObjectIdentifier, 0, s.Len())
for _, o := range s {
ids = append(ids, *o.ToS3ObjectIdentifier())
}
Expand Down
5 changes: 5 additions & 0 deletions app/domain/model/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package model
import (
"errors"
"path/filepath"
"runtime"
"strings"
"testing"
)
Expand Down Expand Up @@ -599,6 +600,10 @@ func TestBucket_TrimKey(t *testing.T) {
}

func TestBucket_Split(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("Skip this test on Windows")
}

t.Parallel()

tests := []struct {
Expand Down
11 changes: 6 additions & 5 deletions app/external/s3_retryer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package external

import (
"context"
"math/rand"
"crypto/rand"
"math/big"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -39,11 +40,11 @@ func (r *Retryer) MaxAttempts() int {

// RetryDelay returns the delay time.
func (r *Retryer) RetryDelay(int, error) (time.Duration, error) {
rand.NewSource(time.Now().UnixNano())
waitTime := 1
if r.delayTimeSec > 1 {
waitTime += rand.Intn(r.delayTimeSec)
randomInt, err := rand.Int(rand.Reader, big.NewInt(int64(r.delayTimeSec)))
if err != nil {
return 0, err
}
waitTime := 1 + int(randomInt.Int64())
return time.Duration(waitTime) * time.Second, nil
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/subcmd/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func mockStdin(t *testing.T, dummyInput string) (funcDefer func(), err error) {
return func() {
// clean up
os.Stdin = oldOsStdin
os.Remove(tmpFile.Name())
if err := os.Remove(tmpFile.Name()); err != nil {
t.Error(err)
}
}, nil
}

0 comments on commit c27f63a

Please sign in to comment.