@@ -31,6 +31,7 @@ var _ = Describe("Replica order", func() {
3131 cliCommand = file .NewReplicaOrderCommand (slCommand )
3232 cliCommand .Command .PersistentFlags ().Var (cliCommand .OutputFlag , "output" , "--output=JSON for json output." )
3333 cliCommand .StorageManager = FakeStorageManager
34+ FakeStorageManager .GetVolumeIdReturns (1234 , nil )
3435 })
3536
3637 Describe ("Replicant order" , func () {
@@ -43,54 +44,55 @@ var _ = Describe("Replica order", func() {
4344 })
4445 Context ("Replicant order with wrong volume id" , func () {
4546 It ("return error" , func () {
47+ FakeStorageManager .GetVolumeIdReturns (0 , errors .New ("BAD Volume ID" ))
4648 err := testhelpers .RunCobraCommand (cliCommand .Command , "abc" )
4749 Expect (err ).To (HaveOccurred ())
48- Expect (err .Error ()).To (ContainSubstring ("Invalid input for ' Volume ID'. It must be a positive integer. " ))
50+ Expect (err .Error ()).To (ContainSubstring ("BAD Volume ID" ))
4951 })
5052 })
5153 Context ("Replicant order without -s" , func () {
5254 It ("return error" , func () {
53- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " )
55+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " )
5456 Expect (err ).To (HaveOccurred ())
5557 Expect (err .Error ()).To (ContainSubstring ("Incorrect Usage: [-s|--snapshot-schedule] is required, options are: HOURLY, DAILY, WEEKLY." ))
5658 })
5759 })
5860
5961 Context ("Replicant order with wrong -s" , func () {
6062 It ("return error" , func () {
61- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "yearly" )
63+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "yearly" )
6264 Expect (err ).To (HaveOccurred ())
6365 Expect (err .Error ()).To (ContainSubstring ("Incorrect Usage: [-s|--snapshot-schedule] is required, options are: HOURLY, DAILY, WEEKLY." ))
6466 })
6567 })
6668
6769 Context ("Replicant order without -d" , func () {
6870 It ("return error" , func () {
69- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "DAILY" )
71+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "DAILY" )
7072 Expect (err ).To (HaveOccurred ())
7173 Expect (err .Error ()).To (ContainSubstring ("Incorrect Usage: [-d|--datacenter] is required." ))
7274 })
7375 })
7476
7577 Context ("Replicant order with wrong tier" , func () {
7678 It ("return error" , func () {
77- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "DAILY" , "-d" , "dal09" , "-t" , "0.3" )
79+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "DAILY" , "-d" , "dal09" , "-t" , "0.3" )
7880 Expect (err ).To (HaveOccurred ())
7981 Expect (err .Error ()).To (ContainSubstring ("Incorrect Usage: [-t|--tier] is optional, options are: 0.25,2,4,10." ))
8082 })
8183 })
8284
8385 Context ("Replicant order with wrong iops" , func () {
8486 It ("return error" , func () {
85- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "DAILY" , "-d" , "dal09" , "-i" , "9" )
87+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "DAILY" , "-d" , "dal09" , "-i" , "9" )
8688 Expect (err ).To (HaveOccurred ())
8789 Expect (err .Error ()).To (ContainSubstring ("Incorrect Usage: -i|--iops must be between 100 and 6000, inclusive." ))
8890 })
8991 })
9092
9193 Context ("Replicant order with wrong iops" , func () {
9294 It ("return error" , func () {
93- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "DAILY" , "-d" , "dal09" , "-i" , "1234" )
95+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "DAILY" , "-d" , "dal09" , "-i" , "1234" )
9496 Expect (err ).To (HaveOccurred ())
9597 Expect (err .Error ()).To (ContainSubstring ("Incorrect Usage: -i|--iops must be a multiple of 100." ))
9698 })
@@ -101,9 +103,9 @@ var _ = Describe("Replica order", func() {
101103 FakeStorageManager .OrderReplicantVolumeReturns (datatypes.Container_Product_Order_Receipt {}, errors .New ("Internal Server Error" ))
102104 })
103105 It ("return error" , func () {
104- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "DAILY" , "-d" , "dal09" , "-t" , "4" , "-f" )
106+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "DAILY" , "-d" , "dal09" , "-t" , "4" , "-f" )
105107 Expect (err ).To (HaveOccurred ())
106- Expect (err .Error ()).To (ContainSubstring ("Failed to order replicant for volume 123 .Please verify your options and try again." ))
108+ Expect (err .Error ()).To (ContainSubstring ("Failed to order replicant for volume 1234 .Please verify your options and try again." ))
107109 Expect (err .Error ()).To (ContainSubstring ("Internal Server Error" ))
108110 })
109111 })
@@ -127,12 +129,12 @@ var _ = Describe("Replica order", func() {
127129 nil )
128130 })
129131 It ("return no error" , func () {
130- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "DAILY" , "-d" , "dal09" , "-t" , "4" , "-f" )
132+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "DAILY" , "-d" , "dal09" , "-t" , "4" , "-f" )
131133 Expect (err ).NotTo (HaveOccurred ())
132134 Expect (fakeUI .Outputs ()).To (ContainSubstring ("Order 123456 was placed." ))
133135 })
134136 It ("return no error" , func () {
135- err := testhelpers .RunCobraCommand (cliCommand .Command , "123 " , "-s" , "DAILY" , "-d" , "dal09" , "-i" , "3000" , "-f" )
137+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234 " , "-s" , "DAILY" , "-d" , "dal09" , "-i" , "3000" , "-f" )
136138 Expect (err ).NotTo (HaveOccurred ())
137139 Expect (fakeUI .Outputs ()).To (ContainSubstring ("Order 123456 was placed." ))
138140 })
0 commit comments