watcher_test.go 689 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //go:build !nowatcher
  2. package caddy_test
  3. import (
  4. "net/http"
  5. "testing"
  6. "github.com/caddyserver/caddy/v2/caddytest"
  7. )
  8. func TestWorkerWithInactiveWatcher(t *testing.T) {
  9. tester := caddytest.NewTester(t)
  10. tester.InitServer(`
  11. {
  12. skip_install_trust
  13. admin localhost:2999
  14. http_port 9080
  15. frankenphp {
  16. worker {
  17. file ../testdata/worker-with-watcher.php
  18. num 1
  19. watch ./**/*.php
  20. }
  21. }
  22. }
  23. localhost:9080 {
  24. root ../testdata
  25. rewrite worker-with-watcher.php
  26. php
  27. }
  28. `, "caddyfile")
  29. tester.AssertGetResponse("http://localhost:9080", http.StatusOK, "requests:1")
  30. tester.AssertGetResponse("http://localhost:9080", http.StatusOK, "requests:2")
  31. }