vtest "#2831: Out of storage in cache_req_body"

server s1 {
	rxreq
	expect req.url == "/obj1"
	txresp -noserver -bodylen 1048400
} -start

vinyl v1 \
	-arg "-p nuke_limit=0" \
	-arg "-sTransient=default,1m" \
	-syntax 4.0 \
	-vcl+backend {
	import std;
	sub vcl_recv {
		if (req.method == "POST") {
			std.cache_req_body(1KB);
		}
	}
	sub vcl_backend_response {
		set beresp.do_stream = false;
		set beresp.storage = storage.Transient;
		# Unset Date header to not change the object sizes
		unset beresp.http.Date;
	}
} -start

vinyl v1 -cliok "param.set debug +syncvsl"

delay .1

client c1 {
	# Fill transient
	txreq -url "/obj1"
	rxresp
	expect resp.status == 200
} -run

delay .1

vinyl v1 -expect SM?.Transient.g_bytes > 1048400
vinyl v1 -expect SM?.Transient.g_space < 100

client c1 {
	# No space for caching this req.body
	txreq -req "POST" -body "foobar"
	delay 1
} -run

vinyl v1 -expect SM?.Transient.c_fail == 1

client c1 {
	# Check that Vinyl is still alive
	txreq -url "/obj1"
	rxresp
	expect resp.status == 200
} -run
