include ../_common/Makefile.common

wait_start:
	for x in $$(seq $(STARTUPWAIT)); do \
	   if [ $$(docker compose logs | grep "failed=" | grep -v "failed=0" | wc -l) -gt 0 ]; then $(MAKE) wait_start_failed; exit 1; fi; \
	   if [ $$(curl -s http://pentest:pentest@127.0.0.3:60080/demo/thruk/cgi-bin/login.cgi | grep -c loginuser) -gt 0 ]; then break; else sleep 1; fi; \
	   if [ $$x -eq $(STARTUPWAIT) ]; then $(MAKE) wait_start_failed; exit 1; fi; \
	done

wait_start_failed_extra:
	-curl -kv http://127.0.0.3:60080/demo/thruk/cgi-bin/login.cgi

scan: wait_start
	docker compose exec $(DOCKER_COMPOSE_TTY) --user root arachni /test/t/test.sh

#extra_clean:
#	rm -rf results/*

test:
test_verbose:

web:
	@python -m webbrowser http://localhost:9292/
