Пример #1
0
needSudo = False  # obviously if you need sudo, set this to True
#contact me imediately if setting this to True breaks things
#(I don't have a machine which needs sudo, so it has not been tested, although in theory it should be fine)

port_prefix = "808"

networkName = "mynetwork"  # the name of the network you created

networkIpPrefix = "192.168.0."  # should be everything up to the last period of the subnet you specified when you
# created your network

propogationTime = 3  #sets number of seconds we sleep after certain actions to let data propagate through your system
# you may lower this to speed up your testing if you know that your system is fast enough to propigate information faster than this
# I do not recomend increasing this

dc = docker_control.docker_controller(networkName, needSudo)


def myhash(s):
    m = 1272844112
    p = 0.61803399
    k = 0
    for char in s:
        k ^= ord(char)
    return int(m * ((k * p) - int(k * p)))


def getViewString(view):
    listOStrings = []
    for instance in view:
        listOStrings.append(instance["networkIpPortAddress"])
Пример #2
0
dockerBuildTag = "testing" #put the tag for your docker build here

hostIp = "10.0.2.15" #localhost will not work here, it needs to be your machine's ip address,
#on Docker Toolbox you will may need to run "docker-machine ip" to get the ip address you need.

needSudo = False # obviously if you need sudo, set this to True
#contact me imediately if setting this to True breaks things
#(I don't have a machine which needs sudo, so it has not been tested, although in theory it should be fine)

port_prefix = "808"

propogationTime = 0.5 #sets number of seconds we sleep after certain actions to let data propagate through your system
# you may lower this to speed up your testing if you know that your system is fast enough to propigate information faster than this
# I do not recomend increasing this

dc = docker_control.docker_controller(needSudo)

def getViewString(view):
    listOStrings = []
    for instance in view:
        listOStrings.append(instance["testScriptAddress"])

    return ",".join(listOStrings)

# Basic Functionality
# These are the endpoints we should be able to hit
    #KVS Functions
def storeKeyValue(ipPort, key, value, payload):
    print("PAYLOAD:")
    print(payload)
    # dicty = json.loads(payload)