Merge pull request #80063 from tfc/port-solr-test

nixosTests.solr: Port to python

authored by

worldofpeace and committed by
GitHub
a07a8b47 05f5786f

+29 -21
+29 -21
nixos/tests/solr.nix
··· 1 - import ./make-test.nix ({ pkgs, ... }: 1 + import ./make-test-python.nix ({ pkgs, ... }: 2 2 3 3 { 4 4 name = "solr"; ··· 21 21 }; 22 22 23 23 testScript = '' 24 - startAll; 24 + start_all() 25 25 26 - $machine->waitForUnit('solr.service'); 27 - $machine->waitForOpenPort('8983'); 28 - $machine->succeed('curl --fail http://localhost:8983/solr/'); 26 + machine.wait_for_unit("solr.service") 27 + machine.wait_for_open_port(8983) 28 + machine.succeed("curl --fail http://localhost:8983/solr/") 29 29 30 30 # adapted from pkgs.solr/examples/films/README.txt 31 - $machine->succeed('sudo -u solr solr create -c films'); 32 - $machine->succeed(q(curl http://localhost:8983/solr/films/schema -X POST -H 'Content-type:application/json' --data-binary '{ 33 - "add-field" : { 34 - "name":"name", 35 - "type":"text_general", 36 - "multiValued":false, 37 - "stored":true 38 - }, 39 - "add-field" : { 40 - "name":"initial_release_date", 41 - "type":"pdate", 42 - "stored":true 43 - } 44 - }')) =~ /"status":0/ or die; 45 - $machine->succeed('sudo -u solr post -c films ${pkgs.solr}/example/films/films.json'); 46 - $machine->succeed('curl http://localhost:8983/solr/films/query?q=name:batman') =~ /"name":"Batman Begins"/ or die; 31 + machine.succeed("sudo -u solr solr create -c films") 32 + assert '"status":0' in machine.succeed( 33 + """ 34 + curl http://localhost:8983/solr/films/schema -X POST -H 'Content-type:application/json' --data-binary '{ 35 + "add-field" : { 36 + "name":"name", 37 + "type":"text_general", 38 + "multiValued":false, 39 + "stored":true 40 + }, 41 + "add-field" : { 42 + "name":"initial_release_date", 43 + "type":"pdate", 44 + "stored":true 45 + } 46 + }' 47 + """ 48 + ) 49 + machine.succeed( 50 + "sudo -u solr post -c films ${pkgs.solr}/example/films/films.json" 51 + ) 52 + assert '"name":"Batman Begins"' in machine.succeed( 53 + "curl http://localhost:8983/solr/films/query?q=name:batman" 54 + ) 47 55 ''; 48 56 })