Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
parent
1c3a0a1ea2
commit
15976110c6
|
|
@ -489,6 +489,8 @@ func (p *postgresDBAccess) cleanupTimeout() {
|
|||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
// Need to use fmt.Sprintf because we can't parametrize a table name
|
||||
//nolint:gosec
|
||||
stmt := fmt.Sprintf(`DELETE FROM %s WHERE expiredate IS NOT NULL AND expiredate < CURRENT_TIMESTAMP`, p.metadata.TableName)
|
||||
res, err := tx.Exec(stmt)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,14 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/DATA-DOG/go-sqlmock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/dapr/components-contrib/metadata"
|
||||
"github.com/dapr/components-contrib/state"
|
||||
"github.com/dapr/kit/logger"
|
||||
|
||||
// Blank import for pgx
|
||||
_ "github.com/jackc/pgx/v5/stdlib"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type mocks struct {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ limitations under the License.
|
|||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
|
@ -69,7 +68,6 @@ func TestParseTTL(t *testing.T) {
|
|||
ttl, err := ParseTTL(map[string]string{
|
||||
MetadataTTLKey: strconv.FormatInt(math.MaxInt32+1, 10),
|
||||
})
|
||||
fmt.Println(err)
|
||||
require.Error(t, err)
|
||||
assert.Nil(t, ttl)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue