blob: 8c2756f63c054a0220afa83c47311f99c9c515ff [file] [log] [blame]
Jamie Hannaford7afb7af2014-11-04 13:32:20 +01001package monitors
2
3import (
4 "testing"
5
6 th "github.com/rackspace/gophercloud/testhelper"
7 "github.com/rackspace/gophercloud/testhelper/client"
8)
9
10const lbID = 12345
11
12func TestUpdateCONNECT(t *testing.T) {
13 th.SetupHTTP()
14 defer th.TeardownHTTP()
15
16 mockUpdateConnectResponse(t, lbID)
17
18 opts := UpdateConnectMonitorOpts{
19 AttemptLimit: 3,
20 Delay: 10,
21 Timeout: 10,
22 }
23
24 err := Update(client.ServiceClient(), lbID, opts).ExtractErr()
25 th.AssertNoErr(t, err)
26}
27
28func TestUpdateHTTP(t *testing.T) {
29 th.SetupHTTP()
30 defer th.TeardownHTTP()
31
32 mockUpdateHTTPResponse(t, lbID)
33
34 opts := UpdateHTTPMonitorOpts{
35 AttemptLimit: 3,
36 Delay: 10,
37 Timeout: 10,
38 BodyRegex: "{regex}",
39 Path: "/foo",
40 StatusRegex: "200",
41 Type: HTTPS,
42 }
43
44 err := Update(client.ServiceClient(), lbID, opts).ExtractErr()
45 th.AssertNoErr(t, err)
46}