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

Issue 7194043: Goose test infrastructure improvements (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by wallyworld
Modified:
11 years, 3 months ago
Reviewers:
mp+144435
Visibility:
Public.

Description

Goose test infrastructure improvements This branch improves the usabilty of the goose test infrastructure. A full Openstack service test double is provided. A bunch of manual coding which was required in each test suite to set up various Openstack module test doubles is replaced by a few lines of code. New code: cred := &identity.Credentials{...} openstack := openstack.New(cred) openstack.SetupHTTP(s.Mux) Old code: // Create the identity service. s.identityDouble = identityservice.NewUserPass() token := s.identityDouble.AddUser(s.cred.User, s.cred.Secrets) s.Mux.Handle(baseIdentityURL, s.identityDouble) // Register Swift endpoints with identity service. ep := identityservice.Endpoint{ AdminURL: s.Server.URL + baseSwiftURL, InternalURL: s.Server.URL + baseSwiftURL, PublicURL: s.Server.URL + baseSwiftURL, Region: s.cred.Region, } service := identityservice.Service{"swift", "object-store", []identityservice.Endpoint{ep}} s.identityDouble.AddService(service) s.swiftDouble = swiftservice.New("localhost", baseSwiftURL+"/", token) s.Mux.Handle(baseSwiftURL+"/", s.swiftDouble) // Register Nova endpoints with identity service. ep = identityservice.Endpoint{ AdminURL: s.Server.URL + baseNovaURL, InternalURL: s.Server.URL + baseNovaURL, PublicURL: s.Server.URL + baseNovaURL, Region: s.cred.Region, } service = identityservice.Service{"nova", "compute", []identityservice.Endpoint{ep}} s.identityDouble.AddService(service) s.novaDouble = novaservice.New("localhost", "V1", token, "1") s.novaDouble.SetupHTTP(s.Mux) Other changes include: - fix the identity service double to remove the hard coded userId and tenantId. - do not hard code a fixed token against a service double - each user is assigned their own token just like a real instance, allowing multi-user tests to be written. - improvements to the Swift service double to make it use URLs which are compliant with how a real Swift instance would do it. - factor out a common base class for the legacy and userpass double implementations. - use a SetupHTTP() for all test doubles instead of requiring the coder to know the magic URL paths to use. https://code.launchpad.net/~wallyworld/goose/service-double-improvements/+merge/144435 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 4

Patch Set 2 : Goose test infrastructure improvements #

Unified diffs Side-by-side diffs Delta from patch set Stats (+763 lines, -637 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M client/local_test.go View 1 3 chunks +15 lines, -22 lines 0 comments Download
M identity/legacy_test.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M identity/userpass_test.go View 1 1 chunk +5 lines, -5 lines 0 comments Download
M nova/local_test.go View 1 3 chunks +12 lines, -32 lines 0 comments Download
M swift/local_test.go View 1 3 chunks +12 lines, -28 lines 0 comments Download
M testservices/cmd/main.go View 1 1 chunk +4 lines, -3 lines 0 comments Download
M testservices/identityservice/identityservice.go View 1 1 chunk +11 lines, -5 lines 0 comments Download
M testservices/identityservice/legacy.go View 1 1 chunk +17 lines, -9 lines 0 comments Download
M testservices/identityservice/legacy_test.go View 1 1 chunk +3 lines, -2 lines 0 comments Download
M testservices/identityservice/service_test.go View 1 1 chunk +3 lines, -3 lines 0 comments Download
M testservices/identityservice/userpass.go View 1 5 chunks +18 lines, -17 lines 0 comments Download
M testservices/identityservice/userpass_test.go View 1 8 chunks +17 lines, -22 lines 0 comments Download
A testservices/identityservice/users.go View 1 1 chunk +63 lines, -0 lines 0 comments Download
M testservices/identityservice/util.go View 1 chunk +4 lines, -2 lines 0 comments Download
M testservices/novaservice/service.go View 1 7 chunks +46 lines, -24 lines 0 comments Download
M testservices/novaservice/service_http.go View 1 8 chunks +16 lines, -9 lines 0 comments Download
M testservices/novaservice/service_http_test.go View 1 9 chunks +343 lines, -334 lines 0 comments Download
M testservices/novaservice/service_test.go View 10 chunks +16 lines, -17 lines 0 comments Download
A testservices/openstack/openstack.go View 1 1 chunk +38 lines, -0 lines 0 comments Download
A testservices/service.go View 1 1 chunk +21 lines, -0 lines 0 comments Download
M testservices/swiftservice/service.go View 1 2 chunks +46 lines, -8 lines 0 comments Download
M testservices/swiftservice/service_http.go View 3 chunks +13 lines, -7 lines 0 comments Download
M testservices/swiftservice/service_http_test.go View 1 3 chunks +14 lines, -9 lines 0 comments Download
M testservices/swiftservice/service_test.go View 2 chunks +8 lines, -7 lines 0 comments Download
D testservices/swiftservice/swiftservice.go View 1 chunk +0 lines, -40 lines 0 comments Download
M tools/secgroup-delete-all/main_test.go View 1 2 chunks +13 lines, -29 lines 0 comments Download

Messages

Total messages: 4
wallyworld
Please take a look.
11 years, 3 months ago (2013-01-23 05:51:07 UTC) #1
dimitern
LGTM overall, with a couple of comments. https://codereview.appspot.com/7194043/diff/1/client/local_test.go File client/local_test.go (right): https://codereview.appspot.com/7194043/diff/1/client/local_test.go#newcode42 client/local_test.go:42: // The ...
11 years, 3 months ago (2013-01-23 12:28:08 UTC) #2
wallyworld
https://codereview.appspot.com/7194043/diff/1/client/local_test.go File client/local_test.go (right): https://codereview.appspot.com/7194043/diff/1/client/local_test.go#newcode42 client/local_test.go:42: // The openstack test service sets up userpass authentication. ...
11 years, 3 months ago (2013-01-24 03:16:55 UTC) #3
wallyworld
11 years, 3 months ago (2013-01-24 03:20:53 UTC) #4
*** Submitted:

Goose test infrastructure improvements

This branch improves the usabilty of the goose test infrastructure.

A full Openstack service test double is provided. A bunch of manual coding which
was required in each test suite to set up various Openstack module test doubles
is replaced by a few lines of code.

New code:

        cred := &identity.Credentials{...}
	openstack := openstack.New(cred)
	openstack.SetupHTTP(s.Mux)

Old code:

	// Create the identity service.
	s.identityDouble = identityservice.NewUserPass()
	token := s.identityDouble.AddUser(s.cred.User, s.cred.Secrets)
	s.Mux.Handle(baseIdentityURL, s.identityDouble)

	// Register Swift endpoints with identity service.
	ep := identityservice.Endpoint{
		AdminURL:    s.Server.URL + baseSwiftURL,
		InternalURL: s.Server.URL + baseSwiftURL,
		PublicURL:   s.Server.URL + baseSwiftURL,
		Region:      s.cred.Region,
	}
	service := identityservice.Service{"swift", "object-store",
[]identityservice.Endpoint{ep}}
	s.identityDouble.AddService(service)
	s.swiftDouble = swiftservice.New("localhost", baseSwiftURL+"/", token)
	s.Mux.Handle(baseSwiftURL+"/", s.swiftDouble)

	// Register Nova endpoints with identity service.
	ep = identityservice.Endpoint{
		AdminURL:    s.Server.URL + baseNovaURL,
		InternalURL: s.Server.URL + baseNovaURL,
		PublicURL:   s.Server.URL + baseNovaURL,
		Region:      s.cred.Region,
	}
	service = identityservice.Service{"nova", "compute",
[]identityservice.Endpoint{ep}}
	s.identityDouble.AddService(service)
	s.novaDouble = novaservice.New("localhost", "V1", token, "1")
	s.novaDouble.SetupHTTP(s.Mux)
	
	
Other changes include:

- fix the identity service double to remove the hard coded userId and tenantId.
- do not hard code a fixed token against a service double - each user is
assigned their own token just like a real instance, allowing multi-user tests to
be written.
- improvements to the Swift service double to make it use URLs which are
compliant with how a real Swift instance would do it.
- factor out a common base class for the legacy and userpass double
implementations.
- use a SetupHTTP() for all test doubles instead of requiring the coder to know
the magic URL paths to use.

R=dimitern
CC=
https://codereview.appspot.com/7194043
Sign in to reply to this message.

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