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

Delta Between Two Patch Sets: environs/dummy/environs.go

Issue 6855054: state: add CACert to Info.
Left Patch Set: state: add RootCertPEM to Info. Created 12 years, 4 months ago
Right Patch Set: state: add CACert to Info. Created 12 years, 4 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « environs/dummy/config_test.go ('k') | environs/dummy/environs_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // The dummy provider implements an environment provider for testing 1 // The dummy provider implements an environment provider for testing
2 // purposes, registered with environs under the name "dummy". 2 // purposes, registered with environs under the name "dummy".
3 // 3 //
4 // The configuration YAML for the testing environment 4 // The configuration YAML for the testing environment
5 // must specify a "state-server" property with a boolean 5 // must specify a "state-server" property with a boolean
6 // value. If this is true, a state server will be started 6 // value. If this is true, a state server will be started
7 // the first time StateInfo is called on a newly reset environment. 7 // the first time StateInfo is called on a newly reset environment.
8 // 8 //
9 // The configuration data also accepts a "broken" property 9 // The configuration data also accepts a "broken" property
10 // of type boolean. If this is non-empty, any operation 10 // of type boolean. If this is non-empty, any operation
(...skipping 27 matching lines...) Expand all
38 "time" 38 "time"
39 ) 39 )
40 40
41 // stateInfo returns a *state.Info which allows clients to connect to the 41 // stateInfo returns a *state.Info which allows clients to connect to the
42 // shared dummy state, if it exists. 42 // shared dummy state, if it exists.
43 func stateInfo() *state.Info { 43 func stateInfo() *state.Info {
44 if testing.MgoAddr == "" { 44 if testing.MgoAddr == "" {
45 panic("dummy environ state tests must be run with MgoTestPackage ") 45 panic("dummy environ state tests must be run with MgoTestPackage ")
46 } 46 }
47 return &state.Info{ 47 return &state.Info{
48 » » Addrs: []string{testing.MgoAddr}, 48 » » Addrs: []string{testing.MgoAddr},
49 » » CACertPEM: []byte(testing.CACertPEM), 49 » » CACert: []byte(testing.CACert),
50 } 50 }
51 } 51 }
52 52
53 // Operation represents an action on the dummy provider. 53 // Operation represents an action on the dummy provider.
54 type Operation interface{} 54 type Operation interface{}
55 55
56 type GenericOperation struct { 56 type GenericOperation struct {
57 Env string 57 Env string
58 } 58 }
59 59
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 return fmt.Errorf("dummy.%s is broken", method) 372 return fmt.Errorf("dummy.%s is broken", method)
373 } 373 }
374 } 374 }
375 return nil 375 return nil
376 } 376 }
377 377
378 func (e *environ) Name() string { 378 func (e *environ) Name() string {
379 return e.state.name 379 return e.state.name
380 } 380 }
381 381
382 func (e *environ) Bootstrap(uploadTools bool, certAndKey []byte) error { 382 func (e *environ) Bootstrap(uploadTools bool, cert, key []byte) error {
383 defer delay() 383 defer delay()
384 if err := e.checkBroken("Bootstrap"); err != nil { 384 if err := e.checkBroken("Bootstrap"); err != nil {
385 return err 385 return err
386 } 386 }
387 password := e.Config().AdminSecret() 387 password := e.Config().AdminSecret()
388 if password == "" { 388 if password == "" {
389 return fmt.Errorf("admin-secret is required for bootstrap") 389 return fmt.Errorf("admin-secret is required for bootstrap")
390 } 390 }
391 var tools *state.Tools 391 var tools *state.Tools
392 var err error 392 var err error
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 // time.Durations into this value. 704 // time.Durations into this value.
705 var providerDelay time.Duration 705 var providerDelay time.Duration
706 706
707 // pause execution to simulate the latency of a real provider 707 // pause execution to simulate the latency of a real provider
708 func delay() { 708 func delay() {
709 if providerDelay > 0 { 709 if providerDelay > 0 {
710 log.Printf("environs/dummy: pausing for %v", providerDelay) 710 log.Printf("environs/dummy: pausing for %v", providerDelay)
711 <-time.After(providerDelay) 711 <-time.After(providerDelay)
712 } 712 }
713 } 713 }
LEFTRIGHT

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