tests: rework derivation stubbing
Instead of having to manually stub packages that should not be downloaded we instead automatically stub all packages (except a small list of whitelisted ones). Tests can re-introduce the real package by using the `realPkgs` module argument.
This commit is contained in:
parent
c5c2cbc866
commit
7a3f0b3b8d
480 changed files with 3557 additions and 5511 deletions
|
|
@ -1,95 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports = [ ../../accounts/email-test-accounts.nix ];
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"mbsync channels no longer use masterPattern. Use farPattern in its place."
|
||||
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
|
||||
];
|
||||
|
||||
config = {
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
# programs.mbsync.groups and
|
||||
# accounts.email.accounts.<name>.mbsync.groups should NOT be used at the
|
||||
# same time.
|
||||
# If they are, then the new version will take precedence.
|
||||
groups.inboxes = {
|
||||
"hm@example.com" = [ "Inbox1" "Inbox2" ];
|
||||
hm-account = [ "Inbox" ];
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = {
|
||||
"hm@example.com".mbsync = {
|
||||
enable = true;
|
||||
groups.inboxes = {
|
||||
channels = {
|
||||
inbox1 = {
|
||||
farPattern = "Inbox1";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
inbox2 = {
|
||||
farPattern = "Inbox2";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hm-account.mbsync = {
|
||||
enable = true;
|
||||
groups.hm-account = {
|
||||
channels.earlierPatternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
''"[Weird] Label?"''
|
||||
];
|
||||
};
|
||||
channels.inbox = {
|
||||
farPattern = "Inbox";
|
||||
nearPattern = "Inbox";
|
||||
};
|
||||
channels.strangeHostBoxName = {
|
||||
farPattern = "[Weird]/Label Mess";
|
||||
nearPattern = "[AnotherWeird]/Label";
|
||||
};
|
||||
channels.patternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
''"[Weird] Label?"''
|
||||
];
|
||||
};
|
||||
};
|
||||
# No group should be printed.
|
||||
groups.emptyGroup = { };
|
||||
# Group should be printed, but left with default channels.
|
||||
groups.emptyChannels = {
|
||||
channels.empty1 = { };
|
||||
channels.empty2 = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"mbsync channels no longer use masterPattern. use farPattern in its place."
|
||||
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
|
||||
];
|
||||
|
||||
test.stubs.isync = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.mbsyncrc
|
||||
assertFileContent home-files/.mbsyncrc ${./mbsync-expected.conf}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -1,86 +1,72 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports = [ ../../accounts/email-test-accounts.nix ];
|
||||
|
||||
config = {
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
# programs.mbsync.groups and
|
||||
# accounts.email.accounts.<name>.mbsync.groups should NOT be used at the
|
||||
# same time.
|
||||
# If they are, then the new version will take precedence.
|
||||
groups.inboxes = {
|
||||
"hm@example.com" = [ "Inbox1" "Inbox2" ];
|
||||
hm-account = [ "Inbox" ];
|
||||
};
|
||||
programs.mbsync = {
|
||||
enable = true;
|
||||
# programs.mbsync.groups and
|
||||
# accounts.email.accounts.<name>.mbsync.groups should NOT be used at the
|
||||
# same time.
|
||||
# If they are, then the new version will take precedence.
|
||||
groups.inboxes = {
|
||||
"hm@example.com" = [ "Inbox1" "Inbox2" ];
|
||||
hm-account = [ "Inbox" ];
|
||||
};
|
||||
|
||||
accounts.email.accounts = {
|
||||
"hm@example.com".mbsync = {
|
||||
enable = true;
|
||||
extraConfig.account.TLSVersions = [ "+1.3" "+1.2" "-1.1" ];
|
||||
groups.inboxes = {
|
||||
channels = {
|
||||
inbox1 = {
|
||||
farPattern = "Inbox1";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
inbox2 = {
|
||||
farPattern = "Inbox2";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hm-account.mbsync = {
|
||||
enable = true;
|
||||
groups.hm-account = {
|
||||
channels.earlierPatternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
''"[Weird] Label?"''
|
||||
];
|
||||
};
|
||||
channels.inbox = {
|
||||
farPattern = "Inbox";
|
||||
nearPattern = "Inbox";
|
||||
};
|
||||
channels.strangeHostBoxName = {
|
||||
farPattern = "[Weird]/Label Mess";
|
||||
nearPattern = "[AnotherWeird]/Label";
|
||||
};
|
||||
channels.patternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns = [
|
||||
"ThingUnderLabel"
|
||||
"!NotThisMaildirThough"
|
||||
''"[Weird] Label?"''
|
||||
];
|
||||
};
|
||||
};
|
||||
# No group should be printed.
|
||||
groups.emptyGroup = { };
|
||||
# Group should be printed, but left with default channels.
|
||||
groups.emptyChannels = {
|
||||
channels.empty1 = { };
|
||||
channels.empty2 = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.isync = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/isyncrc
|
||||
assertFileContent home-files/.config/isyncrc ${./mbsync-expected.conf}
|
||||
'';
|
||||
};
|
||||
|
||||
accounts.email.accounts = {
|
||||
"hm@example.com".mbsync = {
|
||||
enable = true;
|
||||
extraConfig.account.TLSVersions = [ "+1.3" "+1.2" "-1.1" ];
|
||||
groups.inboxes = {
|
||||
channels = {
|
||||
inbox1 = {
|
||||
farPattern = "Inbox1";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
inbox2 = {
|
||||
farPattern = "Inbox2";
|
||||
nearPattern = "Inboxes";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hm-account.mbsync = {
|
||||
enable = true;
|
||||
groups.hm-account = {
|
||||
channels.earlierPatternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns =
|
||||
[ "ThingUnderLabel" "!NotThisMaildirThough" ''"[Weird] Label?"'' ];
|
||||
};
|
||||
channels.inbox = {
|
||||
farPattern = "Inbox";
|
||||
nearPattern = "Inbox";
|
||||
};
|
||||
channels.strangeHostBoxName = {
|
||||
farPattern = "[Weird]/Label Mess";
|
||||
nearPattern = "[AnotherWeird]/Label";
|
||||
};
|
||||
channels.patternMatch = {
|
||||
farPattern = "Label";
|
||||
nearPattern = "SomethingUnderLabel";
|
||||
patterns =
|
||||
[ "ThingUnderLabel" "!NotThisMaildirThough" ''"[Weird] Label?"'' ];
|
||||
};
|
||||
};
|
||||
# No group should be printed.
|
||||
groups.emptyGroup = { };
|
||||
# Group should be printed, but left with default channels.
|
||||
groups.emptyChannels = {
|
||||
channels.empty1 = { };
|
||||
channels.empty2 = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/isyncrc
|
||||
assertFileContent home-files/.config/isyncrc ${./mbsync-expected.conf}
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue