chore: upgrade dependencies (#2589)
* chore: upgrade dependencies * fix: linter errors * chore: bump version of golangci-lint * chore: go mod tidy * fix: failing test * fix: update version of upload-artifact to v4 * chore: format test output with gotestfmt * fix: typo in test exec * fix: failing tests * fix: windows unit test execution * fix: windows unit test execution * fix: whitespace
This commit is contained in:
@@ -18,7 +18,7 @@ func TestCreateAuthorizationToken(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
assert.NotEqual(t, "", token)
|
||||
claims := jwt.MapClaims{}
|
||||
_, err = jwt.ParseWithClaims(token, claims, func(t *jwt.Token) (interface{}, error) {
|
||||
_, err = jwt.ParseWithClaims(token, claims, func(_ *jwt.Token) (interface{}, error) {
|
||||
return []byte{}, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -52,7 +52,7 @@ func NewDebugExecutor(format string, args ...interface{}) Executor {
|
||||
// NewPipelineExecutor creates a new executor from a series of other executors
|
||||
func NewPipelineExecutor(executors ...Executor) Executor {
|
||||
if len(executors) == 0 {
|
||||
return func(ctx context.Context) error {
|
||||
return func(_ context.Context) error {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func NewConditionalExecutor(conditional Conditional, trueExecutor Executor, fals
|
||||
|
||||
// NewErrorExecutor creates a new executor that always errors out
|
||||
func NewErrorExecutor(err error) Executor {
|
||||
return func(ctx context.Context) error {
|
||||
return func(_ context.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ func (e Executor) IfNot(conditional Conditional) Executor {
|
||||
|
||||
// IfBool only runs this executor if conditional is true
|
||||
func (e Executor) IfBool(conditional bool) Executor {
|
||||
return e.If(func(ctx context.Context) bool {
|
||||
return e.If(func(_ context.Context) bool {
|
||||
return conditional
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ func TestNewWorkflow(t *testing.T) {
|
||||
// multiple success case
|
||||
runcount := 0
|
||||
successWorkflow := NewPipelineExecutor(
|
||||
func(ctx context.Context) error {
|
||||
func(_ context.Context) error {
|
||||
runcount++
|
||||
return nil
|
||||
},
|
||||
func(ctx context.Context) error {
|
||||
func(_ context.Context) error {
|
||||
runcount++
|
||||
return nil
|
||||
})
|
||||
@@ -45,12 +45,12 @@ func TestNewConditionalExecutor(t *testing.T) {
|
||||
trueCount := 0
|
||||
falseCount := 0
|
||||
|
||||
err := NewConditionalExecutor(func(ctx context.Context) bool {
|
||||
err := NewConditionalExecutor(func(_ context.Context) bool {
|
||||
return false
|
||||
}, func(ctx context.Context) error {
|
||||
}, func(_ context.Context) error {
|
||||
trueCount++
|
||||
return nil
|
||||
}, func(ctx context.Context) error {
|
||||
}, func(_ context.Context) error {
|
||||
falseCount++
|
||||
return nil
|
||||
})(ctx)
|
||||
@@ -59,12 +59,12 @@ func TestNewConditionalExecutor(t *testing.T) {
|
||||
assert.Equal(0, trueCount)
|
||||
assert.Equal(1, falseCount)
|
||||
|
||||
err = NewConditionalExecutor(func(ctx context.Context) bool {
|
||||
err = NewConditionalExecutor(func(_ context.Context) bool {
|
||||
return true
|
||||
}, func(ctx context.Context) error {
|
||||
}, func(_ context.Context) error {
|
||||
trueCount++
|
||||
return nil
|
||||
}, func(ctx context.Context) error {
|
||||
}, func(_ context.Context) error {
|
||||
falseCount++
|
||||
return nil
|
||||
})(ctx)
|
||||
@@ -82,7 +82,7 @@ func TestNewParallelExecutor(t *testing.T) {
|
||||
count := 0
|
||||
activeCount := 0
|
||||
maxCount := 0
|
||||
emptyWorkflow := NewPipelineExecutor(func(ctx context.Context) error {
|
||||
emptyWorkflow := NewPipelineExecutor(func(_ context.Context) error {
|
||||
count++
|
||||
|
||||
activeCount++
|
||||
@@ -120,7 +120,7 @@ func TestNewParallelExecutorFailed(t *testing.T) {
|
||||
cancel()
|
||||
|
||||
count := 0
|
||||
errorWorkflow := NewPipelineExecutor(func(ctx context.Context) error {
|
||||
errorWorkflow := NewPipelineExecutor(func(_ context.Context) error {
|
||||
count++
|
||||
return fmt.Errorf("fake error")
|
||||
})
|
||||
@@ -138,11 +138,11 @@ func TestNewParallelExecutorCanceled(t *testing.T) {
|
||||
errExpected := fmt.Errorf("fake error")
|
||||
|
||||
count := 0
|
||||
successWorkflow := NewPipelineExecutor(func(ctx context.Context) error {
|
||||
successWorkflow := NewPipelineExecutor(func(_ context.Context) error {
|
||||
count++
|
||||
return nil
|
||||
})
|
||||
errorWorkflow := NewPipelineExecutor(func(ctx context.Context) error {
|
||||
errorWorkflow := NewPipelineExecutor(func(_ context.Context) error {
|
||||
count++
|
||||
return errExpected
|
||||
})
|
||||
|
||||
@@ -108,8 +108,8 @@ func TestGitFindRef(t *testing.T) {
|
||||
Assert func(t *testing.T, ref string, err error)
|
||||
}{
|
||||
"new_repo": {
|
||||
Prepare: func(t *testing.T, dir string) {},
|
||||
Assert: func(t *testing.T, ref string, err error) {
|
||||
Prepare: func(_ *testing.T, _ string) {},
|
||||
Assert: func(t *testing.T, _ string, err error) {
|
||||
require.Error(t, err)
|
||||
},
|
||||
},
|
||||
@@ -165,8 +165,6 @@ func TestGitFindRef(t *testing.T) {
|
||||
},
|
||||
},
|
||||
} {
|
||||
tt := tt
|
||||
name := name
|
||||
t.Run(name, func(t *testing.T) {
|
||||
dir := filepath.Join(basedir, name)
|
||||
require.NoError(t, os.MkdirAll(dir, 0o755))
|
||||
|
||||
Reference in New Issue
Block a user