Skip to content

Commit 6ec9f0e

Browse files
authored
Merge branch 'main' into fix-api-token-init
2 parents 2f415dc + f4ba09f commit 6ec9f0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+701
-409
lines changed

.github/workflows/test-dapr-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Test
1818
runs-on: ubuntu-latest
1919
env:
20-
GOLANGCILINT_VER: v1.61.0
20+
GOLANGCILINT_VER: v1.64.6
2121

2222
steps:
2323
- name: Checkout

.github/workflows/test-on-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Test
1212
runs-on: ubuntu-latest
1313
env:
14-
GOLANGCILINT_VER: v1.61.0
14+
GOLANGCILINT_VER: v1.64.6
1515

1616
steps:
1717
- name: Checkout

.github/workflows/test-tooling.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- "macos-latest"
2626
runs-on: ${{ matrix.os }}
2727
env:
28-
GOLANGCILINT_VER: v1.61.0 # Make sure to bump /tools/check-lint-version/main_test.go
28+
GOLANGCILINT_VER: v1.64.6 # Make sure to bump /tools/check-lint-version/main_test.go
2929

3030
steps:
3131
- name: Checkout

.github/workflows/validate_examples.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
"configuration",
167167
"conversation",
168168
"crypto",
169-
"dist-scheduler",
169+
"jobs",
170170
"grpc-service",
171171
"hello-world",
172172
"pubsub",

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ linters:
234234
- lll
235235
- unparam
236236
- wsl
237-
- gomnd
238237
- testpackage
239238
- nestif
240239
- nlreturn
@@ -271,8 +270,6 @@ linters:
271270
- tagalign
272271
- mnd
273272
- canonicalheader
274-
- exportloopref
275-
- execinquery
276273
- err113
277274
- fatcontext
278275
- forbidigo # TODO: Re-enable and remove fmt.println

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ cover: ## Displays test coverage in the client and service packages
3333
lint: check-lint ## Lints the entire project
3434
golangci-lint run --timeout=3m
3535

36+
.PHONY: lint-fix
37+
lint-fix: check-lint ## Lints the entire project
38+
golangci-lint run --timeout=3m --fix
39+
3640
.PHONY: check-lint
3741
check-lint: ## Compares the locally installed linter with the workflow version
3842
cd ./tools/check-lint-version && \

actor/runtime/actor_runtime_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func TestRegisterActorFactoryAndInvokeMethod(t *testing.T) {
4848
mockServer.EXPECT().RegisterActorImplFactory(gomock.Any())
4949
rt.RegisterActorFactory(actorMock.ActorImplFactory)
5050

51+
//nolint:usetesting
5152
mockServer.EXPECT().InvokeMethod(context.Background(), "mockActorID", "Invoke", []byte("param")).Return([]byte("response"), actorErr.Success)
5253
rspData, err := rt.InvokeActorMethod("testActorType", "mockActorID", "Invoke", []byte("param"))
5354

@@ -89,6 +90,7 @@ func TestInvokeReminder(t *testing.T) {
8990
mockServer.EXPECT().RegisterActorImplFactory(gomock.Any())
9091
rt.RegisterActorFactory(actorMock.ActorImplFactory)
9192

93+
//nolint:usetesting
9294
mockServer.EXPECT().InvokeReminder(context.Background(), "mockActorID", "mockReminder", []byte("param")).Return(actorErr.Success)
9395
err = rt.InvokeReminder("testActorType", "mockActorID", "mockReminder", []byte("param"))
9496

@@ -109,6 +111,7 @@ func TestInvokeTimer(t *testing.T) {
109111
mockServer.EXPECT().RegisterActorImplFactory(gomock.Any())
110112
rt.RegisterActorFactory(actorMock.ActorImplFactory)
111113

114+
//nolint:usetesting
112115
mockServer.EXPECT().InvokeTimer(context.Background(), "mockActorID", "mockTimer", []byte("param")).Return(actorErr.Success)
113116
err = rt.InvokeTimer("testActorType", "mockActorID", "mockTimer", []byte("param"))
114117

client/actor_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ limitations under the License.
1414
package client
1515

1616
import (
17-
"context"
1817
"testing"
1918

2019
"github.com/stretchr/testify/require"
@@ -25,7 +24,7 @@ import (
2524
const testActorType = "test"
2625

2726
func TestInvokeActor(t *testing.T) {
28-
ctx := context.Background()
27+
ctx := t.Context()
2928
in := &InvokeActorRequest{
3029
ActorID: "fn",
3130
Method: "mockMethod",
@@ -74,7 +73,7 @@ func TestInvokeActor(t *testing.T) {
7473
}
7574

7675
func TestRegisterActorReminder(t *testing.T) {
77-
ctx := context.Background()
76+
ctx := t.Context()
7877
in := &RegisterActorReminderRequest{
7978
ActorID: "fn",
8079
Data: []byte(`{hello}`),
@@ -137,7 +136,7 @@ func TestRegisterActorReminder(t *testing.T) {
137136
}
138137

139138
func TestRegisterActorTimer(t *testing.T) {
140-
ctx := context.Background()
139+
ctx := t.Context()
141140
in := &RegisterActorTimerRequest{
142141
ActorID: "fn",
143142
Data: []byte(`{hello}`),
@@ -215,7 +214,7 @@ func TestRegisterActorTimer(t *testing.T) {
215214
}
216215

217216
func TestUnregisterActorReminder(t *testing.T) {
218-
ctx := context.Background()
217+
ctx := t.Context()
219218
in := &UnregisterActorReminderRequest{
220219
ActorID: "fn",
221220
ActorType: testActorType,
@@ -260,7 +259,7 @@ func TestUnregisterActorReminder(t *testing.T) {
260259
}
261260

262261
func TestUnregisterActorTimer(t *testing.T) {
263-
ctx := context.Background()
262+
ctx := t.Context()
264263
in := &UnregisterActorTimerRequest{
265264
ActorID: "fn",
266265
ActorType: testActorType,

client/binding_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ limitations under the License.
1414
package client
1515

1616
import (
17-
"context"
1817
"testing"
1918

2019
"github.com/stretchr/testify/require"
@@ -25,7 +24,7 @@ import (
2524
// go test -timeout 30s ./client -count 1 -run ^TestInvokeBinding$
2625

2726
func TestInvokeBinding(t *testing.T) {
28-
ctx := context.Background()
27+
ctx := t.Context()
2928
in := &InvokeBindingRequest{
3029
Name: "test",
3130
Operation: "fn",

client/client_test.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"google.golang.org/grpc/credentials/insecure"
3333
"google.golang.org/grpc/test/bufconn"
3434
"google.golang.org/protobuf/types/known/anypb"
35+
"google.golang.org/protobuf/types/known/durationpb"
3536
"google.golang.org/protobuf/types/known/emptypb"
3637

3738
commonv1pb "github.com/dapr/dapr/pkg/proto/common/v1"
@@ -98,7 +99,7 @@ func TestNewClient(t *testing.T) {
9899
})
99100

100101
t.Run("new client with trace ID", func(t *testing.T) {
101-
_ = testClient.WithTraceID(context.Background(), "test")
102+
_ = testClient.WithTraceID(t.Context(), "test")
102103
})
103104

104105
t.Run("new socket client closed with token", func(t *testing.T) {
@@ -120,13 +121,13 @@ func TestNewClient(t *testing.T) {
120121
c, err := NewClientWithSocket(testSocket)
121122
require.NoError(t, err)
122123
defer c.Close()
123-
ctx := c.WithTraceID(context.Background(), "")
124+
ctx := c.WithTraceID(t.Context(), "")
124125
_ = c.WithTraceID(ctx, "test")
125126
})
126127
}
127128

128129
func TestShutdown(t *testing.T) {
129-
ctx := context.Background()
130+
ctx := t.Context()
130131

131132
t.Run("shutdown", func(t *testing.T) {
132133
err := testClient.Shutdown(ctx)
@@ -563,10 +564,11 @@ func (s *testDaprServer) ScheduleJobAlpha1(ctx context.Context, in *pb.ScheduleJ
563564

564565
func (s *testDaprServer) GetJobAlpha1(ctx context.Context, in *pb.GetJobRequest) (*pb.GetJobResponse, error) {
565566
var (
566-
schedule = "@every 10s"
567-
dueTime = "10s"
568-
repeats uint32 = 4
569-
ttl = "10s"
567+
schedule = "@every 10s"
568+
dueTime = "10s"
569+
repeats uint32 = 4
570+
ttl = "10s"
571+
maxRetries uint32 = 4
570572
)
571573
return &pb.GetJobResponse{
572574
Job: &pb.Job{
@@ -576,6 +578,14 @@ func (s *testDaprServer) GetJobAlpha1(ctx context.Context, in *pb.GetJobRequest)
576578
DueTime: &dueTime,
577579
Ttl: &ttl,
578580
Data: nil,
581+
FailurePolicy: &commonv1pb.JobFailurePolicy{
582+
Policy: &commonv1pb.JobFailurePolicy_Constant{
583+
Constant: &commonv1pb.JobFailurePolicyConstant{
584+
MaxRetries: &maxRetries,
585+
Interval: &durationpb.Duration{Seconds: 10},
586+
},
587+
},
588+
},
579589
},
580590
}, nil
581591
}

0 commit comments

Comments
 (0)