gremlin-python
gremlin-python copied to clipboard
GremlinNetworkAttackHelper hostname setter broken
When using children of GremlinNetworkAttackHelper (GremlinPacketLossAttack, GremlinLatencyAttack, GremlinBlackholeAttack), the hostnames parameter behaves in an unexpected manner when given a list.
In the general case of GremlinNetworkAttackHelper will return a list consisting of only the last element of the input list.
hostnames = [
'www.gremlin.com',
'^api.gremlin.com',
]
attack = GremlinNetworkAttackHelper(hostnames=hostnames)
expected: ['www.gremlin.com', '^api.gremlin.com'] (<class 'list'>)
actual attack.hostnames: ['^api.gremlin.com'] (<class 'list'>)
In more specific cases of actual attacks (e.g. GremlinPacketLossAttack), the same behavior shows up, except that the output of the api_model()
call is a list of elements of the string that was the last element of the input list.
hostnames = [
'www.gremlin.com',
'^api.gremlin.com',
]
attack = GremlinNetworkAttackHelper(hostnames=hostnames)
expected: {'type': 'packet_loss', 'commandType': 'Packet Loss', 'args': ['-l', '60', '-r', '1', '-p', '^53', '-h', 'www.gremlin.com,^api.gremlin.com']}
actual attack.hostnames: {'type': 'packet_loss', 'commandType': 'Packet Loss', 'args': ['-l', '60', '-r', '1', '-p', '^53', '-h', '^,a,p,i,.,g,r,e,m,l,i,n,.,c,o,m']}
I believe [#73 ] will fix this problem