Merge pull request #250843 from RaitoBezarius/listmonk

authored by

Ryan Lahfa and committed by
GitHub
4fb9aeae e0ef2f29

+29 -15
+1 -1
nixos/tests/all-tests.nix
··· 434 434 lightdm = handleTest ./lightdm.nix {}; 435 435 lighttpd = handleTest ./lighttpd.nix {}; 436 436 limesurvey = handleTest ./limesurvey.nix {}; 437 - listmonk = handleTest ./listmonk.nix {}; 437 + listmonk = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./listmonk.nix {}; 438 438 litestream = handleTest ./litestream.nix {}; 439 439 lldap = handleTest ./lldap.nix {}; 440 440 locate = handleTest ./locate.nix {};
+15 -8
nixos/tests/listmonk.nix
··· 42 42 machine.wait_for_open_port(9000) 43 43 machine.succeed("[[ -f /var/lib/listmonk/.db_settings_initialized ]]") 44 44 45 + assert json.loads(machine.succeed(generate_listmonk_request("GET", 'health')))['data'], 'Health endpoint returned unexpected value' 46 + 47 + # A sample subscriber is guaranteed to exist at install-time 48 + # A sample transactional template is guaranteed to exist at install-time 49 + subscribers = json.loads(machine.succeed(generate_listmonk_request('GET', "subscribers")))['data']['results'] 50 + templates = json.loads(machine.succeed(generate_listmonk_request('GET', "templates")))['data'] 51 + tx_template = templates[2] 52 + 45 53 # Test transactional endpoint 46 - # subscriber_id=1 is guaranteed to exist at install-time 47 - # template_id=2 is guaranteed to exist at install-time and is a transactional template (1 is a campaign template). 48 - machine.succeed( 49 - generate_listmonk_request('POST', 'tx', data={'subscriber_id': 1, 'template_id': 2}) 50 - ) 51 - assert 'Welcome John Doe' in machine.succeed( 54 + print(machine.succeed( 55 + generate_listmonk_request('POST', 'tx', data={'subscriber_id': subscribers[0]['id'], 'template_id': tx_template['id']}) 56 + )) 57 + 58 + assert 'Welcome Anon Doe' in machine.succeed( 52 59 "curl --fail http://localhost:8025/api/v2/messages" 53 - ) 60 + ), "Failed to find Welcome John Doe inside the messages API endpoint" 54 61 55 62 # Test campaign endpoint 56 63 # Based on https://github.com/knadh/listmonk/blob/174a48f252a146d7e69dab42724e3329dbe25ebe/cmd/campaigns.go#L549 as docs do not exist. 57 64 campaign_data = json.loads(machine.succeed( 58 - generate_listmonk_request('POST', 'campaigns/1/test', data={'template_id': 1, 'subscribers': ['john@example.com'], 'name': 'Test', 'subject': 'NixOS is great', 'lists': [1], 'messenger': 'email'}) 65 + generate_listmonk_request('POST', 'campaigns/1/test', data={'template_id': templates[0]['id'], 'subscribers': ['john@example.com'], 'name': 'Test', 'subject': 'NixOS is great', 'lists': [1], 'messenger': 'email'}) 59 66 )) 60 67 61 68 assert campaign_data['data'] # This is a boolean asserting if the test was successful or not: https://github.com/knadh/listmonk/blob/174a48f252a146d7e69dab42724e3329dbe25ebe/cmd/campaigns.go#L626
+11 -4
pkgs/servers/mail/listmonk/default.nix
··· 1 - { lib, buildGoModule, fetchFromGitHub, callPackage, stuffbin, nixosTests }: 1 + { lib, buildGoModule, fetchFromGitHub, callPackage, stuffbin, nixosTests, fetchpatch }: 2 2 3 3 buildGoModule rec { 4 4 pname = "listmonk"; 5 - version = "2.2.0"; 5 + version = "2.5.1"; 6 6 7 7 src = fetchFromGitHub { 8 8 owner = "knadh"; 9 9 repo = "listmonk"; 10 10 rev = "v${version}"; 11 - sha256 = "sha256-dtIM0dkr8y+GbyCqrBlR5VRq6qMiZdmQyFvIoVY1eUg="; 11 + sha256 = "sha256-gCnIblc83CmG1auvYYxqW/xBl6Oy1KHGkqSY/3yIm3I="; 12 12 }; 13 13 14 - vendorSha256 = "sha256-qeBuDM3REUxgu3ty02d7qsULH04USE0JUvBrtVnW8vg="; 14 + patches = [ 15 + (fetchpatch { 16 + url = "https://github.com/knadh/listmonk/pull/1479.patch"; 17 + hash = "sha256-SYACM8r+NgeSWn9VJV4+wkm+6s/MhNGwn5zyc2tw7FU="; 18 + }) 19 + ]; 20 + 21 + vendorSha256 = "sha256-0sgC1+ueZTUCP+7JwI/OKLktfMHQq959GEk1mC0TQgE="; 15 22 16 23 nativeBuildInputs = [ 17 24 stuffbin
+2 -2
pkgs/servers/mail/listmonk/frontend.nix
··· 5 5 6 6 yarn2nix-moretea.mkYarnPackage rec { 7 7 pname = "listmonk-frontend"; 8 - version = "2.2.0"; 8 + version = "2.5.1"; 9 9 10 10 src = fetchFromGitHub { 11 11 owner = "knadh"; 12 12 repo = "listmonk"; 13 13 rev = "v${version}"; 14 - sha256 = "sha256-dtIM0dkr8y+GbyCqrBlR5VRq6qMiZdmQyFvIoVY1eUg="; 14 + sha256 = "sha256-gCnIblc83CmG1auvYYxqW/xBl6Oy1KHGkqSY/3yIm3I="; 15 15 }; 16 16 17 17 packageJSON = ./package.json;