Code Monkey home page Code Monkey logo

vaurien's People

Contributors

abrarsheikh avatar almet avatar crankycoder avatar deanwilson avatar ethan-eb avatar jsbueno avatar jterrace avatar leandromoreira avatar lukebakken avatar manuel-sugawara avatar marcelometal avatar mwhooker avatar rfk avatar tajindes avatar tandiapa avatar tarekziade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vaurien's Issues

REST api to change the state of proxies does not seem stable

I've automated the use of vaurien for ichnaea and I'm seeing problems with switching proxies for redis and mysql between 3 states: dummy, delay and blackout.

If I run my ichnaea testcases individually, things seem to work.

If I run all my tests together, the vaurien proxies do not seem to transition state properly.

In practice, I need to setup and teardown my vaurien proxies for each test method.

Test cases are located here: https://github.com/crankycoder/ichnaea/tree/travis_ci

Proposal to support finer grained behavior control

I'm considering implementing a new HTTP behavior that would make vaurien capable of finer-grained error case simulation, which we could use for deeper integration testing of gsutil - for example, rather than just randomly picking a 5xx error code x% of the time, I'd like to be able to configure the proxy to pass (say) 100KB without errors, then send a particular error code, then pass the rest of the upload/download without errors. Or more complicated sequences, like 100KB without errors, then a code that forces gsutil to start the upload/download over from scratch, then (after the restart) 200KB without errors followed by an error code that requires retrying but starting at the same offset, and then the rest without errors - etc.

I'm thinking the config could be specified using a JSON object such as:
{ traffic_spec: [ pass: 100k, error: {code:503, text: "slow down"}, pass: * ] }

In the future someone could extend this functionality to mix in other behaviors (e.g., so that while bytes are being passed delays or packet drops are included).

What do you think of this idea?

pip install vaurien fails and breaks pip on Ubuntu 12.04

Hi,

I'm trying to install vaurien on 12.04, and when I do, it fails, and also seems to delete some files that pip depends on. The log is below. Any idea what I'm doing wrong?

sudo pip install --upgrade vaurien
Downloading/unpacking vaurien
Running setup.py egg_info for package vaurien

Downloading/unpacking cornice (from vaurien)
Running setup.py egg_info for package cornice
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'paster_plugins'
warnings.warn(msg)

Downloading/unpacking gevent (from vaurien)
Running setup.py egg_info for package gevent

Downloading/unpacking statsd-client (from vaurien)
Downloading statsd-client-1.0.4.tar.gz
Running setup.py egg_info for package statsd-client

Downloading/unpacking vaurienclient (from vaurien)
Downloading vaurienclient-1.1.tar.gz
Running setup.py egg_info for package vaurienclient
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
warnings.warn(msg)

Downloading/unpacking greenlet (from vaurien)
Running setup.py egg_info for package greenlet

Downloading/unpacking http-parser (from vaurien)
Running setup.py egg_info for package http-parser

Downloading/unpacking pyramid (from cornice->vaurien)
Running setup.py egg_info for package pyramid

Downloading/unpacking simplejson (from cornice->vaurien)
Running setup.py egg_info for package simplejson

Downloading/unpacking requests>=1.1 (from vaurienclient->vaurien)
Running setup.py egg_info for package requests

Downloading/unpacking distribute (from pyramid->cornice->vaurien)
Running setup.py egg_info for package distribute

Downloading/unpacking WebOb>=1.2b3 (from pyramid->cornice->vaurien)
Running setup.py egg_info for package WebOb

no previously-included directories found matching '*.pyc'
no previously-included directories found matching '*.pyo'

Downloading/unpacking repoze.lru>=0.4 (from pyramid->cornice->vaurien)
Downloading repoze.lru-0.6.tar.gz
Running setup.py egg_info for package repoze.lru

Downloading/unpacking zope.interface>=3.8.0 (from pyramid->cornice->vaurien)
Running setup.py egg_info for package zope.interface

warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution

Downloading/unpacking zope.deprecation>=3.5.0 (from pyramid->cornice->vaurien)
Downloading zope.deprecation-4.0.2.tar.gz
Running setup.py egg_info for package zope.deprecation

Downloading/unpacking venusian>=1.0a3 (from pyramid->cornice->vaurien)
Running setup.py egg_info for package venusian

Downloading/unpacking translationstring>=0.4 (from pyramid->cornice->vaurien)
Downloading translationstring-1.1.tar.gz
Running setup.py egg_info for package translationstring

no previously-included directories found matching 'docs/_build'

Downloading/unpacking PasteDeploy>=1.5.0 (from pyramid->cornice->vaurien)
Downloading PasteDeploy-1.5.0.tar.gz
Running setup.py egg_info for package PasteDeploy

Downloading/unpacking setuptools>=0.7 (from distribute->pyramid->cornice->vaurien)
Running setup.py egg_info for package setuptools

Installing collected packages: vaurien, cornice, gevent, statsd-client, vaurienclient, greenlet, http-parser, pyramid, simplejson, requests, distribute, WebOb, repoze.lru, zope.interface, zope.deprecation, venusian, translationstring, PasteDeploy, setuptools
Running setup.py install for vaurien

Installing vaurien script to /usr/local/bin
Installing meta-vaurien script to /usr/local/bin

Running setup.py install for cornice
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'paster_plugins'
warnings.warn(msg)

Running setup.py install for gevent
building 'gevent.core' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c gevent/core.c -o build/temp.linux-x86_64-2.7/gevent/core.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/gevent/core.o -levent -o build/lib.linux-x86_64-2.7/gevent/core.so
Linking /home/martin/build/gevent/build/lib.linux-x86_64-2.7/gevent/core.so to /home/martin/build/gevent/gevent/core.so

Running setup.py install for statsd-client

Running setup.py install for vaurienclient
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
warnings.warn(msg)

Installing vaurienctl script to /usr/local/bin

Running setup.py install for greenlet
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -fno-tree-dominator-opts -I/usr/include/python2.7 -c /tmp/tmp4M8BwG/simple.c -o /tmp/tmp4M8BwG/tmp/tmp4M8BwG/simple.o
/tmp/tmp4M8BwG/simple.c:1:6: warning: function declaration isn't a prototype [-Wstrict-prototypes]
building 'greenlet' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -fno-tree-dominator-opts -I/usr/include/python2.7 -c greenlet.c -o build/temp.linux-x86_64-2.7/greenlet.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/greenlet.o -o build/lib.linux-x86_64-2.7/greenlet.so
Linking /home/martin/build/greenlet/build/lib.linux-x86_64-2.7/greenlet.so to /home/martin/build/greenlet/greenlet.so

Running setup.py install for http-parser
building 'http_parser.parser' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iparser -I/usr/include/python2.7 -c http_parser/http_parser.c -o build/temp.linux-x86_64-2.7/http_parser/http_parser.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iparser -I/usr/include/python2.7 -c http_parser/parser.c -o build/temp.linux-x86_64-2.7/http_parser/parser.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/http_parser/http_parser.o build/temp.linux-x86_64-2.7/http_parser/parser.o -o build/lib.linux-x86_64-2.7/http_parser/parser.so
Linking /home/martin/build/http-parser/build/lib.linux-x86_64-2.7/http_parser/parser.so to /home/martin/build/http-parser/http_parser/parser.so

Running setup.py install for pyramid

Installing ptweens script to /usr/local/bin
Installing pdistreport script to /usr/local/bin
Installing proutes script to /usr/local/bin
Installing pshell script to /usr/local/bin
Installing prequest script to /usr/local/bin
Installing pviews script to /usr/local/bin
Installing pcreate script to /usr/local/bin
Installing pserve script to /usr/local/bin

Running setup.py install for simplejson
building 'simplejson._speedups' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c simplejson/_speedups.c -o build/temp.linux-x86_64-2.7/simplejson/_speedups.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/simplejson/_speedups.o -o build/lib.linux-x86_64-2.7/simplejson/_speedups.so

Running setup.py install for requests

Found existing installation: distribute 0.6.24dev-r0
Uninstalling distribute:
Successfully uninstalled distribute
Running setup.py install for distribute

Running setup.py install for WebOb
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named setuptools
Complete output from command /usr/bin/python -c "import setuptools;file='/home/martin/build/WebOb/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-tf9FT1-record/install-record.txt:
Traceback (most recent call last):

File "", line 1, in

ImportError: No module named setuptools


Command /usr/bin/python -c "import setuptools;file='/home/martin/build/WebOb/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-tf9FT1-record/install-record.txt failed with error code 1
Storing complete log in /home/martin/.pip/pip.log
Script complete
martin@ubuntu:~$ pip --help
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

Allow choosing list of HTTP codes vaurien.behaviors.error.Error uses

First: Thanks for this monkey! Writing fault-tolerant services is fun again!

However:

https://github.com/mozilla-services/vaurien/blob/master/vaurien/behaviors/error.py

isn't particularly configurable or extension-friendly. I'd like to choose the list of http error codes (perhaps by subclassing the behavior).

BTW: Docs aren't telling me how to add a custom behaviour once I have written one. How do I tell the vaurien-command to Behavior.register() it ? Some entry_point magic ? Is there an example maybe ?

so long,

redis protocol seems to have problems with delay behavior

I'm seeing this problem when using vaurien with mozilla ichnaea. gevent seems to be yelling at me, but I can see data going into my database -so the delay seems to be working - vaurien is just throwing messages to stderr or stdout for some reason.

I'm running vaurien with:

vaurien --proxy 0.0.0.0:9379  --backend 0.0.0.0:6379 --protocol redis --behavior 100:delay --behavior-delay-sleep 1

Here's the traceback:

Traceback (most recent call last):
  File "/Users/victorng/.virtualenvs/ichnaea/lib/python2.7/site-packages/gevent-1.0-py2.7-macosx-10.9-intel.egg/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/Users/victorng/.virtualenvs/ichnaea/lib/python2.7/site-packages/vaurien-1.8-py2.7.egg/vaurien/proxy.py", line 116, in handle
    res = [green.get() for green in greens]
  File "/Users/victorng/.virtualenvs/ichnaea/lib/python2.7/site-packages/gevent-1.0-py2.7-macosx-10.9-intel.egg/gevent/greenlet.py", line 274, in get
    raise self._exception
NotImplementedError
<Greenlet at 0x10185c0f0: <bound method RandomProxy.handle of <RandomProxy at 0x101822a90 fileno=5 address=0.0.0.0:9379>>(<socket at 0x101850ed0 fileno=[Errno 9] Bad file d, ('127.0.0.1', 49621))> failed with NotImplementedError

Unable to start on Windows

Hi, seen your presentation FOSDEM, wanted to try it, but:

Uses fcntl, does not run on Windows:

Python\2.6.6\lib\site-packages\vaurien-1.5-py2.6.egg\vaurien\run.py", line 1, in

import fcntl
ImportError: No module named fcntl

I have tried to remove the dependency but still unable to run, unfortunately network programming is not my area, anyway, I am able to run it in a VM :D so thx and good luck with all your projects!

An 'https' protocol would be amazing

We use vaurien to test defensive coding mechanisms around 3rd party services. Often times, those 3rd party services are only available over HTTPS. While I did finally find a way to do HTTPS over the tcp behavior:

vaurien --stay-connected --proxy 0.0.0.0:8443 \
 --backend www.example.com:443 --protocol-tcp-keep-alive

However, by using TCP instead of HTTP we lose the ability to set the host header and return 500 error codes when using the error behavior.

I'm guessing this isn't a trivial thing to do, but if vaurien could act as a mitm (man-in-the-middle) ssl proxy, we'd have everything we'd need.

Perhaps some of the work over https://github.com/philmayers/txsslmitm would help?

Generalize --behavior-error-warmup

For example, I'm using websockets for a protocol, and I want the first few (TCP backend) packets to go through so that server and client finish their application level handshake. But after that I want the hang behaviour to kick in and stall all further communication.

Maybe just --behavior-warmup=10 and the behaviour kicks in after 10 reads or something?

http protocol and buffer

vaurien fails when the data is bigger than the buffer size with ES. workaround is to use a big buffer but we need to fix this

Add handlers to deal with HTTP-level details

Right now, the behavior interface deals with sockets, which puts a lot of additional complexity onto the implementor when only wanting to deal with HTTP level things.

My use case is: I have an app that uses local storage as a read-through cache where we return the stale data initially, then refresh it with an async RPC.

I'm having difficulty reproducing caching errors because my local development server is too fast and the refreshing RPC returns at the same time as the localStorage results return. I need to slow down queries to specific endpoints in my app. Ideally, my code would look something like:

import gevent
from vaurien.behaviors import Behavior
from vaurien.behaviors.delay import Delay

class SlowQueryBehavior(Delay):
    """Slows down queries to the backend denoted by being ending in `.json`."""
    name = 'slow_query'
    options = {
        "to_match": ("File ending to match", str, ".json")
    }
    options.update(Delay.options)

    def on_before_http_handle(self, source, backend):
        ext = self.option('to_match')
        if source.endpoint[-len(ext):] == ext:
            gevent.sleep(self.option('sleep'))
        return True

Behavior.register(SlowQueryBehavior)


if __name__ == '__main__':
    # run from command line.
    import sys
    from vaurien.run import main
    main()

As it works now, I'll need to handle reading out of a socket, parsing the HTTP bits to make my decision, then forward it along fixing the drained socket.

Config file is useless

Because all settings is overwritten by default ones.

See (as for master at 835ac57) run.py

Line 130:
(Pdb) print args
Namespace(backend='localhost:80', backlog=8192, behavior='100:dummy', behavior_delay_before=True, behavior_delay_sleep=1, behavior_error_inject=False, behavior_error_warmup=0, bufsize=8192, config='../vaurein.conf', http=False, http_host='localhost', http_port=8080, loglevel='info', logoutput='-', pool_max_size=100, pool_timeout=30, protocol='tcp', protocol_http_buffer=8124, protocol_http_keep_alive=False, protocol_http_reuse_socket=False, protocol_memcache_buffer=8124, protocol_memcache_keep_alive=False, protocol_memcache_reuse_socket=False, protocol_mysql_buffer=8124, protocol_mysql_reuse_socket=False, protocol_redis_buffer=8124, protocol_redis_keep_alive=False, protocol_redis_reuse_socket=False, protocol_smtp_buffer=8124, protocol_smtp_reuse_socket=False, protocol_tcp_buffer=8124, protocol_tcp_keep_alive=False, protocol_tcp_reuse_socket=False, proxy='localhost:8000', statsd.enabled=False, statsd.host='localhost', statsd.port=8125, statsd.prefix='vaurien', statsd.sample_rate=1.0, stay_connected=False, sync=False, timeout=30, version=False)

backend is already in args, because it is in default_settings

This is my settings after parsing config

Line 147:
(Pdb) print settings
{'statsd.enabled': False, 'vaurien.behavior': '100:normal', 'statsd.host': 'localhost', 'vaurien.proxy': 'localhost:8000', 'vaurien.timeout': 30, 'vaurien.bufsize': 8192, 'vaurien.sync': False, 'vaurien.stay_connected': False, 'vaurien.protocol': 'tcp', 'vaurien.pool_timeout': 30, 'statsd.sample_rate': 1.0, 'statsd.prefix': 'vaurien', 'vaurien.backend': '19.20.21.22:5432', 'config': <vaurien.config.Config instance at 0x7f92e832add0>, 'statsd.port': 8125, 'vaurien.backlog': 8192, 'vaurien.pool_max_size': 100}

But after merge backend = 19.20.21.22:5432 is lost (on line 162), because it is already in args.

Not able to configure the Vaurien behaviour

Hi,
I tried to install vaurien on my application maching and tried to add delay in backend request. I am not able to observe the delay in back end application. Please suggest.

Steps :

  1. Install vaurien on application machine.: pip install vaurien
  2. run the command to add delay :
    vaurien --protocol http --proxy localhost:8000 --backend systemtestingteam-b-back.sqa.mykronos.internal:80 --behavior 100:delay --behavior-delay-sleep 100
  3. result :

"2017-03-31 09:24:48 [14926] [INFO] Starting the Chaos TCP Server
2017-03-31 09:24:48 [14926] [INFO] Options:
2017-03-31 09:24:48 [14926] [INFO] * proxies from localhost:8000 to systemtesting-b-back.int.sqa.mykronos.com:80
2017-03-31 09:24:48 [14926] [INFO] * timeout: 30
2017-03-31 09:24:48 [14926] [INFO] * stay_connected: 0
2017-03-31 09:24:48 [14926] [INFO] * pool_max_size: 100
2017-03-31 09:24:48 [14926] [INFO] * pool_timeout: 30
2017-03-31 09:24:48 [14926] [INFO] * async_mode: 1"

  1. when access the back end application , not observe any type of delay to access the application

Note : "systemtesting-b-back.int.sqa.mykronos.com:80" is my backend application and running the vaurien on my front end application.

Error message ordering is wrong

If the argument to --behavior is invalid, vaurien errors

ValueError: You need to use name:percentage

when the actual syntax is percentage:name

select() timeout & socket strategy

Depending on the protocol we might drop the backend socket after a timeout has occured on select() - and we want the timeout configurable

We also want to keep the socket on HTTP keep-alive connections

single http bridge

On a box with several Vaurien proxies, it would be great if we could launch a single http server to drive them all

Support for warmup in error

Would it be possible to use warmup without random data injection?
Ex. run the backend fine for X number of requests and first then start failing the requests.

vaurien --protocol http --proxy dev-webnyh6:8001 --backend dev.backend:80 --behavior 50:error --behavior-error-warmup 100
"Run 100 requests fine and then start failing requests 50%"
This command doesnt seem to do it:
$ while true; do curl -s -i 'http://192.168.30.165:8001/' | head -15 | grep HTTP && sleep 1s;done
HTTP/1.1 200 OK
HTTP/1.1 200 OK
Binary file (standard input) matches
Binary file (standard input) matches
HTTP/1.1 501 Not Implemented
HTTP/1.1 503 Service Unavailable
Binary file (standard input) matches
HTTP/1.1 501 Not Implemented
HTTP/1.1 501 Not Implemented
Binary file (standard input) matches
Binary file (standard input) matches
HTTP/1.1 500 Internal Server Error
Binary file (standard input) matches
HTTP/1.1 502 Bad Gateway
HTTP/1.1 502 Bad Gateway
Binary file (standard input) matches
HTTP/1.1 500 Internal Server Error
HTTP/1.1 503 Service Unavailable
Binary file (standard input) matches
HTTP/1.1 500 Internal Server Error
HTTP/1.1 503 Service Unavailable
HTTP/1.1 501 Not Implemented
HTTP/1.1 500 Internal Server Error
HTTP/1.1 200 OK
HTTP/1.1 501 Not Implemented
HTTP/1.1 502 Bad Gateway
Binary file (standard input) matches
HTTP/1.1 503 Service Unavailable
Binary file (standard input) matches

Gevent raises timeout

Environment:

$ python --version
Python 2.7.11

$ uname -a
Linux brahms 4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016 x86_64 GNU/Linux

$ pip list
cornice (1.2.0)
gevent (1.1.0)
greenlet (0.4.9)
http-parser (0.8.3)
PasteDeploy (1.5.2)
pip (8.1.0)
pyramid (1.6.1)
repoze.lru (0.6)
requests (2.9.1)
setuptools (20.2.2)
simplejson (3.8.2)
statsd-client (1.0.4)
translationstring (1.3)
vaurien (1.9)
vaurienclient (1.1)
venusian (1.0)
virtualenv (15.0.0)
WebOb (1.5.1)
wheel (0.29.0)
zope.deprecation (4.1.2)
zope.interface (4.1.3)

Command:

$ vaurien --protocol http --proxy 0.0.0.0:8080 --backend www.bakken.io:80 --behavior 100:dummy
2016-03-13 18:07:00 [40688] [INFO] Starting the Chaos TCP Server
2016-03-13 18:07:00 [40688] [INFO] Options:
2016-03-13 18:07:00 [40688] [INFO] * proxies from 0.0.0.0:8080 to www.bakken.io:80
2016-03-13 18:07:00 [40688] [INFO] * timeout: 30
2016-03-13 18:07:00 [40688] [INFO] * stay_connected: 0
2016-03-13 18:07:00 [40688] [INFO] * pool_max_size: 100
2016-03-13 18:07:00 [40688] [INFO] * pool_timeout: 30
2016-03-13 18:07:00 [40688] [INFO] * async_mode: 1

Exception raised:

Traceback (most recent call last):
  File "/home/lbakken/.pyenv/versions/2.7.11/envs/vaurien-2.7.11/lib/python2.7/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/lbakken/.pyenv/versions/2.7.11/envs/vaurien-2.7.11/lib/python2.7/site-packages/vaurien/proxy.py", line 220, in _weirdify
    behavior, behavior_name)
  File "/home/lbakken/.pyenv/versions/2.7.11/envs/vaurien-2.7.11/lib/python2.7/site-packages/vaurien/proxy.py", line 168, in _weirdify
    return self.handler(source, dest, to_backend, behavior)
  File "/home/lbakken/.pyenv/versions/2.7.11/envs/vaurien-2.7.11/lib/python2.7/site-packages/vaurien/protocols/base.py", line 58, in __call__
    return self._handle(source, dest, to_backend)
  File "/home/lbakken/.pyenv/versions/2.7.11/envs/vaurien-2.7.11/lib/python2.7/site-packages/vaurien/protocols/http.py", line 46, in _handle
    dest.sendall(data)
  File "/home/lbakken/.pyenv/versions/2.7.11/envs/vaurien-2.7.11/lib/python2.7/site-packages/gevent/_socket2.py", line 412, in sendall
    timeleft = self.__send_chunk(chunk, flags, timeleft, end)
  File "/home/lbakken/.pyenv/versions/2.7.11/envs/vaurien-2.7.11/lib/python2.7/site-packages/gevent/_socket2.py", line 357, in __send_chunk
    raise timeout('timed out')
timeout: timed out
<Greenlet at 0x7fa4d8a547d0: <bound method RandomProxy._weirdify of <RandomProxy at 0x7fa4d8f43590 fileno=5 address=0.0.0.0:8080>>(<socket at 0x7fa4d8600210 fileno=7 sock=192.168.13, <socket at 0x7fa4d8600190 fileno=8 sock=192.168.13, Tr
ue, 'http.755e4232-c732-49d0-ab0c-d7a501c21854.', <vaurien.behaviors.dummy.Dummy object at 0x7fa4d8f, 'dummy')> failed with timeout

PR on the way.

Test suite error

bin/nosetests -x vaurien
.............F
======================================================================
FAIL: test_existing_behaviors (vaurien.tests.test_proxy.TestSimpleProxy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/lbakken/Projects/src/vaurien/vaurien/tests/test_proxy.py", line 36, in test_existing_behaviors
    self.assertEqual(self.client.list_behaviors(), wanted)
AssertionError: Lists differ: [u'abort', u'blackout', u'dela... != ['blackout', 'delay', 'dummy',...

First differing element 0:
abort
blackout

- [u'abort', u'blackout', u'delay', u'dummy', u'error', u'hang', u'transient']
?  -----------            -         -         -         -        -

+ ['blackout', 'delay', 'dummy', 'error', 'hang', 'transient', 'abort']
?                                                            +++++++++

-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): localhost
requests.packages.urllib3.connectionpool: DEBUG: "GET /behavior HTTP/1.1" 200 21
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): localhost
requests.packages.urllib3.connectionpool: DEBUG: "GET /behaviors HTTP/1.1" 200 84
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 14 tests in 11.767s

FAILED (failures=1)
Makefile:12: recipe for target 'test' failed
make: *** [test] Error 1

Fix to be included in PR for #51

vaurienclient.Client doesn't seem to set behavior correctly.

Setting warmup or inject doesn't update the Error handler's settings.

def test_aws_transient(self):
        """Tests that we retry requests."""
        self._setup_proxy()
        client = VClient()
        options = {'inject': True, 'warmup': 2}

        with client.with_behavior('error', **options):
            # do something...
            result = self._query_ns()
            self._test_result(result)

the odd thing is I can print the settings in the OnTheFlyProxy and at the beginning of Error.on_before_handle. The id method shows the same value for both objects, but only the print in OnTheFlyProxy shows my options being set. Error.on_before_handle just shows my default options.

any ideas?

edit:

here's the _setup_proxy method

def _setup_proxy(self, protocol='http'):
        self.proxy_pid = start_proxy(
            protocol=protocol,
            proxy_port=8000,
            backend_host=boto.ec2.RegionData['us-west-1'],
            backend_port=80,
            options=[
                '--protocol-tcp-reuse-socket',
                '--protocol-tcp-keep-alive'
            ]
        )
        assert self.proxy_pid is not None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.