#!/usr/bin/env python from trest import expect API = "http://localhost:7075" expect( "getResourceTypes", lambda x: ("result" in x) and ("Types" in x["result"]) and (x["result"]["Types"][0]["Type"] == "DFECluster"), API, "getResourceTypes") expect( "calculateResourceCapacity_simple_reserve", lambda x: (x["result"]["Resource"]["Attributes"]["Size"] == 7) and (x["result"]["Resource"]["Type"] == "DFECluster"), API, "calculateResourceCapacity", { "Resource": { "Type": "DFECluster", "Attributes": { "Size": 10 } }, "Reserve": [{ "Attributes": { "Size": 3 } }] }) expect( "calculateResourceCapacity_multiple_reserves", lambda x: x["result"]["Resource"]["Attributes"]["Size"] == 5, API,
#!/usr/bin/env python from trest import expect API = "http://localhost:56789" expect( "getResourceTypes", lambda x: ("result" in x) and ("Types" in x["result"]) and (x["result"]["Types"][0]["Type"] == "Machine"), API, "getResourceTypes") ####################################################### prepareReservation expect( "getSimpleMachineReq1", lambda x: x["result"]["Resources"][0]["Attributes"]["Cores"] == 2, API, "prepareReservation", { "Resources": [{ "GroupID": "ID0", "Type": "Machine", "Attributes": { "Cores": 2, "Memory": 200, "Disk": 10, "Frequency": 2400 } }] }) expect( "getSimpleMachineReq2", lambda x: x["result"]["Resources"][0]["Attributes"]["Cores"] == 10, API, "prepareReservation", {
#!/usr/bin/env python from trest import expect API = "http://localhost:7075" expect("releaseAllResources", lambda x: x["result"] == {}, API, "releaseAllResources") av = expect("getAvailableResources", lambda x: x["result"]["Resources"][0]["Attributes"]["Size"] == 8, API, "getAvailableResources") r1 = expect("reserveDFE-1", lambda x: len(x["result"]["Reservations"]) == 1, API, "reserveResources", {"Resources": [{ "Type": "DFECluster", "Attributes": { "Size": 1 } }]}) r2 = expect("reserveDFE-5", lambda x: len(x["result"]["Reservations"]) == 1, API, "reserveResources", {"Resources": [{ "Type": "DFECluster", "Attributes": { "Size": 5 } }]}) expect(
#!/usr/bin/env python from trest import expect import json API = "http://localhost:8888" print "Using API: " + API r = expect("getAvailableResources", lambda x: len(x["result"]["Resources"]) >= 1, API, "getAvailableResources") print "AVAILABLE RESOURCES: ", r expect( "calculateResourceCapacity1", lambda x: x["result"]["Resource"]["Attributes"]["Cores"] == 7, API, "calculateResourceCapacity", { "Resource": { "Type": "Machine", "Attributes": { "Cores": 10, "Memory": 200, "Disk": 10, "Frequency": 2500 } }, "Reserve": [{ "Attributes": { "Cores": 3, "Memory": 200,
#!/usr/bin/env python from trest import expect API = "http://localhost:8080" expect( "getResourceTypes", lambda x: ("result" in x) and ("Types" in x["result"]) and (x["result"]["Types"][0]["Type"] == "Storage"), API, "getResourceTypes") expect( "calculateResourceCapacity_simple_reserve_capacity", lambda x: x["result"]["Resource"]["Attributes"]["Capacity"] == 7, API, "calculateResourceCapacity", { "Resource": { "Type": "Storage", "Attributes": { "Capacity": 10, "Throughput": 100, "AccessType": "SEQUENTIAL" } }, "Reserve": [{ "Attributes": { "Capacity": 3, "Throughput": 0, "AccessType": "SEQUENTIAL" } }], "Release": [] })
#!/usr/bin/env python from trest import expect API = "http://localhost:56789" expect( "getResourceTypes", lambda x: ("result" in x) and ("Types" in x["result"]) and (x["result"]["Types"][0]["Type"] == "DFECluster"), API, "getResourceTypes") ####################################################### prepareReservation p1 = expect( "getSimpleDFEReq1", lambda x: x["result"]["Resources"][0]["Attributes"]["Size"] == 1, API, "prepareReservation", { "Resources": [{ "GroupID": "ID0", "Type": "DFECluster", "NumInstances": 1, "Attributes": { "Size": 1 } }], "Distances": [] }) p2 = expect( "getSimpleDFEReq2", lambda x: x["result"]["Resources"][0]["Attributes"]["Size"] == 4, API, "prepareReservation", { "Resources": [{
#!/usr/bin/env python from trest import expect API = "http://localhost:56789" expect( "getResourceTypes", lambda x: ("result" in x) and ("Types" in x["result"]) and (x["result"]["Types"][0]["Type"] == "Storage"), API, "getResourceTypes") ####################################################### prepareReservation p1 = expect( "getSimpleStorageReq1", lambda x: x["result"]["Resources"][0]["Attributes"]["Capacity"] == 10, API, "prepareReservation", { "Resources": [{ "GroupID": "ID0", "Type": "Storage", "NumInstances": 1, "Attributes": { "Capacity": 10, "Throughput": 15, "AccessType": "SEQUENTIAL" } }], "Distances": [] }) p2 = expect( "getSimpleStorageReq2", lambda x: x["result"]["Resources"][0]["Attributes"]["Capacity"] == 20, API,
#!/usr/bin/env python from trest import expect API="http://localhost:8080" expect("releaseAllResources", lambda x: x["result"] == {}, API, "releaseAllResources", { }) expect("getAvailableResources", lambda x: len(x["result"]["Resources"]) == 2, API, "getAvailableResources") r1=expect("reserveStorage-1", lambda x: len(x["result"]["Reservations"]) == 1, API, "reserveResources", { "Resources":[ { "Type":"Storage", "Attributes":{ "Capacity":10, "Throughput": 15, "AccessType": "SEQUENTIAL" } } ] } ) expect("checkReserveStorage-1", lambda x: x["result"]["Reservations"][0]["Ready"], API, "verifyResources",