coredns: fix externalPlugins by 'go mod vendor' after 'go generate'

- also add a nixos test that covers the external plugins case
This commit is contained in:
Johan Thomsen
2026-01-26 10:39:09 +01:00
parent df3a6e6d79
commit cf5a2b6456
3 changed files with 45 additions and 0 deletions

View File

@@ -407,6 +407,7 @@ in
containers-tmpfs = runTest ./containers-tmpfs.nix;
containers-unified-hierarchy = runTest ./containers-unified-hierarchy.nix;
convos = runTest ./convos.nix;
coredns = runTest ./coredns.nix;
corerad = runTest ./corerad.nix;
corteza = runTest ./corteza.nix;
cosmic = runTest {

42
nixos/tests/coredns.nix Normal file
View File

@@ -0,0 +1,42 @@
{ pkgs, ... }:
{
name = "coredns";
meta = with pkgs.lib.maintainers; {
maintainers = [ johanot ];
};
nodes.machine =
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.dnsutils ];
services.coredns = {
enable = true;
config = ''
.:10053 {
ipecho {
domain test.nixos.org
ttl 2629800
}
}
'';
package = pkgs.coredns.override {
externalPlugins = [
{
name = "ipecho";
repo = "github.com/Eun/coredns-ipecho";
version = "224170ebca45cc59c6b071d280a18f42d1ff130c";
position = "start-of-file";
}
];
vendorHash = "sha256-dNxHpXkiqz7B/JhZdxfZluIHFVXILlSm3XtB+v/EoMY=";
};
};
};
testScript = ''
machine.start()
machine.wait_for_unit("coredns.service")
machine.wait_for_open_port(10053)
machine.succeed("dig @127.0.0.1 -p 10053 127.0.0.2.test.nixos.org A +short | grep 127.0.0.2")
'';
}

View File

@@ -78,6 +78,7 @@ buildGoModule (finalAttrs: {
for src in ${toString (attrsToSources externalPlugins)}; do go get $src; done
go mod vendor
CC= GOOS= GOARCH= go generate
go mod vendor
go mod tidy
'';
@@ -134,6 +135,7 @@ buildGoModule (finalAttrs: {
'';
passthru.tests = {
coredns-external-plugins = nixosTests.coredns;
kubernetes-single-node = nixosTests.kubernetes.dns-single-node;
kubernetes-multi-node = nixosTests.kubernetes.dns-multi-node;
};