Skip to content

Commit

Permalink
Move integration test to flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerjanssen committed Mar 29, 2024
1 parent a579283 commit 96a65a2
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 80 deletions.
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
description = "NixOS tests example";

inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; };

outputs = { self, nixpkgs }: {
overlays.default = final: prev: {
haskellPackages = prev.haskellPackages.override {
overrides = self: prev: {
smtp-mail = self.callCabal2nix "smtp-mail" ./. { };
integration-test = self.callCabal2nix "integration-test"
./nix-integration-test/integration-test { };
};
};
};

checks.x86_64-linux.smtp-mail = let
pkgs = nixpkgs.legacyPackages.x86_64-linux.extend self.overlays.default;
certs =
import "${nixpkgs}/nixos/tests/common/acme/server/snakeoil-certs.nix";
in pkgs.nixosTest {
name = "smtp-mail";
nodes.machine = { config, pkgs, ... }: {
imports = [ "${nixpkgs}/nixos/tests/common/user-account.nix" ];
services.postfix = {
enable = true;
enableSubmission = true;
enableSubmissions = true;
tlsTrustedAuthorities = "${certs.ca.cert}";
sslCert = "${certs."acme.test".cert}";
sslKey = "${certs."acme.test".key}";
submissionOptions = {
smtpd_sasl_auth_enable = "yes";
smtpd_client_restrictions = "permit";
milter_macro_daemon_name = "ORIGINATING";
};
submissionsOptions = {
smtpd_sasl_auth_enable = "yes";
smtpd_client_restrictions = "permit";
milter_macro_daemon_name = "ORIGINATING";
};
};

security.pki.certificateFiles = [ certs.ca.cert ];

networking.extraHosts = ''
127.0.0.1 acme.test
'';

environment.systemPackages = [ pkgs.haskellPackages.integration-test ];
};

testScript = ''
machine.wait_for_unit("postfix.service")
machine.succeed("integration-test")
'';
};
};
}
55 changes: 0 additions & 55 deletions nix-integration-test/integration-test.nix

This file was deleted.

4 changes: 0 additions & 4 deletions nix-integration-test/nixpkgs-commit.nix

This file was deleted.

12 changes: 0 additions & 12 deletions nix-integration-test/nixpkgs.nix

This file was deleted.

9 changes: 0 additions & 9 deletions nix-integration-test/shell.nix

This file was deleted.

0 comments on commit 96a65a2

Please sign in to comment.