vtest "test ban lurker destination being completed by dup ban"

server s1 -repeat 4 -keepalive {
	rxreq
	txresp
} -start

vinyl v1 -vcl+backend {} -start

vinyl v1 -cliok "param.set ban_lurker_age 99"

# this ban becomes the pruned tail
vinyl v1 -cliok "ban obj.http.t == 1"
client c1 {
	txreq -url /1
	rxresp
} -run

# this ban becomes the new tail
vinyl v1 -cliok "ban obj.http.t == 2"
client c1 {
	txreq -url /2
	rxresp
} -run

# req ban to define where the tail goes (at t == 2)
vinyl v1 -cliok "ban req.http.barrier == here"
client c1 {
	txreq -url /3
	rxresp
} -run

# dup ban to trigger #3006
vinyl v1 -cliok "ban obj.http.t == 2"
client c1 {
	txreq -url /4
	rxresp
} -run

vinyl v1 -cliok "ban.list"

vinyl v1 -cliok "param.set ban_lurker_age 0.1"

vinyl v1 -cliok "ban.list"

delay 2

vinyl v1 -expect bans == 3
vinyl v1 -expect bans_completed == 2

vinyl v1 -cliok "ban.list"

vinyl v1 -expect bans == 3
vinyl v1 -expect bans_completed == 2
