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


                                            

           
                        


                                      
                                        


                                                   


      


                                               
                                                                  
 
                                                
 
                                
                       
                                                                                                
       
 
                                                
                                                                   
       
  
import ./make-test-python.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 =  ''
      start_all()
      machine.wait_for_unit("cadvisor.service")
      machine.succeed("curl -f http://localhost:8080/containers/")

      influxdb.wait_for_unit("influxdb.service")

      # create influxdb database
      influxdb.succeed(
          'curl -f -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE root"'
      )

      influxdb.wait_for_unit("cadvisor.service")
      influxdb.succeed("curl -f http://localhost:8080/containers/")
    '';
})