Code

integration/query.sh: Check that empty commands work fine.
[sysdb.git] / t / integration / query.sh
index 72a0b88426adae7496deee4c9b4d8f6d7e845c02..46568569a57c307d9672a66472ce5f5456679ded 100755 (executable)
@@ -77,6 +77,10 @@ output="$( run_sysdb -H "$SOCKET_FILE" -c INVALID 2>&1 )" && exit 1
 echo "$output" | grep "Failed to parse query 'INVALID'"
 echo "$output" | grep "parse error: syntax error"
 
+# Empty query.
+output="$( run_sysdb -H "$SOCKET_FILE" -c '' )"
+test -z "$output"
+
 # Simple, successful commands.
 output="$( run_sysdb -H "$SOCKET_FILE" -c 'LIST hosts' )"
 echo "$output" \
@@ -118,7 +122,7 @@ echo "$output" | grep -F 'other.host.name' && exit 1
 echo "$output" | grep -F 'some.host.name' && exit 1
 
 output="$( run_sysdb -H "$SOCKET_FILE" \
-  -c "FETCH host 'host1.example.com' FILTER last_update < 0" 2>&1 )" \
+  -c "FETCH host 'host1.example.com' FILTER last_update < 0s" 2>&1 )" \
   && exit 1
 echo "$output" | grep -F 'not found'
 
@@ -126,7 +130,7 @@ echo "$output" | grep -F 'not found'
        | run_sysdb -H "$SOCKET_FILE"
 
 output="$( run_sysdb -H "$SOCKET_FILE" \
-       -c "FETCH host 'host1.example.com' FILTER age < 0" 2>&1 )" && exit 1
+       -c "FETCH host 'host1.example.com' FILTER age < 0s" 2>&1 )" && exit 1
 echo "$output" | grep -F 'not found'
 
 # When requesting information for unknown hosts, expect a non-zero exit code.