Something went wrong. Try again.
fork of hydrant
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233#!/usr/bin/env nuuse common.nu *
def main [] { let port = resolve-test-port 3022 let url = $"http://localhost:($port)" let db_path = (mktemp -d -t hydrant_api_db.XXXXXX) let binary = build-hydrant let instance = (with-env { HYDRANT_CRAWLER_URLS: "" HYDRANT_RELAY_HOSTS: "" } { start-hydrant $binary $db_path $port })
if not (wait-for-api $url) { fail "hydrant did not start" $instance.pid }
http post -f -e -H [Content-Length 0] $"($url)/db/compact" "" | assert-status 200 "POST /db/compact" $instance.pid let train = ( http post -f -e -H [Content-Length 0] $"($url)/db/train" "" ) $train | assert-status 500 "POST /db/train without samples" $instance.pid if not ($train.body | str contains "no samples found") { fail "POST /db/train did not explain that training requires samples" $instance.pid }
try { kill $instance.pid } print "database maintenance endpoints passed!"}