Skip to content

Commit

Permalink
can we reach k2server if nginx is running
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Jan 24, 2024
1 parent 2845dfb commit 09015b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/k2server.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ def do_GET(self):


if __name__ == '__main__':
s = HTTPServer(('app.kolide.test', 80), K2MockServer)
s = HTTPServer(('0.0.0.0', 8080), K2MockServer)
s.serve_forever()
13 changes: 6 additions & 7 deletions tests/kolide-launcher.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,20 @@ pkgs.nixosTest {

system.stateVersion = "23.11";

virtualisation.vlans = [ 1 ];
networking.firewall.enable = false;
networking.dhcpcd.enable = false;
networking.useDHCP = false;
networking.interfaces.eth1.ipv4.addresses = [ { address = "192.168.1.1"; prefixLength = 24; } ];
networking.extraHosts = "192.168.1.2 app.kolide.test";
};

k2server = { config, pkgs, ... }: {
virtualisation.vlans = [ 1 ];
networking.firewall.allowedTCPPorts = [ 80 ];
networking.dhcpcd.enable = false;
networking.useDHCP = false;
networking.interfaces.eth1.ipv4.addresses = [ { address = "192.168.1.2"; prefixLength = 24; } ];
networking.extraHosts = "127.0.0.1 app.kolide.test";

services.nginx = {
enable = true;
virtualHosts."k2server" = {};
};

systemd.services.mock-k2-server = {
description = "Mock K2 server (device and control)";
serviceConfig.Type = "simple";
Expand Down Expand Up @@ -94,6 +92,7 @@ pkgs.nixosTest {
# Ensure machine can reach mock k2 server
machine.wait_for_unit("network-online.target")
client.succeed("curl http://k2server/")
machine.succeed("nc -v -z 192.168.1.2 80")
machine.wait_until_succeeds("curl --fail http://app.kolide.test/version", timeout=60)
Expand Down

0 comments on commit 09015b0

Please sign in to comment.