Skip to content

Commit e4bd92b

Browse files
authored
Merge branch 'main' into main
2 parents 3b1cba0 + 397766a commit e4bd92b

File tree

15 files changed

+287
-48
lines changed

15 files changed

+287
-48
lines changed

.github/infrastructure/docker-compose-solace.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ services:
99
shm_size: 1g
1010
ulimits:
1111
core: -1
12+
# Setting nofile to 4096 and hard to 1048576, as recommended by Solace documentation
13+
# Otherwise, the container will have an error and crash with:
14+
# ERROR POST Violation [022]:Required system resource missing, Hard resource limit nofile 1048576 is required, 6592 detected
15+
# https://docs.solace.com/Software-Broker/System-Resource-Requirements.htm#concurrent-open-files-considerations
1216
nofile:
13-
soft: 2448
14-
hard: 6592
17+
soft: 4096
18+
hard: 1048576
1519
deploy:
1620
restart_policy:
1721
condition: on-failure
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
FILE="$1"
6+
PROJECT="${2:-$FILE}"
7+
8+
docker compose -f .github/infrastructure/docker-compose-${FILE}.yml -p ${PROJECT} logs

.github/scripts/test-info.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ const components = {
440440
'pubsub.solace': {
441441
conformance: true,
442442
conformanceSetup: 'docker-compose.sh solace',
443+
conformanceLogs: 'docker-compose-logs.sh solace',
443444
},
444445
'secretstores.azure.keyvault': {
445446
certification: true,
@@ -824,6 +825,7 @@ const components = {
824825
* @property {boolean?} requireTerraform If true, requires Terraform
825826
* @property {boolean?} requireKind If true, requires KinD
826827
* @property {string?} conformanceSetup Setup script for conformance tests
828+
* @property {string?} conformanceLogs Logs script for conformance tests
827829
* @property {string?} conformanceDestroy Destroy script for conformance tests
828830
* @property {string?} certificationSetup Setup script for certification tests
829831
* @property {string?} certificationDestroy Destroy script for certification tests
@@ -845,6 +847,7 @@ const components = {
845847
* @property {boolean?} require-kind Requires KinD
846848
* @property {string?} setup-script Setup script
847849
* @property {string?} destroy-script Destroy script
850+
* @property {string?} logs-script Logs script in case of failure
848851
* @property {string?} nodejs-version Install the specified Node.js version if set
849852
* @property {string?} mongodb-version Install the specified MongoDB version if set
850853
* @property {string?} source-pkg Source package
@@ -915,6 +918,7 @@ function GenerateMatrix(testKind, enableCloudTests) {
915918
'require-kind': comp.requireKind ? 'true' : undefined,
916919
'setup-script': comp[testKind + 'Setup'] || undefined,
917920
'destroy-script': comp[testKind + 'Destroy'] || undefined,
921+
'logs-script': comp[testKind + 'Logs'] || undefined,
918922
'nodejs-version': comp.nodeJsVersion || undefined,
919923
'mongodb-version': comp.mongoDbVersion || undefined,
920924
'source-pkg': comp.sourcePkg

.github/workflows/conformance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ jobs:
317317
exit 1
318318
fi
319319
320+
- name: Retrieve infrastructure failure logs
321+
if: failure() && matrix.logs-script != ''
322+
run: .github/scripts/components-scripts/${{ matrix.logs-script }}
323+
320324
- name: Prepare test result info
321325
if: always()
322326
run: |

bindings/http/http.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444

4545
TraceparentHeaderKey = "traceparent"
4646
TracestateHeaderKey = "tracestate"
47+
BaggageHeaderKey = "baggage"
4748
TraceMetadataKey = "traceHeaders"
4849
securityToken = "securityToken"
4950
securityTokenHeader = "securityTokenHeader"
@@ -318,6 +319,13 @@ func (h *HTTPSource) Invoke(parentCtx context.Context, req *bindings.InvokeReque
318319

319320
request.Header.Set(TracestateHeaderKey, ts)
320321
}
322+
if baggage, ok := req.Metadata[BaggageHeaderKey]; ok && baggage != "" {
323+
if _, ok := request.Header[http.CanonicalHeaderKey(BaggageHeaderKey)]; ok {
324+
h.logger.Warn("Tracing is enabled. A custom Baggage request header cannot be specified and is ignored.")
325+
}
326+
327+
request.Header.Set(BaggageHeaderKey, baggage)
328+
}
321329

322330
// Send the question
323331
resp, err := h.client.Do(request)

bindings/http/http_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ func TestTraceHeadersForwarded(t *testing.T) {
473473
req := TestCase{
474474
input: "GET",
475475
operation: "get",
476-
metadata: map[string]string{"path": "/", "traceparent": "12345", "tracestate": "67890"},
476+
metadata: map[string]string{"path": "/", "traceparent": "12345", "tracestate": "67890", "baggage": "key1=value1"},
477477
path: "/",
478478
err: "",
479479
statusCode: 200,
@@ -482,13 +482,14 @@ func TestTraceHeadersForwarded(t *testing.T) {
482482
require.NoError(t, err)
483483
assert.Equal(t, "12345", handler.Headers["Traceparent"])
484484
assert.Equal(t, "67890", handler.Headers["Tracestate"])
485+
assert.Equal(t, "key1=value1", handler.Headers["Baggage"])
485486
})
486487

487488
t.Run("trace headers should not be forwarded if empty", func(t *testing.T) {
488489
req := TestCase{
489490
input: "GET",
490491
operation: "get",
491-
metadata: map[string]string{"path": "/", "traceparent": "", "tracestate": ""},
492+
metadata: map[string]string{"path": "/", "traceparent": "", "tracestate": "", "baggage": ""},
492493
path: "/",
493494
err: "",
494495
statusCode: 200,
@@ -499,13 +500,15 @@ func TestTraceHeadersForwarded(t *testing.T) {
499500
assert.False(t, traceParentExists)
500501
_, traceStateExists := handler.Headers["Tracestate"]
501502
assert.False(t, traceStateExists)
503+
_, baggageExists := handler.Headers["Baggage"]
504+
assert.False(t, baggageExists)
502505
})
503506

504507
t.Run("trace headers override headers in request metadata", func(t *testing.T) {
505508
req := TestCase{
506509
input: "GET",
507510
operation: "get",
508-
metadata: map[string]string{"path": "/", "Traceparent": "abcde", "Tracestate": "fghijk", "traceparent": "12345", "tracestate": "67890"},
511+
metadata: map[string]string{"path": "/", "Traceparent": "abcde", "Tracestate": "fghijk", "Baggage": "oldvalue", "traceparent": "12345", "tracestate": "67890", "baggage": "key1=value1"},
509512
path: "/",
510513
err: "",
511514
statusCode: 200,
@@ -514,6 +517,7 @@ func TestTraceHeadersForwarded(t *testing.T) {
514517
require.NoError(t, err)
515518
assert.Equal(t, "12345", handler.Headers["Traceparent"])
516519
assert.Equal(t, "67890", handler.Headers["Tracestate"])
520+
assert.Equal(t, "key1=value1", handler.Headers["Baggage"])
517521
})
518522
}
519523

common/authentication/sqlserver/metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (m *SQLServerAuthMetadata) GetConnector(setDatabase bool) (*mssql.Connector
9696
conn, err := mssql.NewSecurityTokenConnector(config, func(ctx context.Context) (string, error) {
9797
at, err := tokenCred.GetToken(ctx, policy.TokenRequestOptions{
9898
Scopes: []string{
99-
m.azureEnv.Cloud.Services[azure.ServiceAzureSQL].Audience,
99+
m.azureEnv.Cloud.Services[azure.ServiceAzureSQL].Audience + "/.default",
100100
},
101101
})
102102
if err != nil {

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ require (
7373
github.com/googleapis/gax-go/v2 v2.12.4
7474
github.com/gorilla/mux v1.8.1
7575
github.com/grandcat/zeroconf v1.0.0
76-
github.com/hamba/avro/v2 v2.22.2-0.20240625062549-66aad10411d9
76+
github.com/hamba/avro/v2 v2.28.0
7777
github.com/hashicorp/consul/api v1.25.1
7878
github.com/hashicorp/golang-lru/v2 v2.0.7
7979
github.com/hazelcast/hazelcast-go-client v0.0.0-20190530123621-6cf767c2f31a
@@ -126,7 +126,7 @@ require (
126126
go.uber.org/multierr v1.11.0
127127
go.uber.org/ratelimit v0.3.0
128128
golang.org/x/crypto v0.35.0
129-
golang.org/x/mod v0.18.0
129+
golang.org/x/mod v0.23.0
130130
golang.org/x/net v0.36.0
131131
golang.org/x/oauth2 v0.27.0
132132
google.golang.org/api v0.180.0
@@ -304,7 +304,7 @@ require (
304304
github.com/kataras/go-errors v0.0.3 // indirect
305305
github.com/kataras/go-serializer v0.0.4 // indirect
306306
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
307-
github.com/klauspost/compress v1.17.9 // indirect
307+
github.com/klauspost/compress v1.17.11 // indirect
308308
github.com/knadh/koanf v1.4.1 // indirect
309309
github.com/kr/fs v0.1.0 // indirect
310310
github.com/kubemq-io/protobuf v1.3.1 // indirect
@@ -404,7 +404,7 @@ require (
404404
golang.org/x/term v0.29.0 // indirect
405405
golang.org/x/text v0.22.0 // indirect
406406
golang.org/x/time v0.6.0 // indirect
407-
golang.org/x/tools v0.22.0 // indirect
407+
golang.org/x/tools v0.30.0 // indirect
408408
google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect
409409
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
410410
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,8 @@ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8
901901
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
902902
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
903903
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
904-
github.com/hamba/avro/v2 v2.22.2-0.20240625062549-66aad10411d9 h1:NEoabXt33PDWK4fXryK4e+XX+fSKDmmu9vg3yb9YI2M=
905-
github.com/hamba/avro/v2 v2.22.2-0.20240625062549-66aad10411d9/go.mod h1:fQVdB2mFZBhPW1D5Abej41LMvrErARGrrdjOnKbm5yw=
904+
github.com/hamba/avro/v2 v2.28.0 h1:E8J5D27biyAulWKNiEBhV85QPc9xRMCUCGJewS0KYCE=
905+
github.com/hamba/avro/v2 v2.28.0/go.mod h1:9TVrlt1cG1kkTUtm9u2eO5Qb7rZXlYzoKqPt8TSH+TA=
906906
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
907907
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
908908
github.com/hashicorp/consul/api v1.25.1 h1:CqrdhYzc8XZuPnhIYZWH45toM0LB9ZeYr/gvpLVI3PE=
@@ -1093,8 +1093,8 @@ github.com/kitex-contrib/obs-opentelemetry/logging/logrus v0.0.0-20220601144657-
10931093
github.com/kitex-contrib/tracer-opentracing v0.0.2/go.mod h1:mprt5pxqywFQxlHb7ugfiMdKbABTLI9YrBYs9WmlK5Q=
10941094
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
10951095
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
1096-
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
1097-
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
1096+
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
1097+
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
10981098
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
10991099
github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
11001100
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
@@ -1919,8 +1919,8 @@ golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
19191919
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
19201920
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
19211921
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
1922-
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
1923-
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
1922+
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
1923+
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
19241924
golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
19251925
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
19261926
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -2258,8 +2258,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
22582258
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
22592259
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
22602260
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
2261-
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
2262-
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
2261+
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
2262+
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
22632263
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
22642264
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
22652265
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

state/oracledatabase/oracledatabaseaccess.go

Lines changed: 67 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ import (
2222
"fmt"
2323
"net/url"
2424
"strconv"
25+
"strings"
2526
"time"
2627

27-
"github.com/google/uuid"
28-
2928
"github.com/dapr/components-contrib/state"
3029
stateutils "github.com/dapr/components-contrib/state/utils"
3130
"github.com/dapr/kit/logger"
3231
"github.com/dapr/kit/metadata"
3332

34-
// Blank import for the underlying Oracle Database driver.
35-
_ "github.com/sijms/go-ora/v2"
33+
"github.com/google/uuid"
34+
goora "github.com/sijms/go-ora/v2"
3635
)
3736

3837
const (
@@ -78,23 +77,26 @@ func parseMetadata(meta map[string]string) (oracleDatabaseMetadata, error) {
7877
// Init sets up OracleDatabase connection and ensures that the state table exists.
7978
func (o *oracleDatabaseAccess) Init(ctx context.Context, metadata state.Metadata) error {
8079
meta, err := parseMetadata(metadata.Properties)
81-
o.metadata = meta
8280
if err != nil {
8381
return err
8482
}
85-
if o.metadata.ConnectionString != "" {
86-
o.connectionString = meta.ConnectionString
87-
} else {
83+
84+
o.metadata = meta
85+
86+
if o.metadata.ConnectionString == "" {
8887
o.logger.Error("Missing Oracle Database connection string")
8988
return errors.New(errMissingConnectionString)
9089
}
91-
if o.metadata.OracleWalletLocation != "" {
92-
o.connectionString += "?TRACE FILE=trace.log&SSL=enable&SSL Verify=false&WALLET=" + url.QueryEscape(o.metadata.OracleWalletLocation)
90+
91+
o.connectionString, err = parseConnectionString(meta)
92+
if err != nil {
93+
o.logger.Error(err)
94+
return err
9395
}
96+
9497
db, err := sql.Open("oracle", o.connectionString)
9598
if err != nil {
9699
o.logger.Error(err)
97-
98100
return err
99101
}
100102

@@ -105,12 +107,62 @@ func (o *oracleDatabaseAccess) Init(ctx context.Context, metadata state.Metadata
105107
return err
106108
}
107109

108-
err = o.ensureStateTable(o.metadata.TableName)
110+
return o.ensureStateTable(o.metadata.TableName)
111+
}
112+
113+
func parseConnectionString(meta oracleDatabaseMetadata) (string, error) {
114+
username := ""
115+
password := ""
116+
host := ""
117+
port := 0
118+
serviceName := ""
119+
query := url.Values{}
120+
options := make(map[string]string)
121+
122+
connectionStringURL, err := url.Parse(meta.ConnectionString)
109123
if err != nil {
110-
return err
124+
return "", err
111125
}
112126

113-
return nil
127+
isURL := connectionStringURL.Scheme != "" && connectionStringURL.Host != ""
128+
if isURL {
129+
username = connectionStringURL.User.Username()
130+
password, _ = connectionStringURL.User.Password()
131+
query = connectionStringURL.Query()
132+
serviceName = strings.TrimPrefix(connectionStringURL.Path, "/")
133+
if strings.Contains(connectionStringURL.Host, ":") {
134+
host = strings.Split(connectionStringURL.Host, ":")[0]
135+
} else {
136+
host = connectionStringURL.Host
137+
}
138+
} else {
139+
host = connectionStringURL.Path
140+
}
141+
142+
if connectionStringURL.Port() != "" {
143+
port, err = strconv.Atoi(connectionStringURL.Port())
144+
if err != nil {
145+
return "", err
146+
}
147+
}
148+
149+
for k, v := range query {
150+
options[k] = v[0]
151+
}
152+
153+
if meta.OracleWalletLocation != "" {
154+
options["WALLET"] = meta.OracleWalletLocation
155+
options["TRACE FILE"] = "trace.log"
156+
options["SSL"] = "enable"
157+
options["SSL Verify"] = "false"
158+
}
159+
160+
if strings.Contains(host, "(DESCRIPTION") {
161+
// the connection string is a URL that contains the descriptor and authentication info
162+
return goora.BuildJDBC(username, password, host, options), nil
163+
} else {
164+
return goora.BuildUrl(host, port, serviceName, username, password, options), nil
165+
}
114166
}
115167

116168
// Set makes an insert or update to the database.
@@ -170,7 +222,7 @@ func (o *oracleDatabaseAccess) doSet(ctx context.Context, db querier, req *state
170222
if req.Options.Concurrency == state.FirstWrite {
171223
stmt = `INSERT INTO ` + o.metadata.TableName + `
172224
(key, value, binary_yn, etag, expiration_time)
173-
VALUES
225+
VALUES
174226
(:key, :value, :binary_yn, :etag, ` + ttlStatement + `) `
175227
} else {
176228
// As per Discord Thread https://discord.com/channels/778680217417809931/901141713089863710/938520959562952735 expiration time is reset in case of an update.

0 commit comments

Comments
 (0)