Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(850)

Side by Side Diff: testservices/novaservice/service_test.go

Issue 6924043: Second phase of nova testing service: HTTP API. (Closed)
Patch Set: Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Nova double testing service - internal direct API tests 1 // Nova double testing service - internal direct API tests
2 2
3 package novaservice 3 package novaservice
4 4
5 import ( 5 import (
6 "fmt" 6 "fmt"
7 . "launchpad.net/gocheck" 7 . "launchpad.net/gocheck"
8 "launchpad.net/goose/nova" 8 "launchpad.net/goose/nova"
9 "strings" 9 "strings"
10 ) 10 )
11 11
12 type NovaSuite struct { 12 type NovaSuite struct {
13 service *Nova 13 service *Nova
14 endpointNoVersion string 14 endpointNoVersion string
15 endpoint string 15 endpoint string
16 } 16 }
17 17
18 var baseURL = "/v2/" 18 var baseURL = "/v2/"
19 var token = "token" 19 var token = "token"
20 var hostname = "http://example.com/" 20 var hostname = "http://example.com/"
21 21
22 var _ = Suite(&NovaSuite{}) 22 var _ = Suite(&NovaSuite{})
23 23
24 func (s *NovaSuite) SetUpSuite(c *C) { 24 func (s *NovaSuite) SetUpSuite(c *C) {
25 ep := strings.TrimRight(hostname, "/") + "/"
rog 2012/12/11 10:31:42 i'm not sure the trimming is necessary here - we c
dimitern 2012/12/12 11:00:47 Yes, but since it's a global var, it gets changed
25 s.service = New(hostname, baseURL, token) 26 s.service = New(hostname, baseURL, token)
26 » s.endpointNoVersion = hostname + token 27 » s.endpointNoVersion = ep + token
27 » s.endpoint = hostname + strings.TrimLeft(baseURL, "/") + token 28 » s.endpoint = ep + strings.TrimLeft(baseURL, "/") + token
28 } 29 }
29 30
30 func (s *NovaSuite) ensureNoFlavor(c *C, flavor nova.FlavorDetail) { 31 func (s *NovaSuite) ensureNoFlavor(c *C, flavor nova.FlavorDetail) {
31 _, err := s.service.flavor(flavor.Id) 32 _, err := s.service.flavor(flavor.Id)
32 c.Assert(err, ErrorMatches, fmt.Sprintf("no such flavor %q", flavor.Id)) 33 c.Assert(err, ErrorMatches, fmt.Sprintf("no such flavor %q", flavor.Id))
33 } 34 }
34 35
35 func (s *NovaSuite) ensureNoServer(c *C, server nova.ServerDetail) { 36 func (s *NovaSuite) ensureNoServer(c *C, server nova.ServerDetail) {
36 _, err := s.service.server(server.Id) 37 _, err := s.service.server(server.Id)
37 c.Assert(err, ErrorMatches, fmt.Sprintf("no such server %q", server.Id)) 38 c.Assert(err, ErrorMatches, fmt.Sprintf("no such server %q", server.Id))
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 defer s.deleteServer(c, server) 879 defer s.deleteServer(c, server)
879 s.createIP(c, fip) 880 s.createIP(c, fip)
880 defer s.deleteIP(c, fip) 881 defer s.deleteIP(c, fip)
881 err := s.service.addServerFloatingIP(server.Id, fip.Id) 882 err := s.service.addServerFloatingIP(server.Id, fip.Id)
882 c.Assert(err, IsNil) 883 c.Assert(err, IsNil)
883 err = s.service.removeServerFloatingIP(server.Id, fip.Id) 884 err = s.service.removeServerFloatingIP(server.Id, fip.Id)
884 c.Assert(err, IsNil) 885 c.Assert(err, IsNil)
885 err = s.service.removeServerFloatingIP(server.Id, fip.Id) 886 err = s.service.removeServerFloatingIP(server.Id, fip.Id)
886 c.Assert(err, ErrorMatches, `server "sr1" does not have floating IP 1`) 887 c.Assert(err, ErrorMatches, `server "sr1" does not have floating IP 1`)
887 } 888 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b