summary refs log blame commit diff
path: root/nixos/tests/cadvisor.nix
blob: e60bae4b7003382fc6d63d81c4cc7256d2b79839 (plain) (tree)
1
2
3
4
5
6
7
8
                                         
                    


                                            

           
                        


                                      
                                        


                                                   









                                                                  
 




                                                                                         


                                                                   
  
import ./make-test.nix ({ pkgs, ... } : {
  name = "cadvisor";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ offline ];
  };

  nodes = {
    machine = { ... }: {
      services.cadvisor.enable = true;
    };

    influxdb = { lib, ... }: with lib; {
      services.cadvisor.enable = true;
      services.cadvisor.storageDriver = "influxdb";
      services.influxdb.enable = true;
    };
  };

  testScript =
    ''
      startAll;
      $machine->waitForUnit("cadvisor.service");
      $machine->succeed("curl http://localhost:8080/containers/");

      $influxdb->waitForUnit("influxdb.service");

      # create influxdb database
      $influxdb->succeed(q~
        curl -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE root"
      ~);

      $influxdb->waitForUnit("cadvisor.service");
      $influxdb->succeed("curl http://localhost:8080/containers/");
    '';
})