Skip to content

Commit

Permalink
Merge pull request #1155 from keboola/michaljurecko-jwt-expiration
Browse files Browse the repository at this point in the history
Workaround: set long JWT token expiration
  • Loading branch information
michaljurecko committed Jan 25, 2023
2 parents 3ef7c90 + 3dbce31 commit c0bb661
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestOnChangeListener(t *testing.T) {
t.Parallel()

clk := clock.NewMock()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

var node1 *Node
Expand Down Expand Up @@ -51,20 +51,20 @@ func TestOnChangeListener(t *testing.T) {
_, d2 = createNode(t, clk, nil, etcdNamespace, "node2")
assert.Eventually(t, func() bool {
return strings.Contains(listenerLogs.String(), `found a new node "node2"`)
}, time.Second, 10*time.Millisecond, "timeout")
}, 10*time.Second, 10*time.Millisecond, "timeout")

// Add node 3
_, d3 = createNode(t, clk, nil, etcdNamespace, "node3")
assert.Eventually(t, func() bool {
return strings.Contains(listenerLogs.String(), `found a new node "node3"`)
}, time.Second, 10*time.Millisecond, "timeout")
}, 10*time.Second, 10*time.Millisecond, "timeout")

// Stop node 2
d2.Process().Shutdown(errors.New("test"))
d2.Process().WaitForShutdown()
assert.Eventually(t, func() bool {
return strings.Contains(listenerLogs.String(), `the node "node2" gone`)
}, time.Second, 10*time.Millisecond, "timeout")
}, 10*time.Second, 10*time.Millisecond, "timeout")

// Stop listener
listener.Stop()
Expand Down
10 changes: 4 additions & 6 deletions internal/pkg/service/buffer/worker/service/conditions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,16 @@ func TestConditionsChecker(t *testing.T) {
// Check conditions checker logs
wildcards.Assert(t, `
%A
[service][conditions]INFO checked "1" opened slices | %s
[service][conditions]INFO checked "1" opened slices | %s
[service][conditions]INFO checked "1" opened slices | %s
[service][conditions]INFO closing slice "00000123/my-receiver-B/my-export-2/0001-01-01T00:00:02.000Z/0001-01-01T00:00:02.000Z": time threshold met, opened at: 0001-01-01T00:00:02.000Z, passed: 1m30s threshold: 1m0s
%A
`, strhelper.FilterLines(`^(\[service\]\[conditions\])`, workerDeps1.DebugLogger().AllMessages()))
wildcards.Assert(t, `
%A
[service][conditions]INFO checked "1" opened slices | %s
[service][conditions]INFO checked "1" opened slices | %s
[service][conditions]INFO closing slice "00000123/my-receiver-A/my-export-1/0001-01-01T00:00:02.000Z/0001-01-01T00:00:02.000Z": time threshold met, opened at: 0001-01-01T00:00:02.000Z, passed: 1m0s threshold: 1m0s
[service][conditions]INFO checked "1" opened slices | %s
%A
`, strhelper.FilterLines(`^(\[service\]\[conditions\])`, workerDeps2.DebugLogger().AllMessages()))
wildcards.Assert(t, `
%A
[service][conditions]INFO closing file "00000123/my-receiver-A/my-export-1/0001-01-01T00:00:02.000Z": size threshold met, received: 250KB, threshold: 200KB
%A
`, strhelper.FilterLines(`^(\[service\]\[conditions\])`, workerDeps2.DebugLogger().AllMessages()))
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/service/buffer/worker/task/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ task/00000123/my-receiver/my-export-1/%s
func TestFailedTask(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

exportKey := exportKeyForTest()
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/service/common/etcdclient/etcdclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func New(ctx context.Context, proc *servicectx.Process, tracer trace.Tracer, end
Username: conf.username, // optional
Password: conf.password, // optional
Logger: etcdLogger,
PermitWithoutStream: true, // always send keep-alive pings
DialOptions: []grpc.DialOption{
grpc.WithBlock(), // wait for the connection
grpc.WithReturnConnectionError(),
Expand Down
2 changes: 1 addition & 1 deletion provisioning/common/etcd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ auth:
allowNoneAuthentication: false
token:
type: jwt
ttl: 10m
ttl: 10080m # temporary: https://github.com/etcd-io/etcd/pull/14995

# Only internal communication is allowed: no public IP
service:
Expand Down

0 comments on commit c0bb661

Please sign in to comment.