diff --git a/go.mod b/go.mod index 0a8741b3205d4..89268fea9d89d 100644 --- a/go.mod +++ b/go.mod @@ -373,7 +373,7 @@ replace ( github.com/datastax/go-cassandra-native-protocol => github.com/gravitational/go-cassandra-native-protocol v0.0.0-20221005103706-b9e66c056e90 github.com/denisenkom/go-mssqldb => github.com/gravitational/go-mssqldb v0.11.1-0.20221006130402-25bef12c7ee1 github.com/go-mysql-org/go-mysql => github.com/gravitational/go-mysql v1.5.0-teleport.1 - github.com/go-redis/redis/v9 => github.com/gravitational/redis/v9 v9.0.0-teleport.2 + github.com/go-redis/redis/v9 => github.com/gravitational/redis/v9 v9.0.0-teleport.3 github.com/gogo/protobuf => github.com/gravitational/protobuf v1.3.2-0.20201123192827-2b9fcfaffcbf github.com/gravitational/teleport/api => ./api github.com/julienschmidt/httprouter => github.com/gravitational/httprouter v1.3.1-0.20220408074523-c876c5e705a5 diff --git a/go.sum b/go.sum index 891e104407ae2..a7e3c0cc33d6c 100644 --- a/go.sum +++ b/go.sum @@ -729,8 +729,8 @@ github.com/gravitational/predicate v1.3.0 h1:n1lmH6YU1oX/Y546qHQNJb50FJy6Ou/+MvW github.com/gravitational/predicate v1.3.0/go.mod h1:wPNu01gNYh2LRVtIGmFBvRpfBzl4nI2EaxbYDG8Mm4w= github.com/gravitational/protobuf v1.3.2-0.20201123192827-2b9fcfaffcbf h1:MQ4e8XcxvZTeuOmRl7yE519vcWc2h/lyvYzsvt41cdY= github.com/gravitational/protobuf v1.3.2-0.20201123192827-2b9fcfaffcbf/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gravitational/redis/v9 v9.0.0-teleport.2 h1:cX6NjKFy8zcqS0RF+EsOuHBqv+XWAgNUTVxS1y6hg88= -github.com/gravitational/redis/v9 v9.0.0-teleport.2/go.mod h1:8et+z03j0l8N+DvsVnclzjf3Dl/pFHgRk+2Ct1qw66A= +github.com/gravitational/redis/v9 v9.0.0-teleport.3 h1:Eg/j3jiNUZ558KDXOqzF682EFmf97vxAFFnMgZ0YHns= +github.com/gravitational/redis/v9 v9.0.0-teleport.3/go.mod h1:8et+z03j0l8N+DvsVnclzjf3Dl/pFHgRk+2Ct1qw66A= github.com/gravitational/reporting v0.0.0-20210923183620-237377721140 h1:UACNXsuOXxe2dpjn3SA2g4YUgOoZTxQ6yf+QYAYcQMc= github.com/gravitational/reporting v0.0.0-20210923183620-237377721140/go.mod h1:rBJeI3JYVzbL7Yw2hYrp4QdKIkncb1pUHo95DyoEGns= github.com/gravitational/roundtrip v1.0.2 h1:eOCY0NEKKaB0ksJmvhO6lPMFz1pIIef+vyPBTBROQ5c= diff --git a/lib/srv/db/redis/protocol/resp2_test.go b/lib/srv/db/redis/protocol/resp2_test.go index d2bcb310c901e..34080f8c6a28e 100644 --- a/lib/srv/db/redis/protocol/resp2_test.go +++ b/lib/srv/db/redis/protocol/resp2_test.go @@ -23,6 +23,7 @@ import ( "bytes" "context" "errors" + "fmt" "testing" "github.com/go-redis/redis/v9" @@ -111,6 +112,26 @@ func TestWriteCmd(t *testing.T) { } } +func TestReadWriteStatus(t *testing.T) { + inputStatusBytes := []byte("+status\r\n") + + // Read the status into a redis.Cmd. + cmd := &redis.Cmd{} + err := cmd.ReadReply(redis.NewReader(bytes.NewReader(inputStatusBytes))) + require.NoError(t, err) + + // Verify result. + value, err := cmd.Result() + require.NoError(t, err) + require.Equal(t, "status", fmt.Sprintf("%v", value)) + + // Verify WriteCmd. + outputStatusBytes := &bytes.Buffer{} + err = WriteCmd(redis.NewWriter(outputStatusBytes), value) + require.NoError(t, err) + require.Equal(t, string(inputStatusBytes), outputStatusBytes.String()) +} + func TestMakeUnknownCommandErrorForCmd(t *testing.T) { tests := []struct { name string