From 3dd0955eba0b0c6de80e8792b9e7758375a17be6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 08:07:57 +0000 Subject: [PATCH] Upgrade experimental module (deps): Bump github.com/grafana/xk6-redis Bumps [github.com/grafana/xk6-redis](https://github.com/grafana/xk6-redis) from 0.2.0 to 0.3.0. - [Commits](https://github.com/grafana/xk6-redis/compare/v0.2.0...v0.3.0) --- updated-dependencies: - dependency-name: github.com/grafana/xk6-redis dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../grafana/xk6-redis/redis/client.go | 84 +++++++++---------- .../grafana/xk6-redis/redis/module.go | 4 +- .../grafana/xk6-redis/redis/options.go | 2 +- vendor/modules.txt | 4 +- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/go.mod b/go.mod index f505c8601e97..32fa7f440def 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/grafana/xk6-browser v1.5.2-0.20240607140836-ffcc1f5169ad github.com/grafana/xk6-dashboard v0.7.4 github.com/grafana/xk6-output-prometheus-remote v0.3.1 - github.com/grafana/xk6-redis v0.2.0 + github.com/grafana/xk6-redis v0.3.0 github.com/grafana/xk6-webcrypto v0.3.0 github.com/grafana/xk6-websockets v0.5.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 diff --git a/go.sum b/go.sum index 451ae66f4799..d23608d31e93 100644 --- a/go.sum +++ b/go.sum @@ -91,8 +91,8 @@ github.com/grafana/xk6-dashboard v0.7.4 h1:0ZRPTAXW+6A3Xqq/a/OaIZhxUt1SOMwUFff0I github.com/grafana/xk6-dashboard v0.7.4/go.mod h1:300QyQ+OQAYz/L/AzB5tKzPeBY5eKh2wl1NsRmCbsx4= github.com/grafana/xk6-output-prometheus-remote v0.3.1 h1:X23rQzlJD8dXWB31DkxR4uPnuRFo8L0Y0H22fSG9xl0= github.com/grafana/xk6-output-prometheus-remote v0.3.1/go.mod h1:0JLAm4ONsNUlNoxJXAwOCfA6GtDwTPs557OplAvE+3o= -github.com/grafana/xk6-redis v0.2.0 h1:iXmAKVlAxafZ/h8ptuXTFhGu63IFsyDI8QjUgWm66BU= -github.com/grafana/xk6-redis v0.2.0/go.mod h1:B3PA9PAPJa2/WUfNJCdQwZrbb6D4e6UHIk8dssQbj7w= +github.com/grafana/xk6-redis v0.3.0 h1:eV1YO0miPqGFilN8sL/3OdO6Mm+hZH2nsvJm5dkE0CM= +github.com/grafana/xk6-redis v0.3.0/go.mod h1:3e/U9i1Nm3WEaMy4nZSGMjVf8ZsFau+aXurYJhJ7MfQ= github.com/grafana/xk6-webcrypto v0.3.0 h1:piwiTrLTQDbuzC4CK0dVjbzQqNhIoGjWXrflf++W8aE= github.com/grafana/xk6-webcrypto v0.3.0/go.mod h1:Jk+UKbo+w/RCQH0hi+Hoy7Uj2HWd+dwEBjn1EDpwY0w= github.com/grafana/xk6-websockets v0.5.1 h1:wymI6UWpwDorv3mEInytrQjC9cmXYxQFygBOCMY1q6k= diff --git a/vendor/github.com/grafana/xk6-redis/redis/client.go b/vendor/github.com/grafana/xk6-redis/redis/client.go index ebc1d688c84b..d60878cb6ac5 100644 --- a/vendor/github.com/grafana/xk6-redis/redis/client.go +++ b/vendor/github.com/grafana/xk6-redis/redis/client.go @@ -7,7 +7,7 @@ import ( "net" "time" - "github.com/dop251/goja" + "github.com/grafana/sobek" "github.com/redis/go-redis/v9" "go.k6.io/k6/js/common" "go.k6.io/k6/js/modules" @@ -27,7 +27,7 @@ type Client struct { // If the provided value is not a supported type, the promise is rejected with an error. // // The value for `expiration` is interpreted as seconds. -func (c *Client) Set(key string, value interface{}, expiration int) *goja.Promise { +func (c *Client) Set(key string, value interface{}, expiration int) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -58,7 +58,7 @@ func (c *Client) Set(key string, value interface{}, expiration int) *goja.Promis // If the key does not exist, the promise is rejected with an error. // // If the key does not exist, the promise is rejected with an error. -func (c *Client) Get(key string) *goja.Promise { +func (c *Client) Get(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -82,7 +82,7 @@ func (c *Client) Get(key string) *goja.Promise { // GetSet sets the value of key to value and returns the old value stored // // If the provided value is not a supported type, the promise is rejected with an error. -func (c *Client) GetSet(key string, value interface{}) *goja.Promise { +func (c *Client) GetSet(key string, value interface{}) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -109,7 +109,7 @@ func (c *Client) GetSet(key string, value interface{}) *goja.Promise { } // Del removes the specified keys. A key is ignored if it does not exist -func (c *Client) Del(keys ...string) *goja.Promise { +func (c *Client) Del(keys ...string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -133,7 +133,7 @@ func (c *Client) Del(keys ...string) *goja.Promise { // GetDel gets the value of key and deletes the key. // // If the key does not exist, the promise is rejected with an error. -func (c *Client) GetDel(key string) *goja.Promise { +func (c *Client) GetDel(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -157,7 +157,7 @@ func (c *Client) GetDel(key string) *goja.Promise { // Exists returns the number of key arguments that exist. // Note that if the same existing key is mentioned in the argument // multiple times, it will be counted multiple times. -func (c *Client) Exists(keys ...string) *goja.Promise { +func (c *Client) Exists(keys ...string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -182,7 +182,7 @@ func (c *Client) Exists(keys ...string) *goja.Promise { // not exist, it is set to zero before performing the operation. An // error is returned if the key contains a value of the wrong type, or // contains a string that cannot be represented as an integer. -func (c *Client) Incr(key string) *goja.Promise { +func (c *Client) Incr(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -207,7 +207,7 @@ func (c *Client) Incr(key string) *goja.Promise { // not exist, it is set to zero before performing the operation. An // error is returned if the key contains a value of the wrong type, or // contains a string that cannot be represented as an integer. -func (c *Client) IncrBy(key string, increment int64) *goja.Promise { +func (c *Client) IncrBy(key string, increment int64) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -232,7 +232,7 @@ func (c *Client) IncrBy(key string, increment int64) *goja.Promise { // not exist, it is set to zero before performing the operation. An // error is returned if the key contains a value of the wrong type, or // contains a string that cannot be represented as an integer. -func (c *Client) Decr(key string) *goja.Promise { +func (c *Client) Decr(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -257,7 +257,7 @@ func (c *Client) Decr(key string) *goja.Promise { // not exist, it is set to zero before performing the operation. An // error is returned if the key contains a value of the wrong type, or // contains a string that cannot be represented as an integer. -func (c *Client) DecrBy(key string, decrement int64) *goja.Promise { +func (c *Client) DecrBy(key string, decrement int64) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -281,7 +281,7 @@ func (c *Client) DecrBy(key string, decrement int64) *goja.Promise { // RandomKey returns a random key. // // If the database is empty, the promise is rejected with an error. -func (c *Client) RandomKey() *goja.Promise { +func (c *Client) RandomKey() *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -303,7 +303,7 @@ func (c *Client) RandomKey() *goja.Promise { } // Mget returns the values associated with the specified keys. -func (c *Client) Mget(keys ...string) *goja.Promise { +func (c *Client) Mget(keys ...string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -328,7 +328,7 @@ func (c *Client) Mget(keys ...string) *goja.Promise { // be deleted. // Note that calling Expire with a non-positive timeout will result in // the key being deleted rather than expired. -func (c *Client) Expire(key string, seconds int) *goja.Promise { +func (c *Client) Expire(key string, seconds int) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -352,7 +352,7 @@ func (c *Client) Expire(key string, seconds int) *goja.Promise { // Ttl returns the remaining time to live of a key that has a timeout. // //nolint:revive,stylecheck -func (c *Client) Ttl(key string) *goja.Promise { +func (c *Client) Ttl(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -374,7 +374,7 @@ func (c *Client) Ttl(key string) *goja.Promise { } // Persist removes the existing timeout on key. -func (c *Client) Persist(key string) *goja.Promise { +func (c *Client) Persist(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -399,7 +399,7 @@ func (c *Client) Persist(key string) *goja.Promise { // at `key`. If `key` does not exist, it is created as empty list before // performing the push operations. When `key` holds a value that is not // a list, and error is returned. -func (c *Client) Lpush(key string, values ...interface{}) *goja.Promise { +func (c *Client) Lpush(key string, values ...interface{}) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -428,7 +428,7 @@ func (c *Client) Lpush(key string, values ...interface{}) *goja.Promise { // Rpush inserts all the specified values at the tail of the list stored // at `key`. If `key` does not exist, it is created as empty list before // performing the push operations. -func (c *Client) Rpush(key string, values ...interface{}) *goja.Promise { +func (c *Client) Rpush(key string, values ...interface{}) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -457,7 +457,7 @@ func (c *Client) Rpush(key string, values ...interface{}) *goja.Promise { // Lpop removes and returns the first element of the list stored at `key`. // // If the list does not exist, this command rejects the promise with an error. -func (c *Client) Lpop(key string) *goja.Promise { +func (c *Client) Lpop(key string) *sobek.Promise { // TODO: redis supports indicating the amount of values to pop promise, resolve, reject := c.makeHandledPromise() @@ -482,7 +482,7 @@ func (c *Client) Lpop(key string) *goja.Promise { // Rpop removes and returns the last element of the list stored at `key`. // // If the list does not exist, this command rejects the promise with an error. -func (c *Client) Rpop(key string) *goja.Promise { +func (c *Client) Rpop(key string) *sobek.Promise { // TODO: redis supports indicating the amount of values to pop promise, resolve, reject := c.makeHandledPromise() @@ -508,7 +508,7 @@ func (c *Client) Rpop(key string) *goja.Promise { // offsets start and stop are zero-based indexes. These offsets can be // negative numbers, where they indicate offsets starting at the end of // the list. -func (c *Client) Lrange(key string, start, stop int64) *goja.Promise { +func (c *Client) Lrange(key string, start, stop int64) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -534,7 +534,7 @@ func (c *Client) Lrange(key string, start, stop int64) *goja.Promise { // elements starting at the tail of the list. // // If the list does not exist, this command rejects the promise with an error. -func (c *Client) Lindex(key string, index int64) *goja.Promise { +func (c *Client) Lindex(key string, index int64) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -558,7 +558,7 @@ func (c *Client) Lindex(key string, index int64) *goja.Promise { // Lset sets the list element at `index` to `element`. // // If the list does not exist, this command rejects the promise with an error. -func (c *Client) Lset(key string, index int64, element string) *goja.Promise { +func (c *Client) Lset(key string, index int64, element string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -585,7 +585,7 @@ func (c *Client) Lset(key string, index int64, element string) *goja.Promise { // If `count` is zero, all elements matching `value` are removed. // // If the list does not exist, this command rejects the promise with an error. -func (c *Client) Lrem(key string, count int64, value string) *goja.Promise { +func (c *Client) Lrem(key string, count int64, value string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -610,7 +610,7 @@ func (c *Client) Lrem(key string, count int64, value string) *goja.Promise { // does not exist, it is interpreted as an empty list and 0 is returned. // // If the list does not exist, this command rejects the promise with an error. -func (c *Client) Llen(key string) *goja.Promise { +func (c *Client) Llen(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -636,7 +636,7 @@ func (c *Client) Llen(key string) *goja.Promise { // If `field` already exists in the hash, it is overwritten. // // If the hash does not exist, this command rejects the promise with an error. -func (c *Client) Hset(key string, field string, value interface{}) *goja.Promise { +func (c *Client) Hset(key string, field string, value interface{}) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -666,7 +666,7 @@ func (c *Client) Hset(key string, field string, value interface{}) *goja.Promise // only if `field` does not yet exist. If `key` does not exist, a new key // holding a hash is created. If `field` already exists, this operation // has no effect. -func (c *Client) Hsetnx(key, field, value string) *goja.Promise { +func (c *Client) Hsetnx(key, field, value string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -690,7 +690,7 @@ func (c *Client) Hsetnx(key, field, value string) *goja.Promise { // Hget returns the value associated with `field` in the hash stored at `key`. // // If the hash does not exist, this command rejects the promise with an error. -func (c *Client) Hget(key, field string) *goja.Promise { +func (c *Client) Hget(key, field string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -712,7 +712,7 @@ func (c *Client) Hget(key, field string) *goja.Promise { } // Hdel deletes the specified fields from the hash stored at `key`. -func (c *Client) Hdel(key string, fields ...string) *goja.Promise { +func (c *Client) Hdel(key string, fields ...string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -736,7 +736,7 @@ func (c *Client) Hdel(key string, fields ...string) *goja.Promise { // Hgetall returns all fields and values of the hash stored at `key`. // // If the hash does not exist, this command rejects the promise with an error. -func (c *Client) Hgetall(key string) *goja.Promise { +func (c *Client) Hgetall(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -760,7 +760,7 @@ func (c *Client) Hgetall(key string) *goja.Promise { // Hkeys returns all fields of the hash stored at `key`. // // If the hash does not exist, this command rejects the promise with an error. -func (c *Client) Hkeys(key string) *goja.Promise { +func (c *Client) Hkeys(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -784,7 +784,7 @@ func (c *Client) Hkeys(key string) *goja.Promise { // Hvals returns all values of the hash stored at `key`. // // If the hash does not exist, this command rejects the promise with an error. -func (c *Client) Hvals(key string) *goja.Promise { +func (c *Client) Hvals(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -808,7 +808,7 @@ func (c *Client) Hvals(key string) *goja.Promise { // Hlen returns the number of fields in the hash stored at `key`. // // If the hash does not exist, this command rejects the promise with an error. -func (c *Client) Hlen(key string) *goja.Promise { +func (c *Client) Hlen(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -833,7 +833,7 @@ func (c *Client) Hlen(key string) *goja.Promise { // by `increment`. If `key` does not exist, a new key holding a hash is created. // If `field` does not exist the value is set to 0 before the operation is // set to 0 before the operation is performed. -func (c *Client) Hincrby(key, field string, increment int64) *goja.Promise { +func (c *Client) Hincrby(key, field string, increment int64) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -857,7 +857,7 @@ func (c *Client) Hincrby(key, field string, increment int64) *goja.Promise { // Sadd adds the specified members to the set stored at key. // Specified members that are already a member of this set are ignored. // If key does not exist, a new set is created before adding the specified members. -func (c *Client) Sadd(key string, members ...interface{}) *goja.Promise { +func (c *Client) Sadd(key string, members ...interface{}) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -886,7 +886,7 @@ func (c *Client) Sadd(key string, members ...interface{}) *goja.Promise { // Srem removes the specified members from the set stored at key. // Specified members that are not a member of this set are ignored. // If key does not exist, it is treated as an empty set and this command returns 0. -func (c *Client) Srem(key string, members ...interface{}) *goja.Promise { +func (c *Client) Srem(key string, members ...interface{}) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -913,7 +913,7 @@ func (c *Client) Srem(key string, members ...interface{}) *goja.Promise { } // Sismember returns if member is a member of the set stored at key. -func (c *Client) Sismember(key string, member interface{}) *goja.Promise { +func (c *Client) Sismember(key string, member interface{}) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -940,7 +940,7 @@ func (c *Client) Sismember(key string, member interface{}) *goja.Promise { } // Smembers returns all members of the set stored at key. -func (c *Client) Smembers(key string) *goja.Promise { +func (c *Client) Smembers(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -964,7 +964,7 @@ func (c *Client) Smembers(key string) *goja.Promise { // Srandmember returns a random element from the set value stored at key. // // If the set does not exist, the promise is rejected with an error. -func (c *Client) Srandmember(key string) *goja.Promise { +func (c *Client) Srandmember(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -988,7 +988,7 @@ func (c *Client) Srandmember(key string) *goja.Promise { // Spop removes and returns a random element from the set value stored at key. // // If the set does not exist, the promise is rejected with an error. -func (c *Client) Spop(key string) *goja.Promise { +func (c *Client) Spop(key string) *sobek.Promise { promise, resolve, reject := c.makeHandledPromise() if err := c.connect(); err != nil { @@ -1010,7 +1010,7 @@ func (c *Client) Spop(key string) *goja.Promise { } // SendCommand sends a command to the redis server. -func (c *Client) SendCommand(command string, args ...interface{}) *goja.Promise { +func (c *Client) SendCommand(command string, args ...interface{}) *sobek.Promise { var doArgs []interface{} doArgs = append(doArgs, command) doArgs = append(doArgs, args...) @@ -1043,7 +1043,7 @@ func (c *Client) SendCommand(command string, args ...interface{}) *goja.Promise // makeHandledPromise will create a promise and return its resolve and reject methods, // wrapped in such a way that it will block the eventloop from exiting before they are // called even if the promise isn't resolved by the time the current script ends executing. -func (c *Client) makeHandledPromise() (*goja.Promise, func(interface{}), func(interface{})) { +func (c *Client) makeHandledPromise() (*sobek.Promise, func(interface{}), func(interface{})) { runtime := c.vu.Runtime() callback := c.vu.RegisterCallback() p, resolve, reject := runtime.NewPromise() diff --git a/vendor/github.com/grafana/xk6-redis/redis/module.go b/vendor/github.com/grafana/xk6-redis/redis/module.go index 7c44ffb5e7ae..e821b7bb46b1 100644 --- a/vendor/github.com/grafana/xk6-redis/redis/module.go +++ b/vendor/github.com/grafana/xk6-redis/redis/module.go @@ -4,7 +4,7 @@ package redis import ( "errors" - "github.com/dop251/goja" + "github.com/grafana/sobek" "go.k6.io/k6/js/common" "go.k6.io/k6/js/modules" ) @@ -66,7 +66,7 @@ func (mi *ModuleInstance) Exports() modules.Exports { // Client is initially configured, but in a disconnected state. // The connection is automatically established when using any of the Redis // commands exposed by the Client. -func (mi *ModuleInstance) NewClient(call goja.ConstructorCall) *goja.Object { +func (mi *ModuleInstance) NewClient(call sobek.ConstructorCall) *sobek.Object { rt := mi.vu.Runtime() if len(call.Arguments) != 1 { diff --git a/vendor/github.com/grafana/xk6-redis/redis/options.go b/vendor/github.com/grafana/xk6-redis/redis/options.go index 983b5f7a3c20..7cfdddd3b060 100644 --- a/vendor/github.com/grafana/xk6-redis/redis/options.go +++ b/vendor/github.com/grafana/xk6-redis/redis/options.go @@ -87,7 +87,7 @@ type sentinelOptions struct { } // newOptionsFromObject validates and instantiates an options struct from its -// map representation as exported from goja.Runtime. +// map representation as exported from sobek.Runtime. func newOptionsFromObject(obj map[string]interface{}) (*redis.UniversalOptions, error) { var options interface{} if cluster, ok := obj["cluster"].(map[string]interface{}); ok { diff --git a/vendor/modules.txt b/vendor/modules.txt index e20c2f361899..9194004618cb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -197,8 +197,8 @@ github.com/grafana/xk6-dashboard/dashboard github.com/grafana/xk6-output-prometheus-remote/pkg/remote github.com/grafana/xk6-output-prometheus-remote/pkg/remotewrite github.com/grafana/xk6-output-prometheus-remote/pkg/stale -# github.com/grafana/xk6-redis v0.2.0 -## explicit; go 1.19 +# github.com/grafana/xk6-redis v0.3.0 +## explicit; go 1.20 github.com/grafana/xk6-redis/redis # github.com/grafana/xk6-webcrypto v0.3.0 ## explicit; go 1.19