Нет описания

Lu Stadler 50a5c8eabf Don't panic when response is nil лет назад: 7
..
.gitignore 13a196e694 Add a Makefile лет назад: 7
Makefile 13a196e694 Add a Makefile лет назад: 7
README.md c66509a083 Remove outdated/unnecessary todo лет назад: 7
fake-http.go 50a5c8eabf Don't panic when response is nil лет назад: 7
kubernetes.yaml 60ab7f00d2 Show how redirects and query string matching work лет назад: 7

README.md

fake-http

fake-http pretends to be other HTTP APIs.

TODO

  • /_clear endpoint
  • some kind of templating (request info + random functions?)
  • lua integration? ;)

Example: Record and replay kubernetes traffic

This needs a running Minikube instance, which can be started with minikube start.

# shortcut for the cmdline below: fake-http -proxy-minikube
$ fake-http -proxy-url=https://$(minikube ip):8443 -proxy-client-cert ~/.minikube/client.crt -proxy-client-key ~/.minikube/client.key
2018/06/09 13:21:19 Listening on http://localhost:8080
2018/06/09 13:21:19 See http://localhost:8080/_help
...

# switch to another terminal

# set up "fake-minikube" context
$ kubectl set-cluster fake-minikube --server=http://localhost:8080
$ kubectl set-context fake-minikube --cluster=fake-minikube --user minikube

$ kubectl --context=fake-minikube get pods
NAME                         READY     STATUS    RESTARTS   AGE
hellogo-2387138299-p83qw     1/1       Running   2          266d
hellonode-1839943766-t2hsv   1/1       Running   2          266d

Now have a look at the requests kubectl made: http://localhost:8080.

Or, save the log and replay it later:

$ curl -H 'Accept: application/yaml' http://localhost:8080/_log > minikube.yaml

# replay later
$ fake-http minikube.yaml