<commit_before># Test printing via CUPS.

import ./make-test.nix ({pkgs, ... }: {

  nodes = {

    server =
      { config, pkgs, ... }:
      { services.printing.enable = true;
        services.printing.cupsdConf =
          ''
            Listen server:631
            <Location />
              Order allow,deny
              Allow from all
            </Location>
          '';
        networking.firewall.allowedTCPPorts = [ 631 ];
      };

    client =
      { config, pkgs, nodes, ... }:
      { services.printing.enable = true;
      };

  };

  testScript =
    ''
      startAll;

      # Make sure that cups is up on both sides.
      $server->waitForUnit("cupsd.service");
      $client->waitForUnit("cupsd.service");
      $client->succeed("lpstat -r") =~ /scheduler is running/ or die;
      $client->succeed("lpstat -H") =~ "/var/run/cups/cups.sock" or die;
      $client->succeed("curl --fail http://localhost:631/");
      $client->succeed("curl --fail http://server:631/");
      $server->fail("curl --fail --connect-timeout 2  http://client:631/");

      # Add a HP Deskjet printer connected via USB to the server.
      $server->succeed("lpadmin -p DeskjetLocal -v usb://HP/Deskjet%205400%20series?serial=TH93I152S123XY -m 'drv:///sample.drv/deskjet.ppd' -E");

      # Add it to the client as well via IPP.
      $client->succeed("lpadmin -p DeskjetRemote -v ipp://server/printers/DeskjetLocal -m 'drv:///sample.drv/deskjet.ppd' -E");
      $client->succeed("lpadmin -d DeskjetRemote");

      # Do some status checks.
      $client->succeed("lpstat -a") =~ /DeskjetRemote accepting requests/ or die;<commit_msg>Hopefully fix random failure in cups test<commit_after># Test printing via CUPS.

import ./make-test.nix ({pkgs, ... }: {

  nodes = {

    server =
      { config, pkgs, ... }:
      { services.printing.enable = true;
        services.printing.cupsdConf =
          ''
            Listen server:631
            <Location />
              Order allow,deny
              Allow from all
            </Location>
          '';
        networking.firewall.allowedTCPPorts = [ 631 ];
      };

    client =
      { config, pkgs, nodes, ... }:
      { services.printing.enable = true;
      };

  };

  testScript =
    ''
      startAll;

      # Make sure that cups is up on both sides.
      $server->waitForUnit("cupsd.service");
      $server->waitForUnit("network.target");
      $client->waitForUnit("cupsd.service");
      $client->waitForUnit("network.target");
      $client->succeed("lpstat -r") =~ /scheduler is running/ or die;
      $client->succeed("lpstat -H") =~ "/var/run/cups/cups.sock" or die;
      $client->succeed("curl --fail http://localhost:631/");
      $client->succeed("curl --fail http://server:631/");
      $server->fail("curl --fail --connect-timeout 2  http://client:631/");

      # Add a HP Deskjet printer connected via USB to the server.
      $server->succeed("lpadmin -p DeskjetLocal -v usb://HP/Deskjet%205400%20series?serial=TH93I152S123XY -m 'drv:///sample.drv/deskjet.ppd' -E");

      # Add it to the client as well via IPP.
      $client->succeed("lpadmin -p DeskjetRemote -v ipp://server/printers/DeskjetLocal -m 'drv:///sample.drv/deskjet.ppd' -E");
      $client->succeed("lpadmin -d DeskjetRemote");

      # Do some status checks.
      $client->succeed("lpstat -a") =~ /DeskjetRemote accepting requests/ or die;
{'fraction_non_alphanumeric': 0.16037735849056603, 'fraction_numerical': 0.018867924528301886, 'mean_word_length': 2.2283539486203616, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1746447', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1100, 'n_words': 243}