diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 648880b..6b9a82b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,6 +45,15 @@ jobs: - name: Test (latest pgmq version) run: Npgmq.Test/scripts/run-tests.sh + - name: Test (pgmq 1.4.5) + run: Npgmq.Test/scripts/run-tests.sh 1.4.5 + + - name: Test (pgmq 1.3.3) + run: Npgmq.Test/scripts/run-tests.sh 1.3.3 + + - name: Test (pgmq 1.2.1) + run: Npgmq.Test/scripts/run-tests.sh 1.2.1 + - name: Test (pgmq 1.1.1) run: Npgmq.Test/scripts/run-tests.sh 1.1.1 diff --git a/Npgmq.Test/Npgmq.Test.csproj b/Npgmq.Test/Npgmq.Test.csproj index ffdde00..2164c4c 100644 --- a/Npgmq.Test/Npgmq.Test.csproj +++ b/Npgmq.Test/Npgmq.Test.csproj @@ -22,6 +22,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + diff --git a/Npgmq.Test/NpgmqClientTest.cs b/Npgmq.Test/NpgmqClientTest.cs index 7b1d450..ca3baf9 100644 --- a/Npgmq.Test/NpgmqClientTest.cs +++ b/Npgmq.Test/NpgmqClientTest.cs @@ -50,6 +50,12 @@ private async Task ResetTestQueueAsync() await _sut.CreateQueueAsync(TestQueueName); } + private async Task IsMinPgmqVersion(string minVersion) + { + var version = await _connection.ExecuteScalarAsync("select extversion from pg_extension where extname = 'pgmq';"); + return version is not null && new Version(version) >= new Version(minVersion); + } + [Fact] public async Task ArchiveAsync_should_archive_a_single_message() { @@ -687,9 +693,11 @@ public async Task SendAsync_with_int_delay_should_add_message_with_future_vt() Assert.Equal(msgId, await _connection.ExecuteScalarAsync($"SELECT msg_id FROM pgmq.q_{TestQueueName} LIMIT 1;")); } - [Fact] + [SkippableFact] public async Task SendAsync_with_timestamp_delay_should_add_message_with_a_specified_vt() { + Skip.IfNot(await IsMinPgmqVersion("1.5.0"), "This test requires pgmq 1.5.0 or later"); + // Arrange await ResetTestQueueAsync(); var delay = DateTimeOffset.UtcNow.AddHours(1); @@ -747,9 +755,11 @@ public async Task SendBatchAsync_with_int_delay_should_add_multiple_messages_wit Assert.Equal(msgIds.OrderBy(x => x), (await _connection.QueryAsync($"SELECT msg_id FROM pgmq.q_{TestQueueName} ORDER BY msg_id;")).ToList()); } - [Fact] + [SkippableFact] public async Task SendBatchAsync_with_timestamp_delay_should_add_multiple_messages_with_a_specified_vt() { + Skip.IfNot(await IsMinPgmqVersion("1.5.0"), "This test requires pgmq 1.5.0 or later"); + // Arrange await ResetTestQueueAsync(); var delay = DateTimeOffset.UtcNow.AddHours(1); diff --git a/README.md b/README.md index f530e55..7b53b90 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,21 @@ A .NET client for [Postgres Message Queue](https://github.com/tembo-io/pgmq) (PGMQ). +[![Build](https://github.com/brianpursley/Npgmq/actions/workflows/build.yml/badge.svg)](https://github.com/brianpursley/Npgmq/actions/workflows/build.yml) +[![Nuget](https://img.shields.io/nuget/v/Npgmq)](https://www.nuget.org/packages/Npgmq/) +![License](https://img.shields.io/github/license/brianpursley/Npgmq) + ## Compatibility -* pgmq >= 0.31.0 +| PGMQ Version | Compatibility | +|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 1.5.0+ | Fully supported | +| 0.31.0 - 1.4.5 | The following method overloads are *not* supported, since they were introduced in PGMQ 1.5.0:
- `SendAsync(string, T, DateTimeOffset)`
- `SendBatchAsync(string, IEnumerable, DateTimeOffset)` | ## Installation -To install the package via Nuget, run the following command: +To install the package via [Nuget](https://www.nuget.org/packages/Npgmq/), run the following command: -```bash +```shell dotnet add package Npgmq ```