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

Side by Side Diff: cmd/jujud/main_test.go

Issue 6842088: cmd/jujud: accept CA cert flag
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « cmd/jujud/bootstrap_test.go ('k') | environs/cloudinit/cloudinit.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "flag" 4 "flag"
5 "io/ioutil"
5 . "launchpad.net/gocheck" 6 . "launchpad.net/gocheck"
6 "launchpad.net/juju-core/testing" 7 "launchpad.net/juju-core/testing"
7 "os" 8 "os"
8 "os/exec" 9 "os/exec"
9 "strings" 10 "strings"
10 stdtesting "testing" 11 stdtesting "testing"
11 ) 12 )
12 13
14 var caCertFile string
15
13 func TestPackage(t *stdtesting.T) { 16 func TestPackage(t *stdtesting.T) {
17 // Create a CA certificate available for all tests.
18 f, err := ioutil.TempFile("", "juju-test-cert")
19 if err != nil {
20 panic(err)
21 }
22 _, err = f.WriteString(testing.CACertPEM)
23 if err != nil {
24 panic(err)
25 }
26 f.Close()
27 caCertFile = f.Name()
28 defer os.Remove(caCertFile)
29
14 testing.MgoTestPackage(t) 30 testing.MgoTestPackage(t)
15 } 31 }
16 32
17 type MainSuite struct{} 33 type MainSuite struct{}
18 34
19 var _ = Suite(&MainSuite{}) 35 var _ = Suite(&MainSuite{})
20 36
21 var flagRunMain = flag.Bool("run-main", false, "Run the application's main funct ion for recursive testing") 37 var flagRunMain = flag.Bool("run-main", false, "Run the application's main funct ion for recursive testing")
22 38
23 // Reentrancy point for testing (something as close as possible to) the jujud 39 // Reentrancy point for testing (something as close as possible to) the jujud
(...skipping 26 matching lines...) Expand all
50 msgz := `invalid value "localhost:37017,srv" for flag --state-servers: " srv" is not a valid state server address` 66 msgz := `invalid value "localhost:37017,srv" for flag --state-servers: " srv" is not a valid state server address`
51 for _, cmd := range cmds { 67 for _, cmd := range cmds {
52 checkMessage(c, msgf, cmd, "--cheese") 68 checkMessage(c, msgf, cmd, "--cheese")
53 checkMessage(c, msgz, cmd, "--state-servers", "localhost:37017,s rv") 69 checkMessage(c, msgz, cmd, "--state-servers", "localhost:37017,s rv")
54 } 70 }
55 71
56 msga := `unrecognized args: ["toastie"]` 72 msga := `unrecognized args: ["toastie"]`
57 checkMessage(c, msga, 73 checkMessage(c, msga,
58 "bootstrap-state", 74 "bootstrap-state",
59 "--state-servers", "st:37017", 75 "--state-servers", "st:37017",
76 "--ca-cert-file", caCertFile,
60 "--instance-id", "ii", 77 "--instance-id", "ii",
61 "--env-config", b64yaml{"blah": "blah"}.encode(), 78 "--env-config", b64yaml{"blah": "blah"}.encode(),
62 "toastie") 79 "toastie")
63 checkMessage(c, msga, "unit", 80 checkMessage(c, msga, "unit",
64 "--state-servers", "localhost:37017,st:37017", 81 "--state-servers", "localhost:37017,st:37017",
82 "--ca-cert-file", caCertFile,
65 "--unit-name", "un/0", 83 "--unit-name", "un/0",
66 "toastie") 84 "toastie")
67 checkMessage(c, msga, "machine", 85 checkMessage(c, msga, "machine",
68 "--state-servers", "st:37017", 86 "--state-servers", "st:37017",
87 "--ca-cert-file", caCertFile,
69 "--machine-id", "42", 88 "--machine-id", "42",
70 "toastie") 89 "toastie")
71 } 90 }
OLDNEW
« no previous file with comments | « cmd/jujud/bootstrap_test.go ('k') | environs/cloudinit/cloudinit.go » ('j') | no next file with comments »

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