diff --git a/docs/reference/config.md b/docs/reference/config.md index 3c245c124..b592b6524 100644 --- a/docs/reference/config.md +++ b/docs/reference/config.md @@ -275,6 +275,7 @@ nav_order: 2 |expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s` |headers|Adds custom headers to HTTP requests|`map[string]string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s` @@ -593,6 +594,7 @@ nav_order: 2 |expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s` |headers|Adds custom headers to HTTP requests|`string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |method|The HTTP method to use when making requests to the Address Resolver|`string`|`GET` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` @@ -648,6 +650,7 @@ nav_order: 2 |headers|Adds custom headers to HTTP requests|`map[string]string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` |instance|The Ethereum address of the FireFly BatchPin smart contract that has been deployed to the blockchain|Address `string`|`` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |prefixLong|The prefix that will be used for Ethconnect specific HTTP headers when FireFly makes requests to Ethconnect|`string`|`firefly` @@ -718,6 +721,7 @@ nav_order: 2 |expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s` |headers|Adds custom headers to HTTP requests|`map[string]string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s` @@ -769,6 +773,7 @@ nav_order: 2 |expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s` |headers|Adds custom headers to HTTP requests|`map[string]string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |prefixLong|The prefix that will be used for Fabconnect specific HTTP headers when FireFly makes requests to Fabconnect|`string`|`firefly` @@ -890,6 +895,7 @@ nav_order: 2 |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` |initEnabled|Instructs FireFly to always post all current nodes to the `/init` API before connecting or reconnecting to the connector|`boolean`|`false` |manifestEnabled|Determines whether to require+validate a manifest from other DX instances in the network. Must be supported by the connector|`string`|`false` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s` @@ -979,6 +985,7 @@ nav_order: 2 |expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s` |headers|Adds custom headers to HTTP requests|`map[string]string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s` @@ -1026,6 +1033,7 @@ nav_order: 2 |expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s` |headers|Adds custom headers to HTTP requests|`map[string]string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s` @@ -1081,6 +1089,7 @@ nav_order: 2 |expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s` |headers|Adds custom headers to HTTP requests|`map[string]string`|`` |idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms` +|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0` |maxIdleConns|The max number of idle connections to hold pooled|`int`|`100` |passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false` |requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s` diff --git a/go.mod b/go.mod index 97120ca08..4aefeabf9 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/golang-migrate/migrate/v4 v4.15.2 github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 - github.com/hyperledger/firefly-common v1.2.17 + github.com/hyperledger/firefly-common v1.2.19 github.com/hyperledger/firefly-signer v1.1.8 github.com/jarcoal/httpmock v1.2.0 github.com/lib/pq v1.10.7 diff --git a/go.sum b/go.sum index aad9968cb..2866ac65c 100644 --- a/go.sum +++ b/go.sum @@ -676,8 +676,8 @@ github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0m github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hyperledger/firefly-common v1.2.17 h1:l1fVt7zk+ysJWVN2SWr1kVrV2a/3cIh1yajpGRPf9iw= -github.com/hyperledger/firefly-common v1.2.17/go.mod h1:17lOH4YufiPy82LpKm8fPa/YXJ0pUyq01zK1CmklJwM= +github.com/hyperledger/firefly-common v1.2.19 h1:o5eZKVTFEl+o9uVxCTPdaSGxZ0VtzKtgEW0UcQXmELs= +github.com/hyperledger/firefly-common v1.2.19/go.mod h1:17lOH4YufiPy82LpKm8fPa/YXJ0pUyq01zK1CmklJwM= github.com/hyperledger/firefly-signer v1.1.8 h1:XyJjZXesih2dWYG31m5ZYt4irH7/PdkRutMPld7AqKE= github.com/hyperledger/firefly-signer v1.1.8/go.mod h1:vNbbROziwqkOmO0b+9ky3devjcFg0JIkR2M1KG7seTQ= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= diff --git a/internal/apiserver/route_get_events_test.go b/internal/apiserver/route_get_events_test.go index be6a567b1..d5ccc36ef 100644 --- a/internal/apiserver/route_get_events_test.go +++ b/internal/apiserver/route_get_events_test.go @@ -61,7 +61,7 @@ func TestGetEventsWithReferences(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, resWithCount.Items) assert.Equal(t, int64(0), resWithCount.Count) - assert.Equal(t, int64(10), resWithCount.Total) + assert.Equal(t, int64(10), *resWithCount.Total) } func TestGetEventsWithFetchReference(t *testing.T) { @@ -84,5 +84,5 @@ func TestGetEventsWithFetchReference(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, resWithCount.Items) assert.Equal(t, int64(0), resWithCount.Count) - assert.Equal(t, int64(10), resWithCount.Total) + assert.Equal(t, int64(10), *resWithCount.Total) } diff --git a/internal/apiserver/route_get_msgs_test.go b/internal/apiserver/route_get_msgs_test.go index 75b6648e3..e055c3e36 100644 --- a/internal/apiserver/route_get_msgs_test.go +++ b/internal/apiserver/route_get_msgs_test.go @@ -61,7 +61,7 @@ func TestGetMessagesWithCount(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, resWithCount.Items) assert.Equal(t, int64(0), resWithCount.Count) - assert.Equal(t, int64(10), resWithCount.Total) + assert.Equal(t, int64(10), *resWithCount.Total) } func TestGetMessagesWithCountAndData(t *testing.T) { @@ -84,5 +84,5 @@ func TestGetMessagesWithCountAndData(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, resWithCount.Items) assert.Equal(t, int64(0), resWithCount.Count) - assert.Equal(t, int64(10), resWithCount.Total) + assert.Equal(t, int64(10), *resWithCount.Total) } diff --git a/internal/database/sqlcommon/message_sql_test.go b/internal/database/sqlcommon/message_sql_test.go index ba8dd7c6b..84df7cfed 100644 --- a/internal/database/sqlcommon/message_sql_test.go +++ b/internal/database/sqlcommon/message_sql_test.go @@ -109,7 +109,7 @@ func TestUpsertE2EWithDB(t *testing.T) { Created: fftypes.Now(), Namespace: "ns12345", Topics: []string{"topic1", "topic2"}, - Tag: "tag1", + Tag: "tag_1", Group: gid, DataHash: fftypes.NewRandB32(), TxType: core.TransactionTypeBatchPin, @@ -237,6 +237,17 @@ func TestUpsertE2EWithDB(t *testing.T) { msgReadJson, _ = json.Marshal(msgRead) assert.Equal(t, string(msgJson), string(msgReadJson)) + // Query with a complex "like" filter + filter = fb.And( + fb.IStartsWith("tag", "TAG_"), + fb.EndsWith("tag", "_1"), + fb.NotContains("tag", "%tag%"), + ) + msgs, _, err = s.GetMessages(ctx, "ns12345", filter) + assert.NoError(t, err) + assert.Equal(t, 1, len(msgs)) + assert.Equal(t, *msgID, *msgs[0].Header.ID) + s.callbacks.AssertExpectations(t) }