Commit cf5a2b64 authored by Johan Thomsen's avatar Johan Thomsen
Browse files

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

- also add a nixos test that covers the external plugins case
parent df3a6e6d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
{ 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")
  '';
}
+2 −0
Original line number Diff line number Diff line
@@ -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;
  };