Нет описания

Lu Stadler 7cd3b8c5df Move request log printing into the log function лет назад: 7
..
.gitignore 13a196e694 Add a Makefile лет назад: 7
Makefile 13a196e694 Add a Makefile лет назад: 7
README.md 854ef1a76c Add a list of possible features/todos лет назад: 7
fake-http.go 7cd3b8c5df Move request log printing into the log function лет назад: 7
kubernetes.yaml 7de8915d24 Add sample response definition for kubernetes лет назад: 7

README.md

fake-http

TODO

  • support matching query strings
  • refactoring
  • /_clear endpoint
  • (randomized) delays
  • 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