Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
ItalyPaleAle 2022-11-22 04:53:24 +00:00
parent 1c3a0a1ea2
commit 15976110c6
3 changed files with 6 additions and 3 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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)
})