Fixing tests
diff --git a/acceptance/rackspace/lb/v1/acl_test.go b/acceptance/rackspace/lb/v1/acl_test.go
index c61f462..7a38027 100644
--- a/acceptance/rackspace/lb/v1/acl_test.go
+++ b/acceptance/rackspace/lb/v1/acl_test.go
@@ -13,7 +13,6 @@
)
func TestACL(t *testing.T) {
- return
client := setup(t)
ids := createLB(t, client, 1)
diff --git a/acceptance/rackspace/lb/v1/lb_test.go b/acceptance/rackspace/lb/v1/lb_test.go
index 8038092..c67ddec 100644
--- a/acceptance/rackspace/lb/v1/lb_test.go
+++ b/acceptance/rackspace/lb/v1/lb_test.go
@@ -171,6 +171,8 @@
th.AssertNoErr(t, err)
t.Logf("LB %d log enabled? %s", id, strconv.FormatBool(res))
+ waitForLB(client, id, lbs.ACTIVE)
+
err = lbs.DisableLogging(client, id).ExtractErr()
th.AssertNoErr(t, err)
t.Logf("Disabled logging for LB %d", id)
@@ -196,3 +198,17 @@
t.Logf("Stats for LB %d: %#v", id, stats)
}
+
+func checkCaching(t *testing.T, client *gophercloud.ServiceClient, id int) {
+ err := lbs.EnableCaching(client, id).ExtractErr()
+ th.AssertNoErr(t, err)
+ t.Logf("Enabled caching for LB %d", id)
+
+ res, err := lbs.IsContentCached(client, id)
+ th.AssertNoErr(t, err)
+ t.Logf("Is caching enabled for LB? %s", strconv.FormatBool(res))
+
+ err = lbs.DisableCaching(client, id).ExtractErr()
+ th.AssertNoErr(t, err)
+ t.Logf("Disabled caching for LB %d", id)
+}
diff --git a/acceptance/rackspace/lb/v1/monitor_test.go b/acceptance/rackspace/lb/v1/monitor_test.go
index a198c04..c1a8e24 100644
--- a/acceptance/rackspace/lb/v1/monitor_test.go
+++ b/acceptance/rackspace/lb/v1/monitor_test.go
@@ -12,7 +12,6 @@
)
func TestMonitors(t *testing.T) {
- return
client := setup(t)
ids := createLB(t, client, 1)
diff --git a/acceptance/rackspace/lb/v1/node_test.go b/acceptance/rackspace/lb/v1/node_test.go
index 0b9e86f..18b9fe7 100644
--- a/acceptance/rackspace/lb/v1/node_test.go
+++ b/acceptance/rackspace/lb/v1/node_test.go
@@ -17,7 +17,6 @@
)
func TestNodes(t *testing.T) {
- return
client := setup(t)
serverIP := findServer(t)
@@ -35,6 +34,9 @@
listEvents(t, client, lbID)
deleteNode(t, client, lbID, nodeID)
+
+ waitForLB(client, lbID, lbs.ACTIVE)
+ deleteLB(t, client, lbID)
}
func findServer(t *testing.T) string {
diff --git a/acceptance/rackspace/lb/v1/session_test.go b/acceptance/rackspace/lb/v1/session_test.go
index d71514e..8d85655 100644
--- a/acceptance/rackspace/lb/v1/session_test.go
+++ b/acceptance/rackspace/lb/v1/session_test.go
@@ -11,7 +11,6 @@
)
func TestSession(t *testing.T) {
- return
client := setup(t)
ids := createLB(t, client, 1)
diff --git a/acceptance/rackspace/lb/v1/throttle_test.go b/acceptance/rackspace/lb/v1/throttle_test.go
index f0a69d5..1cc1235 100644
--- a/acceptance/rackspace/lb/v1/throttle_test.go
+++ b/acceptance/rackspace/lb/v1/throttle_test.go
@@ -11,7 +11,6 @@
)
func TestThrottle(t *testing.T) {
- return
client := setup(t)
ids := createLB(t, client, 1)
@@ -35,7 +34,13 @@
}
func createThrottleConfig(t *testing.T, client *gophercloud.ServiceClient, lbID int) {
- opts := throttle.CreateOpts{MaxConnections: 200}
+ opts := throttle.CreateOpts{
+ MaxConnections: 200,
+ MaxConnectionRate: 100,
+ MinConnections: 0,
+ RateInterval: 10,
+ }
+
err := throttle.Create(client, lbID, opts).ExtractErr()
th.AssertNoErr(t, err)
t.Logf("Enable throttling for %d", lbID)
diff --git a/acceptance/rackspace/lb/v1/vip_test.go b/acceptance/rackspace/lb/v1/vip_test.go
index e594093..bc0c2a8 100644
--- a/acceptance/rackspace/lb/v1/vip_test.go
+++ b/acceptance/rackspace/lb/v1/vip_test.go
@@ -13,7 +13,6 @@
)
func TestVIPs(t *testing.T) {
- return
client := setup(t)
ids := createLB(t, client, 1)
@@ -26,6 +25,9 @@
deleteVIP(t, client, lbID, vipIDs[0])
bulkDeleteVIPs(t, client, lbID, vipIDs[1:])
+
+ waitForLB(client, lbID, lbs.ACTIVE)
+ deleteLB(t, client, lbID)
}
func listVIPs(t *testing.T, client *gophercloud.ServiceClient, lbID int) {
diff --git a/rackspace/lb/v1/lbs/requests.go b/rackspace/lb/v1/lbs/requests.go
index 2d80062..8e53020 100644
--- a/rackspace/lb/v1/lbs/requests.go
+++ b/rackspace/lb/v1/lbs/requests.go
@@ -433,7 +433,7 @@
_, res.Err = perigee.Request("PUT", loggingURL(client, id), perigee.Options{
MoreHeaders: client.AuthenticatedHeaders(),
ReqBody: &reqBody,
- OkCodes: []int{200},
+ OkCodes: []int{202},
})
return res
@@ -447,7 +447,7 @@
_, res.Err = perigee.Request("PUT", loggingURL(client, id), perigee.Options{
MoreHeaders: client.AuthenticatedHeaders(),
ReqBody: &reqBody,
- OkCodes: []int{200},
+ OkCodes: []int{202},
})
return res
@@ -509,6 +509,14 @@
return res
}
+// IsContentCached will check to see whether the specified load balancer caches
+// content. When content caching is enabled, recently-accessed files are stored
+// on the load balancer for easy retrieval by web clients. Content caching
+// improves the performance of high traffic web sites by temporarily storing
+// data that was recently accessed. While it's cached, requests for that data
+// are served by the load balancer, which in turn reduces load off the back end
+// nodes. The result is improved response times for those requests and less
+// load on the web server.
func IsContentCached(client *gophercloud.ServiceClient, id int) (bool, error) {
var body interface{}
@@ -537,6 +545,7 @@
}
}
+// EnableCaching will enable content-caching for the specified load balancer.
func EnableCaching(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
reqBody := toCachingMap(true)
var res gophercloud.ErrResult
@@ -544,12 +553,13 @@
_, res.Err = perigee.Request("PUT", cacheURL(client, id), perigee.Options{
MoreHeaders: client.AuthenticatedHeaders(),
ReqBody: &reqBody,
- OkCodes: []int{200},
+ OkCodes: []int{202},
})
return res
}
+// DisableCaching will disable content-caching for the specified load balancer.
func DisableCaching(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult {
reqBody := toCachingMap(false)
var res gophercloud.ErrResult
@@ -557,7 +567,7 @@
_, res.Err = perigee.Request("PUT", cacheURL(client, id), perigee.Options{
MoreHeaders: client.AuthenticatedHeaders(),
ReqBody: &reqBody,
- OkCodes: []int{200},
+ OkCodes: []int{202},
})
return res
diff --git a/rackspace/lb/v1/throttle/requests.go b/rackspace/lb/v1/throttle/requests.go
index 78c878f..8c2e4be 100644
--- a/rackspace/lb/v1/throttle/requests.go
+++ b/rackspace/lb/v1/throttle/requests.go
@@ -19,6 +19,15 @@
type CreateOpts struct {
// Required - the maximum amount of connections per IP address to allow per LB.
MaxConnections int
+
+ // Deprecated as of v1.22.
+ MaxConnectionRate int
+
+ // Deprecated as of v1.22.
+ MinConnections int
+
+ // Deprecated as of v1.22.
+ RateInterval int
}
// ToCTCreateMap casts a CreateOpts struct to a map.
@@ -30,6 +39,10 @@
}
ct["maxConnections"] = opts.MaxConnections
+ ct["maxConnectionRate"] = opts.MaxConnectionRate
+ ct["minConnections"] = opts.MinConnections
+ ct["rateInterval"] = opts.RateInterval
+
return map[string]interface{}{"connectionThrottle": ct}, nil
}
@@ -48,7 +61,7 @@
MoreHeaders: c.AuthenticatedHeaders(),
ReqBody: &reqBody,
Results: &res.Body,
- OkCodes: []int{200},
+ OkCodes: []int{202},
})
return res
@@ -75,7 +88,7 @@
_, res.Err = perigee.Request("DELETE", rootURL(c, lbID), perigee.Options{
MoreHeaders: c.AuthenticatedHeaders(),
- OkCodes: []int{200},
+ OkCodes: []int{202},
})
return res