State stores should always allow values that are empty strings (#2723)
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
parent
93bb55a812
commit
04d1e71ce7
|
@ -167,10 +167,6 @@ func (p *PostgresDBAccess) doSet(parentCtx context.Context, db dbquerier, req *s
|
||||||
return errors.New("missing key in set operation")
|
return errors.New("missing key in set operation")
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := req.Value.(string); ok && v == "" {
|
|
||||||
return errors.New("empty string is not allowed in set operation")
|
|
||||||
}
|
|
||||||
|
|
||||||
v := req.Value
|
v := req.Value
|
||||||
byteArray, isBinary := req.Value.([]uint8)
|
byteArray, isBinary := req.Value.([]uint8)
|
||||||
if isBinary {
|
if isBinary {
|
||||||
|
|
|
@ -497,11 +497,6 @@ func (m *MySQL) setValue(parentCtx context.Context, querier querier, req *state.
|
||||||
var v any
|
var v any
|
||||||
isBinary := false
|
isBinary := false
|
||||||
switch x := req.Value.(type) {
|
switch x := req.Value.(type) {
|
||||||
case string:
|
|
||||||
if x == "" {
|
|
||||||
return errors.New("empty string is not allowed in set operation")
|
|
||||||
}
|
|
||||||
v = x
|
|
||||||
case []uint8:
|
case []uint8:
|
||||||
isBinary = true
|
isBinary = true
|
||||||
v = base64.StdEncoding.EncodeToString(x)
|
v = base64.StdEncoding.EncodeToString(x)
|
||||||
|
|
|
@ -126,9 +126,6 @@ func (o *oracleDatabaseAccess) doSet(ctx context.Context, db querier, req *state
|
||||||
return errors.New("missing key in set operation")
|
return errors.New("missing key in set operation")
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := req.Value.(string); ok && v == "" {
|
|
||||||
return errors.New("empty string is not allowed in set operation")
|
|
||||||
}
|
|
||||||
requestValue := req.Value
|
requestValue := req.Value
|
||||||
byteArray, isBinary := req.Value.([]uint8)
|
byteArray, isBinary := req.Value.([]uint8)
|
||||||
binaryYN := "N"
|
binaryYN := "N"
|
||||||
|
|
|
@ -349,10 +349,6 @@ func (a *sqliteDBAccess) doSet(parentCtx context.Context, db querier, req *state
|
||||||
return errors.New("missing key in set option")
|
return errors.New("missing key in set option")
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := req.Value.(string); ok && v == "" {
|
|
||||||
return fmt.Errorf("empty string is not allowed in set operation")
|
|
||||||
}
|
|
||||||
|
|
||||||
// TTL
|
// TTL
|
||||||
var ttlSeconds int
|
var ttlSeconds int
|
||||||
ttl, ttlerr := stateutils.ParseTTL(req.Metadata)
|
ttl, ttlerr := stateutils.ParseTTL(req.Metadata)
|
||||||
|
|
|
@ -93,12 +93,16 @@ func ConformanceTests(t *testing.T, props map[string]string, statestore state.St
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: fmt.Sprintf("%s-string-with-json", key),
|
key: fmt.Sprintf("%s-string-with-json", key),
|
||||||
value: "{\"a\":\"b\"}",
|
value: `{"a":"b"}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: fmt.Sprintf("%s-string", key),
|
key: fmt.Sprintf("%s-string", key),
|
||||||
value: "hello world",
|
value: "hello world",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: fmt.Sprintf("%s-empty-string", key),
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: fmt.Sprintf("%s-struct", key),
|
key: fmt.Sprintf("%s-struct", key),
|
||||||
value: ValueType{Message: fmt.Sprintf("test%s", key)},
|
value: ValueType{Message: fmt.Sprintf("test%s", key)},
|
||||||
|
@ -216,7 +220,7 @@ func ConformanceTests(t *testing.T, props map[string]string, statestore state.St
|
||||||
results: []state.QueryItem{
|
results: []state.QueryItem{
|
||||||
{
|
{
|
||||||
Key: fmt.Sprintf("%s-struct", key),
|
Key: fmt.Sprintf("%s-struct", key),
|
||||||
Data: []byte(fmt.Sprintf("{\"message\":\"test%s\"}", key)),
|
Data: []byte(fmt.Sprintf(`{"message":"test%s"}`, key)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue