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")
|
||||
}
|
||||
|
||||
if v, ok := req.Value.(string); ok && v == "" {
|
||||
return errors.New("empty string is not allowed in set operation")
|
||||
}
|
||||
|
||||
v := req.Value
|
||||
byteArray, isBinary := req.Value.([]uint8)
|
||||
if isBinary {
|
||||
|
|
|
@ -497,11 +497,6 @@ func (m *MySQL) setValue(parentCtx context.Context, querier querier, req *state.
|
|||
var v any
|
||||
isBinary := false
|
||||
switch x := req.Value.(type) {
|
||||
case string:
|
||||
if x == "" {
|
||||
return errors.New("empty string is not allowed in set operation")
|
||||
}
|
||||
v = x
|
||||
case []uint8:
|
||||
isBinary = true
|
||||
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")
|
||||
}
|
||||
|
||||
if v, ok := req.Value.(string); ok && v == "" {
|
||||
return errors.New("empty string is not allowed in set operation")
|
||||
}
|
||||
requestValue := req.Value
|
||||
byteArray, isBinary := req.Value.([]uint8)
|
||||
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")
|
||||
}
|
||||
|
||||
if v, ok := req.Value.(string); ok && v == "" {
|
||||
return fmt.Errorf("empty string is not allowed in set operation")
|
||||
}
|
||||
|
||||
// TTL
|
||||
var ttlSeconds int
|
||||
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),
|
||||
value: "{\"a\":\"b\"}",
|
||||
value: `{"a":"b"}`,
|
||||
},
|
||||
{
|
||||
key: fmt.Sprintf("%s-string", key),
|
||||
value: "hello world",
|
||||
},
|
||||
{
|
||||
key: fmt.Sprintf("%s-empty-string", key),
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
key: fmt.Sprintf("%s-struct", 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{
|
||||
{
|
||||
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