Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

451 B
Raw Blame
package postgres

import (
	"testing"

	"github.com/lib/pq"
	"github.com/pkg/errors"
	"github.com/stretchr/testify/require"
)

func TestIsRetryableTransactionError(t *testing.T) {
	db := &DB{}
	require.True(t, db.IsRetryableTransactionError(errors.Wrap(&pq.Error{Code: "40001"}, "commit failed")))
	require.True(t, db.IsRetryableTransactionError(&pq.Error{Code: "40P01"}))
	require.False(t, db.IsRetryableTransactionError(&pq.Error{Code: "23505"}))
}