Skip to content

Commit

Permalink
Expose Ping (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigpastro authored Aug 8, 2024
1 parent c1fb2aa commit ff37dc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pgmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func (p *PGMQ) Close() {
p.db.Close()
}

// Ping calls the underlying Ping function of the DB interface.
func (p *PGMQ) Ping(ctx context.Context) error {
return p.db.Ping(ctx)
}

// CreateQueue creates a new queue. This sets up the queue's tables, indexes,
// and metadata.
func (p *PGMQ) CreateQueue(ctx context.Context, queue string) error {
Expand Down
5 changes: 5 additions & 0 deletions pgmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ func TestMain(m *testing.M) {
os.Exit(code)
}

func TestPing(t *testing.T) {
err := q.Ping(context.Background())
require.NoError(t, err)
}

func TestCreateAndDropQueue(t *testing.T) {
ctx := context.Background()
queue := t.Name()
Expand Down

0 comments on commit ff37dc2

Please sign in to comment.