diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/example_simple_test.go b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/example_simple_test.go
deleted file mode 100644
index 24788ddfba1..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/example_simple_test.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2013 Phillip Bond
-// Licensed under the MIT License
-// see file LICENSE
-
-package systemstat_test
-
-import (
- "bitbucket.org/bertimus9/systemstat"
- "fmt"
-)
-
-var sample systemstat.MemSample
-
-// This example shows how easy it is to get memory information
-func Example_simple() {
- sample = systemstat.GetMemSample()
- fmt.Println("Total available RAM in kb:", sample.MemTotal, "k total")
- fmt.Println("Used RAM in kb:", sample.MemUsed, "k used")
- fmt.Println("Free RAM in kb:", sample.MemFree, "k free")
- fmt.Printf("The output is similar to, but somewhat different than:\n\ttop -n1 | grep Mem:\n")
-}
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat_test.go b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat_test.go
deleted file mode 100644
index 069c9188b33..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/systemstat_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2013 Phillip Bond
-// Licensed under the MIT License
-// see file LICENSE
-
-package systemstat
-
-import (
- "fmt"
- "testing"
-)
-
-var (
- msgFail = "%v method fails. Expects %v, returns %v"
-)
-
-func TestGetUptime(t *testing.T) {
- s := getUptime("testdata/uptime")
- if s.Uptime != 18667.53 {
- t.Errorf(msgFail, "getUptime", "18667.53", s.Uptime)
- }
-}
-
-func TestGetLoadAvgSample(t *testing.T) {
- s := getLoadAvgSample("testdata/loadavg")
- fmt.Printf("%#v\n", s)
- if s.One != 0.1 {
- t.Errorf(msgFail, "getUptime", "0.1", s.One)
- }
- if s.Five != 0.15 {
- t.Errorf(msgFail, "getUptime", "0.15", s.Five)
- }
- if s.Fifteen != 0.14 {
- t.Errorf(msgFail, "getUptime", "0.14", s.Fifteen)
- }
-}
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/loadavg b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/loadavg
deleted file mode 100644
index 9660368d67e..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/loadavg
+++ /dev/null
@@ -1 +0,0 @@
-0.10 0.15 0.14 1/538 27757
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/meminfo b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/meminfo
deleted file mode 100644
index 361aa6656a8..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/meminfo
+++ /dev/null
@@ -1,42 +0,0 @@
-MemTotal: 3768292 kB
-MemFree: 831872 kB
-Buffers: 153268 kB
-Cached: 1622412 kB
-SwapCached: 0 kB
-Active: 1287508 kB
-Inactive: 1297924 kB
-Active(anon): 811384 kB
-Inactive(anon): 227652 kB
-Active(file): 476124 kB
-Inactive(file): 1070272 kB
-Unevictable: 196 kB
-Mlocked: 196 kB
-SwapTotal: 7907324 kB
-SwapFree: 7907324 kB
-Dirty: 228 kB
-Writeback: 0 kB
-AnonPages: 809948 kB
-Mapped: 226452 kB
-Shmem: 229284 kB
-Slab: 210268 kB
-SReclaimable: 148028 kB
-SUnreclaim: 62240 kB
-KernelStack: 4344 kB
-PageTables: 37932 kB
-NFS_Unstable: 0 kB
-Bounce: 0 kB
-WritebackTmp: 0 kB
-CommitLimit: 9791468 kB
-Committed_AS: 4513904 kB
-VmallocTotal: 34359738367 kB
-VmallocUsed: 368496 kB
-VmallocChunk: 34359365956 kB
-HardwareCorrupted: 0 kB
-AnonHugePages: 0 kB
-HugePages_Total: 0
-HugePages_Free: 0
-HugePages_Rsvd: 0
-HugePages_Surp: 0
-Hugepagesize: 2048 kB
-DirectMap4k: 126592 kB
-DirectMap2M: 3786752 kB
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat0 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat0
deleted file mode 100644
index ce37972c69c..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat0
+++ /dev/null
@@ -1 +0,0 @@
-28267 (go-top) S 28256 28256 27864 34816 28256 4202496 736 0 0 0 17470 14 0 0 20 0 7 0 1882735 274173952 571 18446744073709551615 4194368 5592552 140737466979680 139798064197344 4333379 0 0 0 2143420159 18446744073709551615 0 0 17 1 0 0 0 0 0
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat1 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat1
deleted file mode 100644
index c77ddceba5d..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat1
+++ /dev/null
@@ -1 +0,0 @@
-28267 (go-top) R 28256 28256 27864 34816 28256 4202496 736 0 0 0 18773 16 0 0 20 0 7 0 1882735 274173952 571 18446744073709551615 4194368 5592552 140737466979680 139798065368712 4457862 0 0 0 2143420159 18446744073709551615 0 0 17 3 0 0 0 0 0
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat2 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat2
deleted file mode 100644
index 660b5e203ab..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat2
+++ /dev/null
@@ -1 +0,0 @@
-28267 (go-top) R 28256 28256 27864 34816 28256 4202496 738 0 0 0 20618 18 0 0 20 0 7 0 1882735 274239488 571 18446744073709551615 4194368 5592552 140737466979680 140737466979424 4203351 0 0 0 2143420159 18446744073709551615 0 0 17 0 0 0 0 0 0
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat3 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat3
deleted file mode 100644
index 707291e5fb9..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat3
+++ /dev/null
@@ -1 +0,0 @@
-28267 (go-top) R 28256 28256 27864 34816 28256 4202496 738 0 0 0 21641 19 0 0 20 0 7 0 1882735 274239488 571 18446744073709551615 4194368 5592552 140737466979680 139798065356424 4333379 0 0 0 2143420159 18446744073709551615 0 0 17 0 0 0 0 0 0
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat5 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat5
deleted file mode 100644
index 409e572983a..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat5
+++ /dev/null
@@ -1 +0,0 @@
-28267 (go-top) R 28256 28256 27864 34816 28256 4202496 738 0 0 0 23722 21 0 0 20 0 7 0 1882735 274239488 571 18446744073709551615 4194368 5592552 140737466979680 139798065368712 4203351 0 0 0 2143420159 18446744073709551615 0 0 17 1 0 0 0 0 0
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat6 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat6
deleted file mode 100644
index a4bffeb6705..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/procstat6
+++ /dev/null
@@ -1 +0,0 @@
-28267 (go-top) S 28256 28256 27864 34816 28256 4202496 741 0 0 0 25512 22 0 0 20 0 7 0 1882735 274305024 571 18446744073709551615 4194368 5592552 140737466979680 140737466979424 4333379 0 0 0 2143420159 18446744073709551615 0 0 17 2 0 0 0 0 0
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat
deleted file mode 100644
index 3e39653ddd2..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat
+++ /dev/null
@@ -1,12 +0,0 @@
-cpu 17313 714 8241 717906 1456 0 364 0 0 0
-cpu0 6642 289 3526 173411 1162 0 355 0 0 0
-cpu1 2193 88 1066 183608 86 0 2 0 0 0
-cpu2 6463 217 2578 177186 141 0 4 0 0 0
-cpu3 2014 118 1070 183699 65 0 2 0 0 0
-intr 2312829 54 5540 0 0 0 0 0 0 1 24723 0 0 262321 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124099 1226 121928 26 141511 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 3689186
-btime 1374442803
-processes 27752
-procs_running 1
-procs_blocked 0
-softirq 923034 6 201522 63 2716 129127 6 168304 89194 629 331467
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat2 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat2
deleted file mode 100644
index e455027c2cf..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat2
+++ /dev/null
@@ -1,12 +0,0 @@
-cpu 17328 714 8254 725156 1457 0 366 0 0 0
-cpu0 6648 289 3531 175213 1164 0 356 0 0 0
-cpu1 2198 88 1066 185425 86 0 2 0 0 0
-cpu2 6466 217 2584 178996 141 0 4 0 0 0
-cpu3 2015 118 1071 185521 65 0 2 0 0 0
-intr 2316896 54 5562 0 0 0 0 0 0 1 24939 0 0 262321 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124124 1226 123058 26 142249 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 3694091
-btime 1374442803
-processes 27777
-procs_running 1
-procs_blocked 0
-softirq 925673 6 202044 63 2716 129146 6 169061 89550 633 332448
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat3 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat3
deleted file mode 100644
index 7e40bf388b6..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat3
+++ /dev/null
@@ -1,12 +0,0 @@
-cpu 18661 714 8322 736828 1463 0 367 0 0 0
-cpu0 6715 289 3555 178374 1170 0 358 0 0 0
-cpu1 3134 88 1080 187754 86 0 2 0 0 0
-cpu2 6769 217 2603 181942 141 0 4 0 0 0
-cpu3 2042 118 1082 188756 65 0 2 0 0 0
-intr 2346985 54 5673 0 0 0 0 0 0 1 25358 0 0 269347 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124230 1226 125412 26 143648 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 3722386
-btime 1374442803
-processes 27939
-procs_running 2
-procs_blocked 0
-softirq 939514 6 208124 63 2720 129245 6 170565 91355 637 336793
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat4 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat4
deleted file mode 100644
index 2f61f46e2dd..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat4
+++ /dev/null
@@ -1,12 +0,0 @@
-cpu 24106 714 8436 758512 1472 0 372 0 0 0
-cpu0 7831 289 3602 183989 1177 0 361 0 0 0
-cpu1 5075 88 1096 192627 86 0 3 0 0 0
-cpu2 7667 217 2640 187814 142 0 5 0 0 0
-cpu3 3531 118 1096 194081 66 0 2 0 0 0
-intr 2425351 54 5880 0 0 0 0 0 0 1 26243 0 0 282247 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124425 1226 130129 26 146647 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 3788723
-btime 1374442803
-processes 28152
-procs_running 1
-procs_blocked 0
-softirq 975972 6 226788 63 2738 129419 6 173753 98111 659 344429
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat5 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat5
deleted file mode 100644
index b51720f07e4..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat5
+++ /dev/null
@@ -1,12 +0,0 @@
-cpu 25797 714 8461 761860 1472 0 375 0 0 0
-cpu0 8406 289 3611 184664 1177 0 364 0 0 0
-cpu1 5391 88 1102 193577 86 0 3 0 0 0
-cpu2 8115 217 2646 188622 142 0 5 0 0 0
-cpu3 3884 118 1100 194996 66 0 2 0 0 0
-intr 2446830 54 5896 0 0 0 0 0 0 1 26399 0 0 286933 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124455 1226 131103 26 147182 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 3804378
-btime 1374442803
-processes 28177
-procs_running 3
-procs_blocked 0
-softirq 985047 6 231802 63 2740 129448 6 174303 100182 665 345832
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat6 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat6
deleted file mode 100644
index 54ea5d0fd28..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat6
+++ /dev/null
@@ -1,12 +0,0 @@
-cpu 31643 714 8507 766175 1477 0 377 0 0 0
-cpu0 9865 289 3628 185726 1182 0 366 0 0 0
-cpu1 6867 88 1110 194656 86 0 3 0 0 0
-cpu2 9658 217 2661 189610 142 0 5 0 0 0
-cpu3 5252 118 1108 196181 66 0 2 0 0 0
-intr 2492898 54 5942 0 0 0 0 0 0 1 26734 0 0 291667 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124574 1226 133046 26 148246 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 3836141
-btime 1374442803
-processes 28244
-procs_running 5
-procs_blocked 0
-softirq 1009821 6 247713 63 2748 129565 6 175417 104452 670 349181
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat7 b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat7
deleted file mode 100644
index 6ff438a421a..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/stat7
+++ /dev/null
@@ -1,12 +0,0 @@
-cpu 32813 714 8513 766223 1477 0 377 0 0 0
-cpu0 10159 289 3628 185737 1182 0 367 0 0 0
-cpu1 7162 88 1110 194668 86 0 3 0 0 0
-cpu2 9945 217 2664 189623 142 0 5 0 0 0
-cpu3 5546 118 1109 196193 66 0 2 0 0 0
-intr 2498999 54 5954 0 0 0 0 0 0 1 26770 0 0 291667 0 0 0 733 0 0 34 0 0 0 141 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124585 1226 133246 26 148377 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 3839591
-btime 1374442803
-processes 28269
-procs_running 5
-procs_blocked 0
-softirq 1014220 6 250668 63 2748 129576 6 175558 105038 670 349887
diff --git a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/uptime b/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/uptime
deleted file mode 100644
index 05adb73bc2c..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/bertimus9/systemstat/testdata/uptime
+++ /dev/null
@@ -1 +0,0 @@
-18667.53 7140.26
diff --git a/Godeps/_workspace/src/bitbucket.org/ww/goautoneg/autoneg_test.go b/Godeps/_workspace/src/bitbucket.org/ww/goautoneg/autoneg_test.go
deleted file mode 100644
index 41d328f1d5f..00000000000
--- a/Godeps/_workspace/src/bitbucket.org/ww/goautoneg/autoneg_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package goautoneg
-
-import (
- "testing"
-)
-
-var chrome = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
-
-func TestParseAccept(t *testing.T) {
- alternatives := []string{"text/html", "image/png"}
- content_type := Negotiate(chrome, alternatives)
- if content_type != "image/png" {
- t.Errorf("got %s expected image/png", content_type)
- }
-
- alternatives = []string{"text/html", "text/plain", "text/n3"}
- content_type = Negotiate(chrome, alternatives)
- if content_type != "text/html" {
- t.Errorf("got %s expected text/html", content_type)
- }
-
- alternatives = []string{"text/n3", "text/plain"}
- content_type = Negotiate(chrome, alternatives)
- if content_type != "text/plain" {
- t.Errorf("got %s expected text/plain", content_type)
- }
-
- alternatives = []string{"text/n3", "application/rdf+xml"}
- content_type = Negotiate(chrome, alternatives)
- if content_type != "text/n3" {
- t.Errorf("got %s expected text/n3", content_type)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/ClusterHQ/flocker-go/client_test.go b/Godeps/_workspace/src/github.com/ClusterHQ/flocker-go/client_test.go
deleted file mode 100644
index ef0feaf7e97..00000000000
--- a/Godeps/_workspace/src/github.com/ClusterHQ/flocker-go/client_test.go
+++ /dev/null
@@ -1,316 +0,0 @@
-package flocker
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "net/url"
- "strconv"
- "strings"
- "testing"
- "time"
-
- "k8s.io/kubernetes/pkg/volume"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestMaximumSizeIs1024Multiple(t *testing.T) {
- assert := assert.New(t)
-
- n, err := strconv.Atoi(string(defaultVolumeSize))
- assert.NoError(err)
- assert.Equal(0, n%1024)
-}
-
-func TestPost(t *testing.T) {
- const (
- expectedPayload = "foobar"
- expectedStatusCode = 418
- )
-
- assert := assert.New(t)
-
- type payload struct {
- Test string `json:"test"`
- }
-
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- var result payload
- err := json.NewDecoder(r.Body).Decode(&result)
- assert.NoError(err)
- assert.Equal(expectedPayload, result.Test)
- w.WriteHeader(expectedStatusCode)
- }))
- defer ts.Close()
-
- c := Client{Client: &http.Client{}}
-
- resp, err := c.post(ts.URL, payload{expectedPayload})
- assert.NoError(err)
- assert.Equal(expectedStatusCode, resp.StatusCode)
-}
-
-func TestGet(t *testing.T) {
- const (
- expectedStatusCode = 418
- )
-
- assert := assert.New(t)
-
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(expectedStatusCode)
- }))
- defer ts.Close()
-
- c := Client{Client: &http.Client{}}
-
- resp, err := c.get(ts.URL)
- assert.NoError(err)
- assert.Equal(expectedStatusCode, resp.StatusCode)
-}
-
-func TestFindIDInConfigurationsPayload(t *testing.T) {
- const (
- searchedName = "search-for-this-name"
- expected = "The-42-id"
- )
- assert := assert.New(t)
-
- c := Client{}
-
- payload := fmt.Sprintf(
- `[{"dataset_id": "1-2-3", "metadata": {"name": "test"}}, {"dataset_id": "The-42-id", "metadata": {"name": "%s"}}]`,
- searchedName,
- )
-
- id, err := c.findIDInConfigurationsPayload(
- ioutil.NopCloser(bytes.NewBufferString(payload)), searchedName,
- )
- assert.NoError(err)
- assert.Equal(expected, id)
-
- id, err = c.findIDInConfigurationsPayload(
- ioutil.NopCloser(bytes.NewBufferString(payload)), "it will not be found",
- )
- assert.Equal(errConfigurationNotFound, err)
-
- id, err = c.findIDInConfigurationsPayload(
- ioutil.NopCloser(bytes.NewBufferString("invalid { json")), "",
- )
- assert.Error(err)
-}
-
-func TestFindPrimaryUUID(t *testing.T) {
- const expectedPrimary = "primary-uuid"
- assert := assert.New(t)
-
- var (
- mockedHost = "127.0.0.1"
- mockedPrimary = expectedPrimary
- )
-
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- assert.Equal("GET", r.Method)
- assert.Equal("/v1/state/nodes", r.URL.Path)
- w.Write([]byte(fmt.Sprintf(`[{"host": "%s", "uuid": "%s"}]`, mockedHost, mockedPrimary)))
- }))
-
- host, port, err := getHostAndPortFromTestServer(ts)
- assert.NoError(err)
-
- c := newFlockerTestClient(host, port)
- assert.NoError(err)
-
- mockedPrimary = expectedPrimary
- primary, err := c.GetPrimaryUUID()
- assert.NoError(err)
- assert.Equal(expectedPrimary, primary)
-
- c.clientIP = "not.found"
- _, err = c.GetPrimaryUUID()
- assert.Equal(errStateNotFound, err)
-}
-
-func TestGetURL(t *testing.T) {
- const (
- expectedHost = "host"
- expectedPort = 42
- )
-
- assert := assert.New(t)
-
- c := newFlockerTestClient(expectedHost, expectedPort)
- var expectedURL = fmt.Sprintf("%s://%s:%d/v1/test", c.schema, expectedHost, expectedPort)
-
- url := c.getURL("test")
- assert.Equal(expectedURL, url)
-}
-
-func getHostAndPortFromTestServer(ts *httptest.Server) (string, int, error) {
- tsURL, err := url.Parse(ts.URL)
- if err != nil {
- return "", 0, err
- }
-
- hostSplits := strings.Split(tsURL.Host, ":")
-
- port, err := strconv.Atoi(hostSplits[1])
- if err != nil {
- return "", 0, nil
- }
- return hostSplits[0], port, nil
-}
-
-func getVolumeConfig(host string, port int) volume.VolumeConfig {
- return volume.VolumeConfig{
- OtherAttributes: map[string]string{
- "CONTROL_SERVICE_HOST": host,
- "CONTROL_SERVICE_PORT": strconv.Itoa(port),
- },
- }
-}
-
-func TestHappyPathCreateDatasetFromNonExistent(t *testing.T) {
- const (
- expectedDatasetName = "dir"
- expectedPrimary = "A-B-C-D"
- expectedDatasetID = "datasetID"
- )
- expectedPath := fmt.Sprintf("/flocker/%s", expectedDatasetID)
-
- assert := assert.New(t)
- var (
- numCalls int
- err error
- )
-
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- numCalls++
- switch numCalls {
- case 1:
- assert.Equal("GET", r.Method)
- assert.Equal("/v1/state/nodes", r.URL.Path)
- w.Write([]byte(fmt.Sprintf(`[{"host": "127.0.0.1", "uuid": "%s"}]`, expectedPrimary)))
- case 2:
- assert.Equal("POST", r.Method)
- assert.Equal("/v1/configuration/datasets", r.URL.Path)
-
- var c configurationPayload
- err := json.NewDecoder(r.Body).Decode(&c)
- assert.NoError(err)
- assert.Equal(expectedPrimary, c.Primary)
- assert.Equal(defaultVolumeSize, c.MaximumSize)
- assert.Equal(expectedDatasetName, c.Metadata.Name)
-
- w.Write([]byte(fmt.Sprintf(`{"dataset_id": "%s"}`, expectedDatasetID)))
- case 3:
- assert.Equal("GET", r.Method)
- assert.Equal("/v1/state/datasets", r.URL.Path)
- w.Write([]byte(`[]`))
- case 4:
- assert.Equal("GET", r.Method)
- assert.Equal("/v1/state/datasets", r.URL.Path)
- w.Write([]byte(fmt.Sprintf(`[{"dataset_id": "%s", "path": "/flocker/%s"}]`, expectedDatasetID, expectedDatasetID)))
- }
- }))
-
- host, port, err := getHostAndPortFromTestServer(ts)
- assert.NoError(err)
-
- c := newFlockerTestClient(host, port)
- assert.NoError(err)
-
- tickerWaitingForVolume = 1 * time.Millisecond // TODO: this is overriding globally
-
- s, err := c.CreateDataset(expectedDatasetName)
- assert.NoError(err)
- assert.Equal(expectedPath, s.Path)
-}
-
-func TestCreateDatasetThatAlreadyExists(t *testing.T) {
- const (
- datasetName = "dir"
- expectedPrimary = "A-B-C-D"
- )
-
- assert := assert.New(t)
- var numCalls int
-
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- numCalls++
- switch numCalls {
- case 1:
- assert.Equal("GET", r.Method)
- assert.Equal("/v1/state/nodes", r.URL.Path)
- w.Write([]byte(fmt.Sprintf(`[{"host": "127.0.0.1", "uuid": "%s"}]`, expectedPrimary)))
- case 2:
- assert.Equal("POST", r.Method)
- assert.Equal("/v1/configuration/datasets", r.URL.Path)
- w.WriteHeader(http.StatusConflict)
- }
- }))
-
- host, port, err := getHostAndPortFromTestServer(ts)
- assert.NoError(err)
-
- c := newFlockerTestClient(host, port)
- assert.NoError(err)
-
- _, err = c.CreateDataset(datasetName)
- assert.Equal(errVolumeAlreadyExists, err)
-}
-
-func TestUpdatePrimaryForDataset(t *testing.T) {
- const (
- dir = "dir"
- expectedPrimary = "the-new-primary"
- expectedDatasetID = "datasetID"
- )
- expectedURL := fmt.Sprintf("/v1/configuration/datasets/%s", expectedDatasetID)
-
- assert := assert.New(t)
-
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- assert.Equal("POST", r.Method)
- assert.Equal(expectedURL, r.URL.Path)
-
- var c configurationPayload
- err := json.NewDecoder(r.Body).Decode(&c)
- assert.NoError(err)
-
- assert.Equal(expectedPrimary, c.Primary)
-
- w.Write([]byte(fmt.Sprintf(`{"dataset_id": "%s", "path": "just-to-double-check"}`, expectedDatasetID)))
- }))
-
- host, port, err := getHostAndPortFromTestServer(ts)
- assert.NoError(err)
-
- c := newFlockerTestClient(host, port)
- assert.NoError(err)
-
- s, err := c.UpdatePrimaryForDataset(expectedPrimary, expectedDatasetID)
- assert.NoError(err)
- assert.Equal(expectedDatasetID, s.DatasetID)
- assert.NotEqual("", s.Path)
-}
-
-func TestInterfaceIsImplemented(t *testing.T) {
- assert.Implements(t, (*Clientable)(nil), Client{})
-}
-
-func newFlockerTestClient(host string, port int) *Client {
- return &Client{
- Client: &http.Client{},
- host: host,
- port: port,
- version: "v1",
- schema: "http",
- maximumSize: defaultVolumeSize,
- clientIP: "127.0.0.1",
- }
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/entry_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/entry_test.go
deleted file mode 100644
index 98717df4901..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/entry_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "fmt"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestEntryPanicln(t *testing.T) {
- errBoom := fmt.Errorf("boom time")
-
- defer func() {
- p := recover()
- assert.NotNil(t, p)
-
- switch pVal := p.(type) {
- case *Entry:
- assert.Equal(t, "kaboom", pVal.Message)
- assert.Equal(t, errBoom, pVal.Data["err"])
- default:
- t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal)
- }
- }()
-
- logger := New()
- logger.Out = &bytes.Buffer{}
- entry := NewEntry(logger)
- entry.WithField("err", errBoom).Panicln("kaboom")
-}
-
-func TestEntryPanicf(t *testing.T) {
- errBoom := fmt.Errorf("boom again")
-
- defer func() {
- p := recover()
- assert.NotNil(t, p)
-
- switch pVal := p.(type) {
- case *Entry:
- assert.Equal(t, "kaboom true", pVal.Message)
- assert.Equal(t, errBoom, pVal.Data["err"])
- default:
- t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal)
- }
- }()
-
- logger := New()
- logger.Out = &bytes.Buffer{}
- entry := NewEntry(logger)
- entry.WithField("err", errBoom).Panicf("kaboom %v", true)
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/formatter_bench_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/formatter_bench_test.go
deleted file mode 100644
index 77989da6297..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/formatter_bench_test.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package logrus
-
-import (
- "testing"
- "time"
-)
-
-// smallFields is a small size data set for benchmarking
-var smallFields = Fields{
- "foo": "bar",
- "baz": "qux",
- "one": "two",
- "three": "four",
-}
-
-// largeFields is a large size data set for benchmarking
-var largeFields = Fields{
- "foo": "bar",
- "baz": "qux",
- "one": "two",
- "three": "four",
- "five": "six",
- "seven": "eight",
- "nine": "ten",
- "eleven": "twelve",
- "thirteen": "fourteen",
- "fifteen": "sixteen",
- "seventeen": "eighteen",
- "nineteen": "twenty",
- "a": "b",
- "c": "d",
- "e": "f",
- "g": "h",
- "i": "j",
- "k": "l",
- "m": "n",
- "o": "p",
- "q": "r",
- "s": "t",
- "u": "v",
- "w": "x",
- "y": "z",
- "this": "will",
- "make": "thirty",
- "entries": "yeah",
-}
-
-func BenchmarkSmallTextFormatter(b *testing.B) {
- doBenchmark(b, &TextFormatter{DisableColors: true}, smallFields)
-}
-
-func BenchmarkLargeTextFormatter(b *testing.B) {
- doBenchmark(b, &TextFormatter{DisableColors: true}, largeFields)
-}
-
-func BenchmarkSmallColoredTextFormatter(b *testing.B) {
- doBenchmark(b, &TextFormatter{ForceColors: true}, smallFields)
-}
-
-func BenchmarkLargeColoredTextFormatter(b *testing.B) {
- doBenchmark(b, &TextFormatter{ForceColors: true}, largeFields)
-}
-
-func BenchmarkSmallJSONFormatter(b *testing.B) {
- doBenchmark(b, &JSONFormatter{}, smallFields)
-}
-
-func BenchmarkLargeJSONFormatter(b *testing.B) {
- doBenchmark(b, &JSONFormatter{}, largeFields)
-}
-
-func doBenchmark(b *testing.B, formatter Formatter, fields Fields) {
- entry := &Entry{
- Time: time.Time{},
- Level: InfoLevel,
- Message: "message",
- Data: fields,
- }
- var d []byte
- var err error
- for i := 0; i < b.N; i++ {
- d, err = formatter.Format(entry)
- if err != nil {
- b.Fatal(err)
- }
- b.SetBytes(int64(len(d)))
- }
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hook_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/hook_test.go
deleted file mode 100644
index 13f34cb6f81..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hook_test.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package logrus
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-type TestHook struct {
- Fired bool
-}
-
-func (hook *TestHook) Fire(entry *Entry) error {
- hook.Fired = true
- return nil
-}
-
-func (hook *TestHook) Levels() []Level {
- return []Level{
- DebugLevel,
- InfoLevel,
- WarnLevel,
- ErrorLevel,
- FatalLevel,
- PanicLevel,
- }
-}
-
-func TestHookFires(t *testing.T) {
- hook := new(TestHook)
-
- LogAndAssertJSON(t, func(log *Logger) {
- log.Hooks.Add(hook)
- assert.Equal(t, hook.Fired, false)
-
- log.Print("test")
- }, func(fields Fields) {
- assert.Equal(t, hook.Fired, true)
- })
-}
-
-type ModifyHook struct {
-}
-
-func (hook *ModifyHook) Fire(entry *Entry) error {
- entry.Data["wow"] = "whale"
- return nil
-}
-
-func (hook *ModifyHook) Levels() []Level {
- return []Level{
- DebugLevel,
- InfoLevel,
- WarnLevel,
- ErrorLevel,
- FatalLevel,
- PanicLevel,
- }
-}
-
-func TestHookCanModifyEntry(t *testing.T) {
- hook := new(ModifyHook)
-
- LogAndAssertJSON(t, func(log *Logger) {
- log.Hooks.Add(hook)
- log.WithField("wow", "elephant").Print("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["wow"], "whale")
- })
-}
-
-func TestCanFireMultipleHooks(t *testing.T) {
- hook1 := new(ModifyHook)
- hook2 := new(TestHook)
-
- LogAndAssertJSON(t, func(log *Logger) {
- log.Hooks.Add(hook1)
- log.Hooks.Add(hook2)
-
- log.WithField("wow", "elephant").Print("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["wow"], "whale")
- assert.Equal(t, hook2.Fired, true)
- })
-}
-
-type ErrorHook struct {
- Fired bool
-}
-
-func (hook *ErrorHook) Fire(entry *Entry) error {
- hook.Fired = true
- return nil
-}
-
-func (hook *ErrorHook) Levels() []Level {
- return []Level{
- ErrorLevel,
- }
-}
-
-func TestErrorHookShouldntFireOnInfo(t *testing.T) {
- hook := new(ErrorHook)
-
- LogAndAssertJSON(t, func(log *Logger) {
- log.Hooks.Add(hook)
- log.Info("test")
- }, func(fields Fields) {
- assert.Equal(t, hook.Fired, false)
- })
-}
-
-func TestErrorHookShouldFireOnError(t *testing.T) {
- hook := new(ErrorHook)
-
- LogAndAssertJSON(t, func(log *Logger) {
- log.Hooks.Add(hook)
- log.Error("test")
- }, func(fields Fields) {
- assert.Equal(t, hook.Fired, true)
- })
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go
deleted file mode 100644
index 96318d00304..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package logrus_papertrail
-
-import (
- "fmt"
- "testing"
-
- "github.com/Sirupsen/logrus"
- "github.com/stvp/go-udp-testing"
-)
-
-func TestWritingToUDP(t *testing.T) {
- port := 16661
- udp.SetAddr(fmt.Sprintf(":%d", port))
-
- hook, err := NewPapertrailHook("localhost", port, "test")
- if err != nil {
- t.Errorf("Unable to connect to local UDP server.")
- }
-
- log := logrus.New()
- log.Hooks.Add(hook)
-
- udp.ShouldReceive(t, "foo", func() {
- log.Info("foo")
- })
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go
deleted file mode 100644
index 45f18d17047..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/sentry/sentry_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package logrus_sentry
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "strings"
- "testing"
-
- "github.com/Sirupsen/logrus"
- "github.com/getsentry/raven-go"
-)
-
-const (
- message = "error message"
- server_name = "testserver.internal"
- logger_name = "test.logger"
-)
-
-func getTestLogger() *logrus.Logger {
- l := logrus.New()
- l.Out = ioutil.Discard
- return l
-}
-
-func WithTestDSN(t *testing.T, tf func(string, <-chan *raven.Packet)) {
- pch := make(chan *raven.Packet, 1)
- s := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
- defer req.Body.Close()
- d := json.NewDecoder(req.Body)
- p := &raven.Packet{}
- err := d.Decode(p)
- if err != nil {
- t.Fatal(err.Error())
- }
-
- pch <- p
- }))
- defer s.Close()
-
- fragments := strings.SplitN(s.URL, "://", 2)
- dsn := fmt.Sprintf(
- "%s://public:secret@%s/sentry/project-id",
- fragments[0],
- fragments[1],
- )
- tf(dsn, pch)
-}
-
-func TestSpecialFields(t *testing.T) {
- WithTestDSN(t, func(dsn string, pch <-chan *raven.Packet) {
- logger := getTestLogger()
-
- hook, err := NewSentryHook(dsn, []logrus.Level{
- logrus.ErrorLevel,
- })
-
- if err != nil {
- t.Fatal(err.Error())
- }
- logger.Hooks.Add(hook)
- logger.WithFields(logrus.Fields{
- "server_name": server_name,
- "logger": logger_name,
- }).Error(message)
-
- packet := <-pch
- if packet.Logger != logger_name {
- t.Errorf("logger should have been %s, was %s", logger_name, packet.Logger)
- }
-
- if packet.ServerName != server_name {
- t.Errorf("server_name should have been %s, was %s", server_name, packet.ServerName)
- }
- })
-}
-
-func TestSentryHandler(t *testing.T) {
- WithTestDSN(t, func(dsn string, pch <-chan *raven.Packet) {
- logger := getTestLogger()
- hook, err := NewSentryHook(dsn, []logrus.Level{
- logrus.ErrorLevel,
- })
- if err != nil {
- t.Fatal(err.Error())
- }
- logger.Hooks.Add(hook)
-
- logger.Error(message)
- packet := <-pch
- if packet.Message != message {
- t.Errorf("message should have been %s, was %s", message, packet.Message)
- }
- })
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go
deleted file mode 100644
index 42762dc10d7..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package logrus_syslog
-
-import (
- "github.com/Sirupsen/logrus"
- "log/syslog"
- "testing"
-)
-
-func TestLocalhostAddAndPrint(t *testing.T) {
- log := logrus.New()
- hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
-
- if err != nil {
- t.Errorf("Unable to connect to local syslog.")
- }
-
- log.Hooks.Add(hook)
-
- for _, level := range hook.Levels() {
- if len(log.Hooks[level]) != 1 {
- t.Errorf("SyslogHook was not added. The length of log.Hooks[%v]: %v", level, len(log.Hooks[level]))
- }
- }
-
- log.Info("Congratulations!")
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/logrus_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/logrus_test.go
deleted file mode 100644
index 53025425816..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/logrus_test.go
+++ /dev/null
@@ -1,283 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "encoding/json"
- "strconv"
- "strings"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func LogAndAssertJSON(t *testing.T, log func(*Logger), assertions func(fields Fields)) {
- var buffer bytes.Buffer
- var fields Fields
-
- logger := New()
- logger.Out = &buffer
- logger.Formatter = new(JSONFormatter)
-
- log(logger)
-
- err := json.Unmarshal(buffer.Bytes(), &fields)
- assert.Nil(t, err)
-
- assertions(fields)
-}
-
-func LogAndAssertText(t *testing.T, log func(*Logger), assertions func(fields map[string]string)) {
- var buffer bytes.Buffer
-
- logger := New()
- logger.Out = &buffer
- logger.Formatter = &TextFormatter{
- DisableColors: true,
- }
-
- log(logger)
-
- fields := make(map[string]string)
- for _, kv := range strings.Split(buffer.String(), " ") {
- if !strings.Contains(kv, "=") {
- continue
- }
- kvArr := strings.Split(kv, "=")
- key := strings.TrimSpace(kvArr[0])
- val := kvArr[1]
- if kvArr[1][0] == '"' {
- var err error
- val, err = strconv.Unquote(val)
- assert.NoError(t, err)
- }
- fields[key] = val
- }
- assertions(fields)
-}
-
-func TestPrint(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Print("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test")
- assert.Equal(t, fields["level"], "info")
- })
-}
-
-func TestInfo(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Info("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test")
- assert.Equal(t, fields["level"], "info")
- })
-}
-
-func TestWarn(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Warn("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test")
- assert.Equal(t, fields["level"], "warning")
- })
-}
-
-func TestInfolnShouldAddSpacesBetweenStrings(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Infoln("test", "test")
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test test")
- })
-}
-
-func TestInfolnShouldAddSpacesBetweenStringAndNonstring(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Infoln("test", 10)
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test 10")
- })
-}
-
-func TestInfolnShouldAddSpacesBetweenTwoNonStrings(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Infoln(10, 10)
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "10 10")
- })
-}
-
-func TestInfoShouldAddSpacesBetweenTwoNonStrings(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Infoln(10, 10)
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "10 10")
- })
-}
-
-func TestInfoShouldNotAddSpacesBetweenStringAndNonstring(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Info("test", 10)
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test10")
- })
-}
-
-func TestInfoShouldNotAddSpacesBetweenStrings(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.Info("test", "test")
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "testtest")
- })
-}
-
-func TestWithFieldsShouldAllowAssignments(t *testing.T) {
- var buffer bytes.Buffer
- var fields Fields
-
- logger := New()
- logger.Out = &buffer
- logger.Formatter = new(JSONFormatter)
-
- localLog := logger.WithFields(Fields{
- "key1": "value1",
- })
-
- localLog.WithField("key2", "value2").Info("test")
- err := json.Unmarshal(buffer.Bytes(), &fields)
- assert.Nil(t, err)
-
- assert.Equal(t, "value2", fields["key2"])
- assert.Equal(t, "value1", fields["key1"])
-
- buffer = bytes.Buffer{}
- fields = Fields{}
- localLog.Info("test")
- err = json.Unmarshal(buffer.Bytes(), &fields)
- assert.Nil(t, err)
-
- _, ok := fields["key2"]
- assert.Equal(t, false, ok)
- assert.Equal(t, "value1", fields["key1"])
-}
-
-func TestUserSuppliedFieldDoesNotOverwriteDefaults(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.WithField("msg", "hello").Info("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test")
- })
-}
-
-func TestUserSuppliedMsgFieldHasPrefix(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.WithField("msg", "hello").Info("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["msg"], "test")
- assert.Equal(t, fields["fields.msg"], "hello")
- })
-}
-
-func TestUserSuppliedTimeFieldHasPrefix(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.WithField("time", "hello").Info("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["fields.time"], "hello")
- })
-}
-
-func TestUserSuppliedLevelFieldHasPrefix(t *testing.T) {
- LogAndAssertJSON(t, func(log *Logger) {
- log.WithField("level", 1).Info("test")
- }, func(fields Fields) {
- assert.Equal(t, fields["level"], "info")
- assert.Equal(t, fields["fields.level"], 1)
- })
-}
-
-func TestDefaultFieldsAreNotPrefixed(t *testing.T) {
- LogAndAssertText(t, func(log *Logger) {
- ll := log.WithField("herp", "derp")
- ll.Info("hello")
- ll.Info("bye")
- }, func(fields map[string]string) {
- for _, fieldName := range []string{"fields.level", "fields.time", "fields.msg"} {
- if _, ok := fields[fieldName]; ok {
- t.Fatalf("should not have prefixed %q: %v", fieldName, fields)
- }
- }
- })
-}
-
-func TestDoubleLoggingDoesntPrefixPreviousFields(t *testing.T) {
-
- var buffer bytes.Buffer
- var fields Fields
-
- logger := New()
- logger.Out = &buffer
- logger.Formatter = new(JSONFormatter)
-
- llog := logger.WithField("context", "eating raw fish")
-
- llog.Info("looks delicious")
-
- err := json.Unmarshal(buffer.Bytes(), &fields)
- assert.NoError(t, err, "should have decoded first message")
- assert.Len(t, fields, 4, "should only have msg/time/level/context fields")
- assert.Equal(t, fields["msg"], "looks delicious")
- assert.Equal(t, fields["context"], "eating raw fish")
-
- buffer.Reset()
-
- llog.Warn("omg it is!")
-
- err = json.Unmarshal(buffer.Bytes(), &fields)
- assert.NoError(t, err, "should have decoded second message")
- assert.Len(t, fields, 4, "should only have msg/time/level/context fields")
- assert.Equal(t, fields["msg"], "omg it is!")
- assert.Equal(t, fields["context"], "eating raw fish")
- assert.Nil(t, fields["fields.msg"], "should not have prefixed previous `msg` entry")
-
-}
-
-func TestConvertLevelToString(t *testing.T) {
- assert.Equal(t, "debug", DebugLevel.String())
- assert.Equal(t, "info", InfoLevel.String())
- assert.Equal(t, "warning", WarnLevel.String())
- assert.Equal(t, "error", ErrorLevel.String())
- assert.Equal(t, "fatal", FatalLevel.String())
- assert.Equal(t, "panic", PanicLevel.String())
-}
-
-func TestParseLevel(t *testing.T) {
- l, err := ParseLevel("panic")
- assert.Nil(t, err)
- assert.Equal(t, PanicLevel, l)
-
- l, err = ParseLevel("fatal")
- assert.Nil(t, err)
- assert.Equal(t, FatalLevel, l)
-
- l, err = ParseLevel("error")
- assert.Nil(t, err)
- assert.Equal(t, ErrorLevel, l)
-
- l, err = ParseLevel("warn")
- assert.Nil(t, err)
- assert.Equal(t, WarnLevel, l)
-
- l, err = ParseLevel("warning")
- assert.Nil(t, err)
- assert.Equal(t, WarnLevel, l)
-
- l, err = ParseLevel("info")
- assert.Nil(t, err)
- assert.Equal(t, InfoLevel, l)
-
- l, err = ParseLevel("debug")
- assert.Nil(t, err)
- assert.Equal(t, DebugLevel, l)
-
- l, err = ParseLevel("invalid")
- assert.Equal(t, "not a valid logrus Level: \"invalid\"", err.Error())
-}
diff --git a/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go b/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go
deleted file mode 100644
index f604f1b0026..00000000000
--- a/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "errors"
-
- "testing"
-)
-
-func TestQuoting(t *testing.T) {
- tf := &TextFormatter{DisableColors: true}
-
- checkQuoting := func(q bool, value interface{}) {
- b, _ := tf.Format(WithField("test", value))
- idx := bytes.Index(b, ([]byte)("test="))
- cont := bytes.Contains(b[idx+5:], []byte{'"'})
- if cont != q {
- if q {
- t.Errorf("quoting expected for: %#v", value)
- } else {
- t.Errorf("quoting not expected for: %#v", value)
- }
- }
- }
-
- checkQuoting(false, "abcd")
- checkQuoting(false, "v1.0")
- checkQuoting(true, "/foobar")
- checkQuoting(true, "x y")
- checkQuoting(true, "x,y")
- checkQuoting(false, errors.New("invalid"))
- checkQuoting(true, errors.New("invalid argument"))
-}
diff --git a/Godeps/_workspace/src/github.com/abbot/go-http-auth/basic_test.go b/Godeps/_workspace/src/github.com/abbot/go-http-auth/basic_test.go
deleted file mode 100644
index 522e00ff15f..00000000000
--- a/Godeps/_workspace/src/github.com/abbot/go-http-auth/basic_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package auth
-
-import (
- "encoding/base64"
- "net/http"
- "testing"
-)
-
-func TestAuthBasic(t *testing.T) {
- secrets := HtpasswdFileProvider("test.htpasswd")
- a := &BasicAuth{Realm: "example.com", Secrets: secrets}
- r := &http.Request{}
- r.Method = "GET"
- if a.CheckAuth(r) != "" {
- t.Fatal("CheckAuth passed on empty headers")
- }
- r.Header = http.Header(make(map[string][]string))
- r.Header.Set("Authorization", "Digest blabla ololo")
- if a.CheckAuth(r) != "" {
- t.Fatal("CheckAuth passed on bad headers")
- }
- r.Header.Set("Authorization", "Basic !@#")
- if a.CheckAuth(r) != "" {
- t.Fatal("CheckAuth passed on bad base64 data")
- }
-
- data := [][]string{
- {"test", "hello"},
- {"test2", "hello2"},
- }
- for _, tc := range data {
- auth := base64.StdEncoding.EncodeToString([]byte(tc[0] + ":" + tc[1]))
- r.Header.Set("Authorization", "Basic "+auth)
- if a.CheckAuth(r) != tc[0] {
- t.Fatalf("CheckAuth failed for user '%s'", tc[0])
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/abbot/go-http-auth/digest_test.go b/Godeps/_workspace/src/github.com/abbot/go-http-auth/digest_test.go
deleted file mode 100644
index b4da0814ae7..00000000000
--- a/Godeps/_workspace/src/github.com/abbot/go-http-auth/digest_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package auth
-
-import (
- "net/http"
- "net/url"
- "testing"
- "time"
-)
-
-func TestAuthDigest(t *testing.T) {
- secrets := HtdigestFileProvider("test.htdigest")
- da := &DigestAuth{Opaque: "U7H+ier3Ae8Skd/g",
- Realm: "example.com",
- Secrets: secrets,
- clients: map[string]*digest_client{}}
- r := &http.Request{}
- r.Method = "GET"
- if u, _ := da.CheckAuth(r); u != "" {
- t.Fatal("non-empty auth for empty request header")
- }
- r.Header = http.Header(make(map[string][]string))
- r.Header.Set("Authorization", "Digest blabla")
- if u, _ := da.CheckAuth(r); u != "" {
- t.Fatal("non-empty auth for bad request header")
- }
- r.Header.Set("Authorization", `Digest username="test", realm="example.com", nonce="Vb9BP/h81n3GpTTB", uri="/t2", cnonce="NjE4MTM2", nc=00000001, qop="auth", response="ffc357c4eba74773c8687e0bc724c9a3", opaque="U7H+ier3Ae8Skd/g", algorithm="MD5"`)
- if u, _ := da.CheckAuth(r); u != "" {
- t.Fatal("non-empty auth for unknown client")
- }
-
- r.URL, _ = url.Parse("/t2")
- da.clients["Vb9BP/h81n3GpTTB"] = &digest_client{nc: 0, last_seen: time.Now().UnixNano()}
- if u, _ := da.CheckAuth(r); u != "test" {
- t.Fatal("empty auth for legitimate client")
- }
- if u, _ := da.CheckAuth(r); u != "" {
- t.Fatal("non-empty auth for outdated nc")
- }
-
- r.URL, _ = url.Parse("/")
- da.clients["Vb9BP/h81n3GpTTB"] = &digest_client{nc: 0, last_seen: time.Now().UnixNano()}
- if u, _ := da.CheckAuth(r); u != "" {
- t.Fatal("non-empty auth for bad request path")
- }
-
- r.URL, _ = url.Parse("/t3")
- da.clients["Vb9BP/h81n3GpTTB"] = &digest_client{nc: 0, last_seen: time.Now().UnixNano()}
- if u, _ := da.CheckAuth(r); u != "" {
- t.Fatal("non-empty auth for bad request path")
- }
-
- da.clients["+RbVXSbIoa1SaJk1"] = &digest_client{nc: 0, last_seen: time.Now().UnixNano()}
- r.Header.Set("Authorization", `Digest username="test", realm="example.com", nonce="+RbVXSbIoa1SaJk1", uri="/", cnonce="NjE4NDkw", nc=00000001, qop="auth", response="c08918024d7faaabd5424654c4e3ad1c", opaque="U7H+ier3Ae8Skd/g", algorithm="MD5"`)
- if u, _ := da.CheckAuth(r); u != "test" {
- t.Fatal("empty auth for valid request in subpath")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/abbot/go-http-auth/md5crypt_test.go b/Godeps/_workspace/src/github.com/abbot/go-http-auth/md5crypt_test.go
deleted file mode 100644
index 65738ecefa4..00000000000
--- a/Godeps/_workspace/src/github.com/abbot/go-http-auth/md5crypt_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package auth
-
-import "testing"
-
-func Test_MD5Crypt(t *testing.T) {
- test_cases := [][]string{
- {"apache", "$apr1$J.w5a/..$IW9y6DR0oO/ADuhlMF5/X1"},
- {"pass", "$1$YeNsbWdH$wvOF8JdqsoiLix754LTW90"},
- }
- for _, tc := range test_cases {
- e := NewMD5Entry(tc[1])
- result := MD5Crypt([]byte(tc[0]), e.Salt, e.Magic)
- if string(result) != tc[1] {
- t.Fatalf("MD5Crypt returned '%s' instead of '%s'", string(result), tc[1])
- }
- t.Logf("MD5Crypt: '%s' (%s%s$) -> %s", tc[0], e.Magic, e.Salt, result)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/abbot/go-http-auth/misc_test.go b/Godeps/_workspace/src/github.com/abbot/go-http-auth/misc_test.go
deleted file mode 100644
index 089524c7c0d..00000000000
--- a/Godeps/_workspace/src/github.com/abbot/go-http-auth/misc_test.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package auth
-
-import "testing"
-
-func TestH(t *testing.T) {
- const hello = "Hello, world!"
- const hello_md5 = "6cd3556deb0da54bca060b4c39479839"
- h := H(hello)
- if h != hello_md5 {
- t.Fatal("Incorrect digest for test string:", h, "instead of", hello_md5)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/abbot/go-http-auth/users_test.go b/Godeps/_workspace/src/github.com/abbot/go-http-auth/users_test.go
deleted file mode 100644
index 4fbe8875103..00000000000
--- a/Godeps/_workspace/src/github.com/abbot/go-http-auth/users_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package auth
-
-import (
- "testing"
-)
-
-func TestHtdigestFile(t *testing.T) {
- secrets := HtdigestFileProvider("test.htdigest")
- digest := secrets("test", "example.com")
- if digest != "aa78524fceb0e50fd8ca96dd818b8cf9" {
- t.Fatal("Incorrect digest for test user:", digest)
- }
- digest = secrets("test", "example1.com")
- if digest != "" {
- t.Fatal("Got digest for user in non-existant realm:", digest)
- }
- digest = secrets("test1", "example.com")
- if digest != "" {
- t.Fatal("Got digest for non-existant user:", digest)
- }
-}
-
-func TestHtpasswdFile(t *testing.T) {
- secrets := HtpasswdFileProvider("test.htpasswd")
- passwd := secrets("test", "blah")
- if passwd != "{SHA}qvTGHdzF6KLavt4PO0gs2a6pQ00=" {
- t.Fatal("Incorrect passwd for test user:", passwd)
- }
- passwd = secrets("test3", "blah")
- if passwd != "" {
- t.Fatal("Got passwd for non-existant user:", passwd)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/image_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/image_test.go
deleted file mode 100644
index dd9aeb37689..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/image_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package schema
-
-import "testing"
-
-func TestEmptyApp(t *testing.T) {
- imj := `
- {
- "acKind": "ImageManifest",
- "acVersion": "0.6.1",
- "name": "example.com/test"
- }
- `
-
- var im ImageManifest
-
- err := im.UnmarshalJSON([]byte(imj))
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- // Marshal and Unmarshal to verify that no "app": {} is generated on
- // Marshal and converted to empty struct on Unmarshal
- buf, err := im.MarshalJSON()
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- err = im.UnmarshalJSON(buf)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-}
-
-func TestImageManifestMerge(t *testing.T) {
- imj := `{"name": "example.com/test"}`
- im := &ImageManifest{}
-
- if im.UnmarshalJSON([]byte(imj)) == nil {
- t.Fatal("Manifest JSON without acKind and acVersion unmarshalled successfully")
- }
-
- im = BlankImageManifest()
-
- err := im.UnmarshalJSON([]byte(imj))
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/pod_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/pod_test.go
deleted file mode 100644
index 978e99dc3f2..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/pod_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package schema
-
-import (
- "testing"
-
- "github.com/appc/spec/schema/types"
-)
-
-func TestPodManifestMerge(t *testing.T) {
- pmj := `{}`
- pm := &PodManifest{}
-
- if pm.UnmarshalJSON([]byte(pmj)) == nil {
- t.Fatal("Manifest JSON without acKind and acVersion unmarshalled successfully")
- }
-
- pm = BlankPodManifest()
-
- err := pm.UnmarshalJSON([]byte(pmj))
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-}
-
-func TestAppList(t *testing.T) {
- ri := RuntimeImage{
- ID: *types.NewHashSHA512([]byte{}),
- }
- al := AppList{
- RuntimeApp{
- Name: "foo",
- Image: ri,
- },
- RuntimeApp{
- Name: "bar",
- Image: ri,
- },
- }
- if _, err := al.MarshalJSON(); err != nil {
- t.Errorf("want err=nil, got %v", err)
- }
- dal := AppList{
- RuntimeApp{
- Name: "foo",
- Image: ri,
- },
- RuntimeApp{
- Name: "bar",
- Image: ri,
- },
- RuntimeApp{
- Name: "foo",
- Image: ri,
- },
- }
- if _, err := dal.MarshalJSON(); err == nil {
- t.Errorf("want err, got nil")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/acidentifier_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/acidentifier_test.go
deleted file mode 100644
index b662705031f..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/acidentifier_test.go
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-)
-
-var (
- goodIdentifiers = []string{
- "asdf",
- "foo-bar-baz",
- "zab_rab_oof",
- "database",
- "my~database",
- "example.com/database",
- "example.com/~bob/database",
- "example.com/ourapp-1.0.0",
- "sub-domain.example.com/org/product/release-1.0.0",
- "sub-domain.example.com/org/product/~alice/release-1.0.0",
- }
- badIdentifiers = []string{
- "",
- "BAR",
- "foo#",
- "EXAMPLE.com",
- "foo.com/BAR",
- "/app",
- "app/",
- "-app",
- "app-",
- ".app",
- "app.",
- "_app",
- "app_",
- "~app",
- "app~",
- }
-)
-
-func TestNewACIdentifier(t *testing.T) {
- for i, in := range goodIdentifiers {
- l, err := NewACIdentifier(in)
- if err != nil {
- t.Errorf("#%d: got err=%v, want nil", i, err)
- }
- if l == nil {
- t.Errorf("#%d: got l=nil, want non-nil", i)
- }
- }
-}
-
-func TestNewACIdentifierBad(t *testing.T) {
- for i, in := range badIdentifiers {
- l, err := NewACIdentifier(in)
- if l != nil {
- t.Errorf("#%d: got l=%v, want nil", i, l)
- }
- if err == nil {
- t.Errorf("#%d: got err=nil, want non-nil", i)
- }
- }
-}
-
-func TestMustACIdentifier(t *testing.T) {
- for i, in := range goodIdentifiers {
- l := MustACIdentifier(in)
- if l == nil {
- t.Errorf("#%d: got l=nil, want non-nil", i)
- }
- }
-}
-
-func expectPanicMustACIdentifier(i int, in string, t *testing.T) {
- defer func() {
- recover()
- }()
- _ = MustACIdentifier(in)
- t.Errorf("#%d: panic expected", i)
-}
-
-func TestMustACIdentifierBad(t *testing.T) {
- for i, in := range badIdentifiers {
- expectPanicMustACIdentifier(i, in, t)
- }
-}
-
-func TestSanitizeACIdentifier(t *testing.T) {
- tests := map[string]string{
- "foo#": "foo",
- "FOO": "foo",
- "EXAMPLE.com": "example.com",
- "foo.com/BAR": "foo.com/bar",
- "/app": "app",
- "app/": "app",
- "-app": "app",
- "app-": "app",
- ".app": "app",
- "app.": "app",
- "_app": "app",
- "app_": "app",
- "~app": "app",
- "app~": "app",
- "app///": "app",
- "-/.app..": "app",
- "-/app.name-test/-/": "app.name-test",
- "sub-domain.example.com/org/product/~alice/release-1.0.0": "sub-domain.example.com/org/product/~alice/release-1.0.0",
- }
- for in, ex := range tests {
- o, err := SanitizeACIdentifier(in)
- if err != nil {
- t.Errorf("got err=%v, want nil", err)
- }
- if o != ex {
- t.Errorf("got l=%s, want %s", o, ex)
- }
- }
-}
-
-func TestACIdentifierSetGood(t *testing.T) {
- tests := map[string]ACIdentifier{
- "blargh": ACIdentifier("blargh"),
- "example-ourapp-1-0-0": ACIdentifier("example-ourapp-1-0-0"),
- }
- for in, w := range tests {
- // Ensure an empty name is set appropriately
- var a ACIdentifier
- err := a.Set(in)
- if err != nil {
- t.Errorf("%v: got err=%v, want nil", in, err)
- continue
- }
- if !reflect.DeepEqual(a, w) {
- t.Errorf("%v: a=%v, want %v", in, a, w)
- }
-
- // Ensure an existing name is overwritten
- var b ACIdentifier = ACIdentifier("orig")
- err = b.Set(in)
- if err != nil {
- t.Errorf("%v: got err=%v, want nil", in, err)
- continue
- }
- if !reflect.DeepEqual(b, w) {
- t.Errorf("%v: b=%v, want %v", in, b, w)
- }
- }
-}
-
-func TestACIdentifierSetBad(t *testing.T) {
- for i, in := range badIdentifiers {
- // Ensure an empty name stays empty
- var a ACIdentifier
- err := a.Set(in)
- if err == nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- continue
- }
- if w := ACIdentifier(""); !reflect.DeepEqual(a, w) {
- t.Errorf("%d: a=%v, want %v", i, a, w)
- }
-
- // Ensure an existing name is not overwritten
- var b ACIdentifier = ACIdentifier("orig")
- err = b.Set(in)
- if err == nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- continue
- }
- if w := ACIdentifier("orig"); !reflect.DeepEqual(b, w) {
- t.Errorf("%d: b=%v, want %v", i, b, w)
- }
- }
-}
-
-func TestSanitizeACIdentifierBad(t *testing.T) {
- tests := []string{
- "__",
- "..",
- "//",
- "",
- ".//-"}
- for i, in := range tests {
- l, err := SanitizeACIdentifier(in)
- if l != "" {
- t.Errorf("#%d: got l=%v, want nil", i, l)
- }
- if err == nil {
- t.Errorf("#%d: got err=nil, want non-nil", i)
- }
- }
-}
-
-func TestACIdentifierUnmarshalBad(t *testing.T) {
- tests := []string{
- "",
- "garbage",
- `""`,
- `"EXAMPLE"`,
- `"example.com/app#1"`,
- `"~example.com/app1"`,
- }
- for i, in := range tests {
- var a, b ACIdentifier
- err := a.UnmarshalJSON([]byte(in))
- if err == nil {
- t.Errorf("#%d: err=nil, want non-nil", i)
- } else if !reflect.DeepEqual(a, b) {
- t.Errorf("#%d: a=%v, want empty", i, a)
- }
- }
-}
-
-func TestACIdentifierUnmarshalGood(t *testing.T) {
- tests := map[string]ACIdentifier{
- `"example"`: ACIdentifier("example"),
- `"foo-bar"`: ACIdentifier("foo-bar"),
- }
- for in, w := range tests {
- var a ACIdentifier
- err := json.Unmarshal([]byte(in), &a)
- if err != nil {
- t.Errorf("%v: err=%v, want nil", in, err)
- } else if !reflect.DeepEqual(a, w) {
- t.Errorf("%v: a=%v, want %v", in, a, w)
- }
- }
-}
-
-func TestACIdentifierMarshalBad(t *testing.T) {
- tests := map[string]error{
- "Foo": ErrInvalidCharInACIdentifier,
- "foo#": ErrInvalidCharInACIdentifier,
- "-foo": ErrInvalidEdgeInACIdentifier,
- "example-": ErrInvalidEdgeInACIdentifier,
- "": ErrEmptyACIdentifier,
- }
- for in, werr := range tests {
- a := ACIdentifier(in)
- b, gerr := json.Marshal(a)
- if b != nil {
- t.Errorf("ACIdentifier(%q): want b=nil, got %v", in, b)
- }
- if jerr, ok := gerr.(*json.MarshalerError); !ok {
- t.Errorf("expected JSONMarshalerError")
- } else {
- if e := jerr.Err; e != werr {
- t.Errorf("err=%#v, want %#v", e, werr)
- }
- }
- }
-}
-
-func TestACIdentifierMarshalGood(t *testing.T) {
- for i, in := range goodIdentifiers {
- a := ACIdentifier(in)
- b, err := json.Marshal(a)
- if !reflect.DeepEqual(b, []byte(`"`+in+`"`)) {
- t.Errorf("#%d: marshalled=%v, want %v", i, b, []byte(in))
- }
- if err != nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/ackind_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/ackind_test.go
deleted file mode 100644
index 6522adb23f1..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/ackind_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-)
-
-func TestACKindMarshalBad(t *testing.T) {
- tests := map[string]error{
- "Foo": ACKindError("bad ACKind: Foo"),
- "ApplicationManifest": ACKindError("bad ACKind: ApplicationManifest"),
- "": ErrNoACKind,
- }
- for in, werr := range tests {
- a := ACKind(in)
- b, gerr := json.Marshal(a)
- if b != nil {
- t.Errorf("ACKind(%q): want b=nil, got %v", in, b)
- }
- if jerr, ok := gerr.(*json.MarshalerError); !ok {
- t.Errorf("expected JSONMarshalerError")
- } else {
- if e := jerr.Err; e != werr {
- t.Errorf("err=%#v, want %#v", e, werr)
- }
- }
- }
-}
-
-func TestACKindMarshalGood(t *testing.T) {
- for i, in := range []string{
- "ImageManifest",
- "PodManifest",
- } {
- a := ACKind(in)
- b, err := json.Marshal(a)
- if !reflect.DeepEqual(b, []byte(`"`+in+`"`)) {
- t.Errorf("#%d: marshalled=%v, want %v", i, b, []byte(in))
- }
- if err != nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- }
- }
-}
-
-func TestACKindUnmarshalBad(t *testing.T) {
- tests := []string{
- "ImageManifest", // Not a valid JSON-encoded string
- `"garbage"`,
- `"AppManifest"`,
- `""`,
- }
- for i, in := range tests {
- var a, b ACKind
- err := a.UnmarshalJSON([]byte(in))
- if err == nil {
- t.Errorf("#%d: err=nil, want non-nil", i)
- } else if !reflect.DeepEqual(a, b) {
- t.Errorf("#%d: a=%v, want empty", i, a)
- }
- }
-}
-
-func TestACKindUnmarshalGood(t *testing.T) {
- tests := map[string]ACKind{
- `"PodManifest"`: ACKind("PodManifest"),
- `"ImageManifest"`: ACKind("ImageManifest"),
- }
- for in, w := range tests {
- var a ACKind
- err := json.Unmarshal([]byte(in), &a)
- if err != nil {
- t.Errorf("%v: err=%v, want nil", in, err)
- } else if !reflect.DeepEqual(a, w) {
- t.Errorf("%v: a=%v, want %v", in, a, w)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/acname_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/acname_test.go
deleted file mode 100644
index 11b8d2cab16..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/acname_test.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-)
-
-var (
- goodNames = []string{
- "asdf",
- "foo-bar-baz",
- "database",
- }
- badNames = []string{
- "",
- "foo#",
- "example.com",
- "EXAMPLE.com",
- "example/database",
- "example/database-1.0.0",
- "foo.com/BAR",
- "example.com/app_1",
- "/app",
- "app/",
- "-app",
- "app-",
- ".app",
- "app.",
- }
-)
-
-func TestNewACName(t *testing.T) {
- for i, in := range goodNames {
- l, err := NewACName(in)
- if err != nil {
- t.Errorf("#%d: got err=%v, want nil", i, err)
- }
- if l == nil {
- t.Errorf("#%d: got l=nil, want non-nil", i)
- }
- }
-}
-
-func TestNewACNameBad(t *testing.T) {
- for i, in := range badNames {
- l, err := NewACName(in)
- if l != nil {
- t.Errorf("#%d: got l=%v, want nil", i, l)
- }
- if err == nil {
- t.Errorf("#%d: got err=nil, want non-nil", i)
- }
- }
-}
-
-func TestMustACName(t *testing.T) {
- for i, in := range goodNames {
- l := MustACName(in)
- if l == nil {
- t.Errorf("#%d: got l=nil, want non-nil", i)
- }
- }
-}
-
-func expectPanicMustACName(i int, in string, t *testing.T) {
- defer func() {
- recover()
- }()
- _ = MustACName(in)
- t.Errorf("#%d: panic expected", i)
-}
-
-func TestMustACNameBad(t *testing.T) {
- for i, in := range badNames {
- expectPanicMustACName(i, in, t)
- }
-}
-
-func TestSanitizeACName(t *testing.T) {
- tests := map[string]string{
- "foo#": "foo",
- "EXAMPLE.com": "example-com",
- "foo.com/BAR": "foo-com-bar",
- "example.com/app_1": "example-com-app-1",
- "/app": "app",
- "app/": "app",
- "-app": "app",
- "app-": "app",
- ".app": "app",
- "app.": "app",
- "app///": "app",
- "-/.app..": "app",
- "-/app.name-test/-/": "app-name-test",
- "sub-domain.example.com/org/product/release-1.0.0": "sub-domain-example-com-org-product-release-1-0-0",
- }
- for in, ex := range tests {
- o, err := SanitizeACName(in)
- if err != nil {
- t.Errorf("got err=%v, want nil", err)
- }
- if o != ex {
- t.Errorf("got l=%s, want %s", o, ex)
- }
- }
-}
-
-func TestACNameSetGood(t *testing.T) {
- tests := map[string]ACName{
- "blargh": ACName("blargh"),
- "example-ourapp-1-0-0": ACName("example-ourapp-1-0-0"),
- }
- for in, w := range tests {
- // Ensure an empty name is set appropriately
- var a ACName
- err := a.Set(in)
- if err != nil {
- t.Errorf("%v: got err=%v, want nil", in, err)
- continue
- }
- if !reflect.DeepEqual(a, w) {
- t.Errorf("%v: a=%v, want %v", in, a, w)
- }
-
- // Ensure an existing name is overwritten
- var b ACName = ACName("orig")
- err = b.Set(in)
- if err != nil {
- t.Errorf("%v: got err=%v, want nil", in, err)
- continue
- }
- if !reflect.DeepEqual(b, w) {
- t.Errorf("%v: b=%v, want %v", in, b, w)
- }
- }
-}
-
-func TestACNameSetBad(t *testing.T) {
- for i, in := range badNames {
- // Ensure an empty name stays empty
- var a ACName
- err := a.Set(in)
- if err == nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- continue
- }
- if w := ACName(""); !reflect.DeepEqual(a, w) {
- t.Errorf("%d: a=%v, want %v", i, a, w)
- }
-
- // Ensure an existing name is not overwritten
- var b ACName = ACName("orig")
- err = b.Set(in)
- if err == nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- continue
- }
- if w := ACName("orig"); !reflect.DeepEqual(b, w) {
- t.Errorf("%d: b=%v, want %v", i, b, w)
- }
- }
-}
-
-func TestSanitizeACNameBad(t *testing.T) {
- tests := []string{
- "__",
- "..",
- "//",
- "",
- ".//-"}
- for i, in := range tests {
- l, err := SanitizeACName(in)
- if l != "" {
- t.Errorf("#%d: got l=%v, want nil", i, l)
- }
- if err == nil {
- t.Errorf("#%d: got err=nil, want non-nil", i)
- }
- }
-}
-
-func TestACNameUnmarshalBad(t *testing.T) {
- tests := []string{
- "",
- "garbage",
- `""`,
- `"EXAMPLE"`,
- `"example.com/app_1"`,
- }
- for i, in := range tests {
- var a, b ACName
- err := a.UnmarshalJSON([]byte(in))
- if err == nil {
- t.Errorf("#%d: err=nil, want non-nil", i)
- } else if !reflect.DeepEqual(a, b) {
- t.Errorf("#%d: a=%v, want empty", i, a)
- }
- }
-}
-
-func TestACNameUnmarshalGood(t *testing.T) {
- tests := map[string]ACName{
- `"example"`: ACName("example"),
- `"foo-bar"`: ACName("foo-bar"),
- }
- for in, w := range tests {
- var a ACName
- err := json.Unmarshal([]byte(in), &a)
- if err != nil {
- t.Errorf("%v: err=%v, want nil", in, err)
- } else if !reflect.DeepEqual(a, w) {
- t.Errorf("%v: a=%v, want %v", in, a, w)
- }
- }
-}
-
-func TestACNameMarshalBad(t *testing.T) {
- tests := map[string]error{
- "Foo": ErrInvalidCharInACName,
- "foo#": ErrInvalidCharInACName,
- "-foo": ErrInvalidEdgeInACName,
- "example-": ErrInvalidEdgeInACName,
- "": ErrEmptyACName,
- }
- for in, werr := range tests {
- a := ACName(in)
- b, gerr := json.Marshal(a)
- if b != nil {
- t.Errorf("ACName(%q): want b=nil, got %v", in, b)
- }
- if jerr, ok := gerr.(*json.MarshalerError); !ok {
- t.Errorf("expected JSONMarshalerError")
- } else {
- if e := jerr.Err; e != werr {
- t.Errorf("err=%#v, want %#v", e, werr)
- }
- }
- }
-}
-
-func TestACNameMarshalGood(t *testing.T) {
- for i, in := range goodNames {
- a := ACName(in)
- b, err := json.Marshal(a)
- if !reflect.DeepEqual(b, []byte(`"`+in+`"`)) {
- t.Errorf("#%d: marshalled=%v, want %v", i, b, []byte(in))
- }
- if err != nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/annotations_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/annotations_test.go
deleted file mode 100644
index 358fd18e464..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/annotations_test.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "testing"
-)
-
-func makeAnno(n, v string) Annotation {
- name, err := NewACIdentifier(n)
- if err != nil {
- panic(err)
- }
- return Annotation{
- Name: *name,
- Value: v,
- }
-}
-
-func TestAnnotationsAssertValid(t *testing.T) {
- tests := []struct {
- in []Annotation
- werr bool
- }{
- // duplicate names should fail
- {
- []Annotation{
- makeAnno("foo", "bar"),
- makeAnno("foo", "baz"),
- },
- true,
- },
- // bad created should fail
- {
- []Annotation{
- makeAnno("created", "garbage"),
- },
- true,
- },
- // bad homepage should fail
- {
- []Annotation{
- makeAnno("homepage", "not-A$@#URL"),
- },
- true,
- },
- // bad documentation should fail
- {
- []Annotation{
- makeAnno("documentation", "ftp://isnotallowed.com"),
- },
- true,
- },
- // good cases
- {
- []Annotation{
- makeAnno("created", "2004-05-14T23:11:14+00:00"),
- makeAnno("documentation", "http://example.com/docs"),
- },
- false,
- },
- {
- []Annotation{
- makeAnno("foo", "bar"),
- makeAnno("homepage", "https://homepage.com"),
- },
- false,
- },
- // empty is OK
- {
- []Annotation{},
- false,
- },
- }
- for i, tt := range tests {
- a := Annotations(tt.in)
- err := a.assertValid()
- if gerr := (err != nil); gerr != tt.werr {
- t.Errorf("#%d: gerr=%t, want %t (err=%v)", i, gerr, tt.werr, err)
- }
- }
-}
-
-func TestAnnotationsMarshal(t *testing.T) {
- for i, tt := range []struct {
- in []Annotation
- wb []byte
- werr bool
- }{
- {
- []Annotation{
- makeAnno("foo", "bar"),
- makeAnno("foo", "baz"),
- makeAnno("website", "http://example.com/anno"),
- },
- nil,
- true,
- },
- {
- []Annotation{
- makeAnno("a", "b"),
- },
- []byte(`[{"name":"a","value":"b"}]`),
- false,
- },
- {
- []Annotation{
- makeAnno("foo", "bar"),
- makeAnno("website", "http://example.com/anno"),
- },
- []byte(`[{"name":"foo","value":"bar"},{"name":"website","value":"http://example.com/anno"}]`),
- false,
- },
- } {
- a := Annotations(tt.in)
- b, err := a.MarshalJSON()
- if !reflect.DeepEqual(b, tt.wb) {
- t.Errorf("#%d: b=%s, want %s", i, b, tt.wb)
- }
- gerr := err != nil
- if gerr != tt.werr {
- t.Errorf("#%d: gerr=%t, want %t (err=%v)", i, gerr, tt.werr, err)
- }
- }
-}
-
-func TestAnnotationsUnmarshal(t *testing.T) {
- tests := []struct {
- in string
- wann *Annotations
- werr bool
- }{
- {
- `garbage`,
- &Annotations{},
- true,
- },
- {
- `[{"name":"a","value":"b"},{"name":"a","value":"b"}]`,
- &Annotations{},
- true,
- },
- {
- `[{"name":"a","value":"b"}]`,
- &Annotations{
- makeAnno("a", "b"),
- },
- false,
- },
- }
- for i, tt := range tests {
- a := &Annotations{}
- err := a.UnmarshalJSON([]byte(tt.in))
- gerr := err != nil
- if gerr != tt.werr {
- t.Errorf("#%d: gerr=%t, want %t (err=%v)", i, gerr, tt.werr, err)
- }
- if !reflect.DeepEqual(a, tt.wann) {
- t.Errorf("#%d: ann=%#v, want %#v", i, a, tt.wann)
- }
- }
-
-}
-
-func TestAnnotationsGet(t *testing.T) {
- for i, tt := range []struct {
- in string
- wval string
- wok bool
- }{
- {"foo", "bar", true},
- {"website", "http://example.com/anno", true},
- {"baz", "", false},
- {"wuuf", "", false},
- } {
- a := Annotations{
- makeAnno("foo", "bar"),
- makeAnno("website", "http://example.com/anno"),
- }
- gval, gok := a.Get(tt.in)
- if gval != tt.wval {
- t.Errorf("#%d: val=%v, want %v", i, gval, tt.wval)
- }
- if gok != tt.wok {
- t.Errorf("#%d: ok=%t, want %t", i, gok, tt.wok)
- }
- }
-}
-
-func TestAnnotationsSet(t *testing.T) {
- a := Annotations{}
-
- a.Set("foo", "bar")
- w := Annotations{
- Annotation{ACIdentifier("foo"), "bar"},
- }
- if !reflect.DeepEqual(w, a) {
- t.Fatalf("want %v, got %v", w, a)
- }
-
- a.Set("dog", "woof")
- w = Annotations{
- Annotation{ACIdentifier("foo"), "bar"},
- Annotation{ACIdentifier("dog"), "woof"},
- }
- if !reflect.DeepEqual(w, a) {
- t.Fatalf("want %v, got %v", w, a)
- }
-
- a.Set("foo", "baz")
- a.Set("example.com/foo_bar", "quux")
- w = Annotations{
- Annotation{ACIdentifier("foo"), "baz"},
- Annotation{ACIdentifier("dog"), "woof"},
- Annotation{ACIdentifier("example.com/foo_bar"), "quux"},
- }
- if !reflect.DeepEqual(w, a) {
- t.Fatalf("want %v, got %v", w, a)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/app_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/app_test.go
deleted file mode 100644
index 9a68532f025..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/app_test.go
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "testing"
-)
-
-func TestAppValid(t *testing.T) {
- tests := []App{
- App{
- Exec: []string{"/bin/httpd"},
- User: "0",
- Group: "0",
- WorkingDirectory: "/tmp",
- },
- App{
- Exec: []string{"/app"},
- User: "0",
- Group: "0",
- EventHandlers: []EventHandler{
- {Name: "pre-start"},
- {Name: "post-stop"},
- },
- Environment: []EnvironmentVariable{
- {Name: "DEBUG", Value: "true"},
- },
- WorkingDirectory: "/tmp",
- },
- App{
- Exec: []string{"/app", "arg1", "arg2"},
- User: "0",
- Group: "0",
- WorkingDirectory: "/tmp",
- },
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err != nil {
- t.Errorf("#%d: err == %v, want nil", i, err)
- }
- }
-}
-
-func TestAppExecInvalid(t *testing.T) {
- tests := []App{
- App{
- Exec: nil,
- },
- App{
- Exec: []string{},
- User: "0",
- Group: "0",
- },
- App{
- Exec: []string{"app"},
- User: "0",
- Group: "0",
- },
- App{
- Exec: []string{"bin/app", "arg1"},
- User: "0",
- Group: "0",
- },
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err == nil {
- t.Errorf("#%d: err == nil, want non-nil", i)
- }
- }
-}
-
-func TestAppEventHandlersInvalid(t *testing.T) {
- tests := []App{
- App{
- Exec: []string{"/bin/httpd"},
- User: "0",
- Group: "0",
- EventHandlers: []EventHandler{
- EventHandler{
- Name: "pre-start",
- },
- EventHandler{
- Name: "pre-start",
- },
- },
- },
- App{
- Exec: []string{"/bin/httpd"},
- User: "0",
- Group: "0",
- EventHandlers: []EventHandler{
- EventHandler{
- Name: "post-stop",
- },
- EventHandler{
- Name: "pre-start",
- },
- EventHandler{
- Name: "post-stop",
- },
- },
- },
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err == nil {
- t.Errorf("#%d: err == nil, want non-nil", i)
- }
- }
-}
-
-func TestUserGroupInvalid(t *testing.T) {
- tests := []App{
- App{
- Exec: []string{"/app"},
- },
- App{
- Exec: []string{"/app"},
- User: "0",
- },
- App{
- Exec: []string{"app"},
- Group: "0",
- },
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err == nil {
- t.Errorf("#%d: err == nil, want non-nil", i)
- }
- }
-}
-
-func TestAppWorkingDirectoryInvalid(t *testing.T) {
- tests := []App{
- App{
- Exec: []string{"/app"},
- User: "foo",
- Group: "bar",
- WorkingDirectory: "stuff",
- },
- App{
- Exec: []string{"/app"},
- User: "foo",
- Group: "bar",
- WorkingDirectory: "../home/fred",
- },
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err == nil {
- t.Errorf("#%d: err == nil, want non-nil", i)
- }
- }
-}
-
-func TestAppEnvironmentInvalid(t *testing.T) {
- tests := []App{
- App{
- Exec: []string{"/app"},
- User: "foo",
- Group: "bar",
- Environment: Environment{
- EnvironmentVariable{"0DEBUG", "true"},
- },
- },
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err == nil {
- t.Errorf("#%d: err == nil, want non-nil", i)
- }
- }
-}
-
-func TestAppUnmarshal(t *testing.T) {
- tests := []struct {
- in string
- wann *App
- werr bool
- }{
- {
- `garbage`,
- &App{},
- true,
- },
- {
- `{"Exec":"not a list"}`,
- &App{},
- true,
- },
- {
- `{"Exec":["notfullyqualified"]}`,
- &App{},
- true,
- },
- {
- `{"Exec":["/a"],"User":"0","Group":"0"}`,
- &App{
- Exec: Exec{
- "/a",
- },
- User: "0",
- Group: "0",
- Environment: make(Environment, 0),
- },
- false,
- },
- }
- for i, tt := range tests {
- a := &App{}
- err := a.UnmarshalJSON([]byte(tt.in))
- gerr := err != nil
- if gerr != tt.werr {
- t.Errorf("#%d: gerr=%t, want %t (err=%v)", i, gerr, tt.werr, err)
- }
- if !reflect.DeepEqual(a, tt.wann) {
- t.Errorf("#%d: ann=%#v, want %#v", i, a, tt.wann)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/date_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/date_test.go
deleted file mode 100644
index 9eb11830f51..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/date_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "testing"
- "time"
-)
-
-var (
- pst = time.FixedZone("Pacific", -8*60*60)
-)
-
-func TestUnmarshalDate(t *testing.T) {
- tests := []struct {
- in string
-
- wt time.Time
- }{
- {
- `"2004-05-14T23:11:14+00:00"`,
-
- time.Date(2004, 05, 14, 23, 11, 14, 0, time.UTC),
- },
- {
- `"2001-02-03T04:05:06Z"`,
-
- time.Date(2001, 02, 03, 04, 05, 06, 0, time.UTC),
- },
- {
- `"2014-11-14T17:36:54-08:00"`,
-
- time.Date(2014, 11, 14, 17, 36, 54, 0, pst),
- },
- {
- `"2004-05-14T23:11:14+00:00"`,
-
- time.Date(2004, 05, 14, 23, 11, 14, 0, time.UTC),
- },
- }
- for i, tt := range tests {
- var d Date
- if err := json.Unmarshal([]byte(tt.in), &d); err != nil {
- t.Errorf("#%d: got err=%v, want nil", i, err)
- }
- if gt := time.Time(d); !gt.Equal(tt.wt) {
- t.Errorf("#%d: got time=%v, want %v", i, gt, tt.wt)
- }
- }
-}
-
-func TestUnmarshalDateBad(t *testing.T) {
- tests := []string{
- `not a json string`,
- `2014-11-14T17:36:54-08:00`,
- `"garbage"`,
- `"1416015188"`,
- `"Fri Nov 14 17:53:02 PST 2014"`,
- `"2014-11-1417:36:54"`,
- }
- for i, tt := range tests {
- var d Date
- if err := json.Unmarshal([]byte(tt), &d); err == nil {
- t.Errorf("#%d: unexpected nil err", i)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/dependencies_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/dependencies_test.go
deleted file mode 100644
index ac3f1f96d96..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/dependencies_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import "testing"
-
-func TestEmptyHash(t *testing.T) {
- dj := `{"imageName": "example.com/reduce-worker-base"}`
-
- var d Dependency
-
- err := d.UnmarshalJSON([]byte(dj))
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- // Marshal to verify that marshalling works without validation errors
- buf, err := d.MarshalJSON()
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- // Unmarshal to verify that the generated json will not create wrong empty hash
- err = d.UnmarshalJSON(buf)
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/environment_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/environment_test.go
deleted file mode 100644
index 8c51bea9aef..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/environment_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "testing"
-)
-
-func TestEnvironmentAssertValid(t *testing.T) {
- tests := []struct {
- env Environment
- werr bool
- }{
- // duplicate names should fail
- {
- Environment{
- EnvironmentVariable{"DEBUG", "true"},
- EnvironmentVariable{"DEBUG", "true"},
- },
- true,
- },
- // empty name should fail
- {
- Environment{
- EnvironmentVariable{"", "value"},
- },
- true,
- },
- // name beginning with digit should fail
- {
- Environment{
- EnvironmentVariable{"0DEBUG", "true"},
- },
- true,
- },
- // name with non [A-Za-z0-9_] should fail
- {
- Environment{
- EnvironmentVariable{"VERBOSE-DEBUG", "true"},
- },
- true,
- },
- // accepted environment variable forms
- {
- Environment{
- EnvironmentVariable{"DEBUG", "true"},
- },
- false,
- },
- {
- Environment{
- EnvironmentVariable{"_0_DEBUG_0_", "true"},
- },
- false,
- },
- }
- for i, test := range tests {
- env := Environment(test.env)
- err := env.assertValid()
- if gerr := (err != nil); gerr != test.werr {
- t.Errorf("#%d: gerr=%t, want %t (err=%v)", i, gerr, test.werr, err)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/exec_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/exec_test.go
deleted file mode 100644
index 326dc5dd29d..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/exec_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import "testing"
-
-func TestExecValid(t *testing.T) {
- tests := []Exec{
- Exec{"/bin/httpd"},
- Exec{"/app"},
- Exec{"/app", "arg1", "arg2"},
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err != nil {
- t.Errorf("#%d: err == %v, want nil", i, err)
- }
- }
-}
-
-func TestExecInvalid(t *testing.T) {
- tests := []Exec{
- Exec{},
- Exec{"app"},
- }
- for i, tt := range tests {
- if err := tt.assertValid(); err == nil {
- t.Errorf("#%d: err == nil, want non-nil", i)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/hash_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/hash_test.go
deleted file mode 100644
index dc597efd3a7..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/hash_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "testing"
-)
-
-func TestMarshalHash(t *testing.T) {
- tests := []struct {
- typ string
- val string
-
- wout string
- }{
- {
- "sha512",
- "abcdefghi",
-
- `"sha512-abcdefghi"`,
- },
- {
- "sha512",
- "06c733b1838136838e6d2d3e8fa5aea4c7905e92",
-
- `"sha512-06c733b1838136838e6d2d3e8fa5aea4c7905e92"`,
- },
- }
- for i, tt := range tests {
- h := Hash{
- typ: tt.typ,
- Val: tt.val,
- }
- b, err := json.Marshal(h)
- if err != nil {
- t.Errorf("#%d: unexpected err=%v", i, err)
- }
- if g := string(b); g != tt.wout {
- t.Errorf("#%d: got string=%v, want %v", i, g, tt.wout)
- }
- }
-}
-
-func TestMarshalHashBad(t *testing.T) {
- tests := []struct {
- typ string
- val string
- }{
- {
- // empty value
- "sha512",
- "",
- },
- {
- // bad type
- "sha1",
- "abcdef",
- },
- {
- // empty type
- "",
- "abcdef",
- },
- {
- // empty empty
- "",
- "",
- },
- }
- for i, tt := range tests {
- h := Hash{
- typ: tt.typ,
- Val: tt.val,
- }
- g, err := json.Marshal(h)
- if err == nil {
- t.Errorf("#%d: unexpected nil err", i)
- }
- if g != nil {
- t.Errorf("#%d: unexpected non-nil bytes: %v", i, g)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/isolator_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/isolator_test.go
deleted file mode 100644
index 785c4f02813..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/isolator_test.go
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-)
-
-func TestIsolatorUnmarshal(t *testing.T) {
- tests := []struct {
- msg string
- werr bool
- }{
- {
- `{
- "name": "os/linux/capabilities-retain-set",
- "value": {"set": ["CAP_KILL"]}
- }`,
- false,
- },
- {
- `{
- "name": "os/linux/capabilities-retain-set",
- "value": {"set": ["CAP_PONIES"]}
- }`,
- false,
- },
- {
- `{
- "name": "os/linux/capabilities-retain-set",
- "value": {"set": []}
- }`,
- true,
- },
- {
- `{
- "name": "os/linux/capabilities-retain-set",
- "value": {"set": "CAP_PONIES"}
- }`,
- true,
- },
- {
- `{
- "name": "resource/block-bandwidth",
- "value": {"default": true, "limit": "1G"}
- }`,
- false,
- },
- {
- `{
- "name": "resource/block-bandwidth",
- "value": {"default": false, "limit": "1G"}
- }`,
- true,
- },
- {
- `{
- "name": "resource/block-bandwidth",
- "value": {"request": "30G", "limit": "1G"}
- }`,
- true,
- },
- {
- `{
- "name": "resource/block-iops",
- "value": {"default": true, "limit": "1G"}
- }`,
- false,
- },
- {
- `{
- "name": "resource/block-iops",
- "value": {"default": false, "limit": "1G"}
- }`,
- true,
- },
- {
- `{
- "name": "resource/block-iops",
- "value": {"request": "30G", "limit": "1G"}
- }`,
- true,
- },
- {
- `{
- "name": "resource/cpu",
- "value": {"request": "30m", "limit": "1m"}
- }`,
- false,
- },
- {
- `{
- "name": "resource/memory",
- "value": {"request": "1G", "limit": "2Gi"}
- }`,
- false,
- },
- {
- `{
- "name": "resource/memory",
- "value": {"default": true, "request": "1G", "limit": "2G"}
- }`,
- true,
- },
- {
- `{
- "name": "resource/network-bandwidth",
- "value": {"default": true, "limit": "1G"}
- }`,
- false,
- },
- {
- `{
- "name": "resource/network-bandwidth",
- "value": {"default": false, "limit": "1G"}
- }`,
- true,
- },
- {
- `{
- "name": "resource/network-bandwidth",
- "value": {"request": "30G", "limit": "1G"}
- }`,
- true,
- },
- }
-
- for i, tt := range tests {
- var ii Isolator
- err := ii.UnmarshalJSON([]byte(tt.msg))
- if gerr := (err != nil); gerr != tt.werr {
- t.Errorf("#%d: gerr=%t, want %t (err=%v)", i, gerr, tt.werr, err)
- }
- }
-}
-
-func TestIsolatorsGetByName(t *testing.T) {
- ex := `
- [
- {
- "name": "resource/cpu",
- "value": {"request": "30m", "limit": "1m"}
- },
- {
- "name": "resource/memory",
- "value": {"request": "1G", "limit": "2Gi"}
- },
- {
- "name": "os/linux/capabilities-retain-set",
- "value": {"set": ["CAP_KILL"]}
- },
- {
- "name": "os/linux/capabilities-remove-set",
- "value": {"set": ["CAP_KILL"]}
- }
- ]
- `
-
- tests := []struct {
- name ACIdentifier
- wlimit int64
- wrequest int64
- wset []LinuxCapability
- }{
- {"resource/cpu", 1, 30, nil},
- {"resource/memory", 2147483648, 1000000000, nil},
- {"os/linux/capabilities-retain-set", 0, 0, []LinuxCapability{"CAP_KILL"}},
- {"os/linux/capabilities-remove-set", 0, 0, []LinuxCapability{"CAP_KILL"}},
- }
-
- var is Isolators
- err := json.Unmarshal([]byte(ex), &is)
- if err != nil {
- panic(err)
- }
-
- if len(is) < 2 {
- t.Fatalf("too few items %v", len(is))
- }
-
- for i, tt := range tests {
- c := is.GetByName(tt.name)
- if c == nil {
- t.Fatalf("can't find item %v in %v items", tt.name, len(is))
- }
- switch v := c.Value().(type) {
- case Resource:
- var r Resource = v
- glimit := r.Limit()
- grequest := r.Request()
-
- var vlimit, vrequest int64
- if tt.name == "resource/cpu" {
- vlimit, vrequest = glimit.MilliValue(), grequest.MilliValue()
- } else {
- vlimit, vrequest = glimit.Value(), grequest.Value()
- }
-
- if vlimit != tt.wlimit {
- t.Errorf("#%d: glimit=%v, want %v", i, vlimit, tt.wlimit)
- }
- if vrequest != tt.wrequest {
- t.Errorf("#%d: grequest=%v, want %v", i, vrequest, tt.wrequest)
- }
-
- case LinuxCapabilitiesSet:
- var s LinuxCapabilitiesSet = v
- if !reflect.DeepEqual(s.Set(), tt.wset) {
- t.Errorf("#%d: gset=%v, want %v", i, s.Set(), tt.wset)
- }
-
- default:
- panic("unexecpected type")
- }
- }
-}
-
-func TestIsolatorUnrecognized(t *testing.T) {
- msg := `
- [{
- "name": "resource/network-bandwidth",
- "value": {"default": true, "limit": "1G"}
- },
- {
- "name": "resource/network-ponies",
- "value": 0
- }]`
-
- ex := Isolators{
- {Name: "resource/network-ponies"},
- }
-
- is := Isolators{}
- if err := json.Unmarshal([]byte(msg), &is); err != nil {
- t.Fatalf("failed to unmarshal isolators: %v", err)
- }
-
- u := is.Unrecognized()
- if len(u) != len(ex) {
- t.Errorf("unrecognized isolator list is wrong len: want %v, got %v", len(ex), len(u))
- }
-
- for i, e := range ex {
- if e.Name != u[i].Name {
- t.Errorf("unrecognized isolator list mismatch: want %v, got %v", e.Name, u[i].Name)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/labels_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/labels_test.go
deleted file mode 100644
index 9759d88bc07..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/labels_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "strings"
- "testing"
-)
-
-func TestLabels(t *testing.T) {
- tests := []struct {
- in string
- errPrefix string
- }{
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "amd64"}]`,
- "",
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "aarch64"}]`,
- "",
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "arm64"}]`,
- `bad arch "arm64" for linux`,
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "aarch64_be"}]`,
- "",
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "arm64_be"}]`,
- `bad arch "arm64_be" for linux`,
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "arm"}]`,
- `bad arch "arm" for linux`,
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "armv6l"}]`,
- "",
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "armv7l"}]`,
- "",
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "arch", "value": "armv7b"}]`,
- "",
- },
- {
- `[{"name": "os", "value": "freebsd"}, {"name": "arch", "value": "amd64"}]`,
- "",
- },
- {
- `[{"name": "os", "value": "OS/360"}, {"name": "arch", "value": "S/360"}]`,
- `bad os "OS/360"`,
- },
- {
- `[{"name": "os", "value": "freebsd"}, {"name": "arch", "value": "armv7b"}]`,
- `bad arch "armv7b" for freebsd`,
- },
- {
- `[{"name": "name"}]`,
- `invalid label name: "name"`,
- },
- {
- `[{"name": "os", "value": "linux"}, {"name": "os", "value": "freebsd"}]`,
- `duplicate labels of name "os"`,
- },
- {
- `[{"name": "arch", "value": "amd64"}, {"name": "os", "value": "freebsd"}, {"name": "arch", "value": "x86_64"}]`,
- `duplicate labels of name "arch"`,
- },
- {
- `[]`,
- "",
- },
- }
- for i, tt := range tests {
- var l Labels
- if err := json.Unmarshal([]byte(tt.in), &l); err != nil {
- if tt.errPrefix == "" {
- t.Errorf("#%d: got err=%v, expected no error", i, err)
- } else if !strings.HasPrefix(err.Error(), tt.errPrefix) {
- t.Errorf("#%d: got err=%v, expected prefix %#v", i, err, tt.errPrefix)
- }
- } else {
- t.Log(l)
- if tt.errPrefix != "" {
- t.Errorf("#%d: got no err, expected prefix %#v", i, tt.errPrefix)
- }
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/mountpoint_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/mountpoint_test.go
deleted file mode 100644
index f7b216edd0f..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/mountpoint_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "testing"
-)
-
-func TestMountPointFromString(t *testing.T) {
- tests := []struct {
- s string
- mount MountPoint
- }{
- {
- "foobar,path=/tmp",
- MountPoint{
- Name: "foobar",
- Path: "/tmp",
- ReadOnly: false,
- },
- },
- {
- "foobar,path=/tmp,readOnly=false",
- MountPoint{
- Name: "foobar",
- Path: "/tmp",
- ReadOnly: false,
- },
- },
- {
- "foobar,path=/tmp,readOnly=true",
- MountPoint{
- Name: "foobar",
- Path: "/tmp",
- ReadOnly: true,
- },
- },
- }
- for i, tt := range tests {
- mount, err := MountPointFromString(tt.s)
- if err != nil {
- t.Errorf("#%d: got err=%v, want nil", i, err)
- }
- if !reflect.DeepEqual(*mount, tt.mount) {
- t.Errorf("#%d: mount=%v, want %v", i, *mount, tt.mount)
- }
- }
-}
-
-func TestMountPointFromStringBad(t *testing.T) {
- tests := []string{
- "#foobar,path=/tmp",
- "foobar,path=/tmp,readOnly=true,asdf=asdf",
- "foobar,path=/tmp,readOnly=maybe",
- "foobar,path=/tmp,readOnly=",
- "foobar,path=",
- "foobar",
- "",
- ",path=/",
- }
- for i, in := range tests {
- l, err := MountPointFromString(in)
- if l != nil {
- t.Errorf("#%d: got l=%v, want nil", i, l)
- }
- if err == nil {
- t.Errorf("#%d: got err=nil, want non-nil", i)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/port_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/port_test.go
deleted file mode 100644
index 3462c0e3819..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/port_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "testing"
-)
-
-func TestGoodPort(t *testing.T) {
- p := Port{
- Port: 32456,
- Count: 100,
- }
- if err := p.assertValid(); err != nil {
- t.Errorf("good port assertion failed: %v", err)
- }
-}
-
-func TestBadPort(t *testing.T) {
- p := Port{
- Port: 88888,
- }
- if p.assertValid() == nil {
- t.Errorf("bad port asserted valid")
- }
-}
-
-func TestBadRange(t *testing.T) {
- p := Port{
- Port: 32456,
- Count: 45678,
- }
- if p.assertValid() == nil {
- t.Errorf("bad port range asserted valid")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/semver_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/semver_test.go
deleted file mode 100644
index 6afb1811098..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/semver_test.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-
- "github.com/coreos/go-semver/semver"
-)
-
-func TestMarshalSemver(t *testing.T) {
- tests := []struct {
- sv SemVer
-
- wd []byte
- }{
- {
- SemVer(semver.Version{Major: 1}),
-
- []byte(`"1.0.0"`),
- },
- {
- SemVer(semver.Version{Major: 3, Minor: 2, Patch: 1}),
-
- []byte(`"3.2.1"`),
- },
- {
- SemVer(semver.Version{Major: 3, Minor: 2, Patch: 1, PreRelease: "foo"}),
-
- []byte(`"3.2.1-foo"`),
- },
- {
- SemVer(semver.Version{Major: 1, Minor: 2, Patch: 3, PreRelease: "alpha", Metadata: "git"}),
-
- []byte(`"1.2.3-alpha+git"`),
- },
- }
- for i, tt := range tests {
- d, err := json.Marshal(tt.sv)
- if !reflect.DeepEqual(d, tt.wd) {
- t.Errorf("#%d: d=%v, want %v", i, string(d), string(tt.wd))
- }
- if err != nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- }
- }
-}
-
-func TestUnmarshalSemver(t *testing.T) {
- tests := []struct {
- d []byte
-
- wsv SemVer
- werr bool
- }{
- {
- []byte(`"1.0.0"`),
-
- SemVer(semver.Version{Major: 1}),
- false,
- },
- {
- []byte(`"3.2.1"`),
- SemVer(semver.Version{Major: 3, Minor: 2, Patch: 1}),
-
- false,
- },
- {
- []byte(`"3.2.1-foo"`),
-
- SemVer(semver.Version{Major: 3, Minor: 2, Patch: 1, PreRelease: "foo"}),
- false,
- },
- {
- []byte(`"1.2.3-alpha+git"`),
-
- SemVer(semver.Version{Major: 1, Minor: 2, Patch: 3, PreRelease: "alpha", Metadata: "git"}),
- false,
- },
- {
- []byte(`"1"`),
-
- SemVer{},
- true,
- },
- {
- []byte(`"1.2.3.4"`),
-
- SemVer{},
- true,
- },
- {
- []byte(`1.2.3`),
-
- SemVer{},
- true,
- },
- {
- []byte(`"v1.2.3"`),
-
- SemVer{},
- true,
- },
- }
- for i, tt := range tests {
- var sv SemVer
- err := json.Unmarshal(tt.d, &sv)
- if !reflect.DeepEqual(sv, tt.wsv) {
- t.Errorf("#%d: semver=%#v, want %#v", i, sv, tt.wsv)
- }
- if gerr := (err != nil); gerr != tt.werr {
- t.Errorf("#%d: err==%v, want errstate %t", i, err, tt.werr)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/url_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/url_test.go
deleted file mode 100644
index fa1e65d5699..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/url_test.go
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "encoding/json"
- "net/url"
- "reflect"
- "testing"
-)
-
-func mustParseURL(t *testing.T, s string) url.URL {
- u, err := url.Parse(s)
- if err != nil {
- t.Fatalf("error parsing URL: %v", err)
- }
- return *u
-}
-
-func TestMarshalURL(t *testing.T) {
- tests := []struct {
- u url.URL
-
- w string
- }{
- {
- mustParseURL(t, "http://foo.com"),
-
- `"http://foo.com"`,
- },
- {
- mustParseURL(t, "http://foo.com/huh/what?is=this"),
-
- `"http://foo.com/huh/what?is=this"`,
- },
- {
- mustParseURL(t, "https://example.com/bar"),
-
- `"https://example.com/bar"`,
- },
- }
- for i, tt := range tests {
- u := URL(tt.u)
- b, err := json.Marshal(u)
- if g := string(b); g != tt.w {
- t.Errorf("#%d: got %q, want %q", i, g, tt.w)
- }
- if err != nil {
- t.Errorf("#%d: err=%v, want nil", i, err)
- }
-
- }
-}
-
-func TestMarshalURLBad(t *testing.T) {
- tests := []url.URL{
- mustParseURL(t, "ftp://foo.com"),
- mustParseURL(t, "unix:///hello"),
- }
- for i, tt := range tests {
- u := URL(tt)
- b, err := json.Marshal(u)
- if b != nil {
- t.Errorf("#%d: got %v, want nil", i, b)
- }
- if err == nil {
- t.Errorf("#%d: got unexpected err=nil", i)
- }
- }
-}
-
-func TestUnmarshalURL(t *testing.T) {
- tests := []struct {
- in string
-
- w URL
- }{
- {
- `"http://foo.com"`,
-
- URL(mustParseURL(t, "http://foo.com")),
- },
- {
- `"http://yis.com/hello?goodbye=yes"`,
-
- URL(mustParseURL(t, "http://yis.com/hello?goodbye=yes")),
- },
- {
- `"https://ohai.net"`,
-
- URL(mustParseURL(t, "https://ohai.net")),
- },
- }
- for i, tt := range tests {
- var g URL
- err := json.Unmarshal([]byte(tt.in), &g)
- if err != nil {
- t.Errorf("#%d: want err=nil, got %v", i, err)
- }
- if !reflect.DeepEqual(g, tt.w) {
- t.Errorf("#%d: got url=%v, want %v", i, g, tt.w)
- }
- }
-}
-
-func TestUnmarshalURLBad(t *testing.T) {
- var empty = URL{}
- tests := []string{
- "badjson",
- "http://google.com",
- `"ftp://example.com"`,
- `"unix://file.net"`,
- `"not a url"`,
- }
- for i, tt := range tests {
- var g URL
- err := json.Unmarshal([]byte(tt), &g)
- if err == nil {
- t.Errorf("#%d: want err, got nil", i)
- }
- if !reflect.DeepEqual(g, empty) {
- t.Errorf("#%d: got %v, want %v", i, g, empty)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/uuid_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/uuid_test.go
deleted file mode 100644
index 03c93202d8e..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/uuid_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import "testing"
-
-func TestNewUUID(t *testing.T) {
- tests := []struct {
- in string
- ws string
- }{
- {
- "6733C088-A507-4694-AABF-EDBE4FC5266F",
-
- "6733c088-a507-4694-aabf-edbe4fc5266f",
- },
- {
- "6733C088A5074694AABFEDBE4FC5266F",
-
- "6733c088-a507-4694-aabf-edbe4fc5266f",
- },
- {
- "0aaf0a79-1a39-4d59-abbf-1bebca8209d2",
-
- "0aaf0a79-1a39-4d59-abbf-1bebca8209d2",
- },
- {
- "0aaf0a791a394d59abbf1bebca8209d2",
-
- "0aaf0a79-1a39-4d59-abbf-1bebca8209d2",
- },
- }
- for i, tt := range tests {
- gu, err := NewUUID(tt.in)
- if err != nil {
- t.Errorf("#%d: err=%v, want %v", i, err, nil)
- }
- if gs := gu.String(); gs != tt.ws {
- t.Errorf("#%d: String()=%v, want %v", i, gs, tt.ws)
- }
- }
-}
-
-func TestNewUUIDBad(t *testing.T) {
- tests := []string{
- "asdf",
- "0AAF0A79-1A39-4D59-ABBF-1BEBCA8209D2ABC",
- "",
- }
- for i, tt := range tests {
- g, err := NewUUID(tt)
- if err == nil {
- t.Errorf("#%d: err=nil, want non-nil", i)
- }
- if g != nil {
- t.Errorf("#%d: err=%v, want %v", i, g, nil)
-
- }
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/appc/spec/schema/types/volume_test.go b/Godeps/_workspace/src/github.com/appc/spec/schema/types/volume_test.go
deleted file mode 100644
index 8094793c824..00000000000
--- a/Godeps/_workspace/src/github.com/appc/spec/schema/types/volume_test.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2015 The appc Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package types
-
-import (
- "reflect"
- "testing"
-)
-
-func TestVolumeFromString(t *testing.T) {
- trueVar := true
- falseVar := false
- tests := []struct {
- s string
- v Volume
- }{
- {
- "foobar,kind=host,source=/tmp",
- Volume{
- Name: "foobar",
- Kind: "host",
- Source: "/tmp",
- ReadOnly: nil,
- },
- },
- {
- "foobar,kind=host,source=/tmp,readOnly=false",
- Volume{
- Name: "foobar",
- Kind: "host",
- Source: "/tmp",
- ReadOnly: &falseVar,
- },
- },
- {
- "foobar,kind=host,source=/tmp,readOnly=true",
- Volume{
- Name: "foobar",
- Kind: "host",
- Source: "/tmp",
- ReadOnly: &trueVar,
- },
- },
- {
- "foobar,kind=empty",
- Volume{
- Name: "foobar",
- Kind: "empty",
- ReadOnly: nil,
- },
- },
- {
- "foobar,kind=empty,readOnly=true",
- Volume{
- Name: "foobar",
- Kind: "empty",
- ReadOnly: &trueVar,
- },
- },
- }
- for i, tt := range tests {
- v, err := VolumeFromString(tt.s)
- if err != nil {
- t.Errorf("#%d: got err=%v, want nil", i, err)
- }
- if !reflect.DeepEqual(*v, tt.v) {
- t.Errorf("#%d: v=%v, want %v", i, *v, tt.v)
- }
- }
-}
-
-func TestVolumeFromStringBad(t *testing.T) {
- tests := []string{
- "#foobar,kind=host,source=/tmp",
- "foobar,kind=host,source=/tmp,readOnly=true,asdf=asdf",
- "foobar,kind=empty,source=/tmp",
- }
- for i, in := range tests {
- l, err := VolumeFromString(in)
- if l != nil {
- t.Errorf("#%d: got l=%v, want nil", i, l)
- }
- if err == nil {
- t.Errorf("#%d: got err=nil, want non-nil", i)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go
deleted file mode 100644
index 4f26241a2b8..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/copy_test.go
+++ /dev/null
@@ -1,201 +0,0 @@
-package awsutil_test
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awsutil"
- "github.com/stretchr/testify/assert"
-)
-
-func ExampleCopy() {
- type Foo struct {
- A int
- B []*string
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- f1 := &Foo{A: 1, B: []*string{&str1, &str2}}
-
- // Do the copy
- var f2 Foo
- awsutil.Copy(&f2, f1)
-
- // Print the result
- fmt.Println(awsutil.Prettify(f2))
-
- // Output:
- // {
- // A: 1,
- // B: ["hello","bye bye"]
- // }
-}
-
-func TestCopy(t *testing.T) {
- type Foo struct {
- A int
- B []*string
- C map[string]*int
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- int1 := 1
- int2 := 2
- f1 := &Foo{
- A: 1,
- B: []*string{&str1, &str2},
- C: map[string]*int{
- "A": &int1,
- "B": &int2,
- },
- }
-
- // Do the copy
- var f2 Foo
- awsutil.Copy(&f2, f1)
-
- // Values are equal
- assert.Equal(t, f2.A, f1.A)
- assert.Equal(t, f2.B, f1.B)
- assert.Equal(t, f2.C, f1.C)
-
- // But pointers are not!
- str3 := "nothello"
- int3 := 57
- f2.A = 100
- f2.B[0] = &str3
- f2.C["B"] = &int3
- assert.NotEqual(t, f2.A, f1.A)
- assert.NotEqual(t, f2.B, f1.B)
- assert.NotEqual(t, f2.C, f1.C)
-}
-
-func TestCopyIgnoreNilMembers(t *testing.T) {
- type Foo struct {
- A *string
- B []string
- C map[string]string
- }
-
- f := &Foo{}
- assert.Nil(t, f.A)
- assert.Nil(t, f.B)
- assert.Nil(t, f.C)
-
- var f2 Foo
- awsutil.Copy(&f2, f)
- assert.Nil(t, f2.A)
- assert.Nil(t, f2.B)
- assert.Nil(t, f2.C)
-
- fcopy := awsutil.CopyOf(f)
- f3 := fcopy.(*Foo)
- assert.Nil(t, f3.A)
- assert.Nil(t, f3.B)
- assert.Nil(t, f3.C)
-}
-
-func TestCopyPrimitive(t *testing.T) {
- str := "hello"
- var s string
- awsutil.Copy(&s, &str)
- assert.Equal(t, "hello", s)
-}
-
-func TestCopyNil(t *testing.T) {
- var s string
- awsutil.Copy(&s, nil)
- assert.Equal(t, "", s)
-}
-
-func TestCopyReader(t *testing.T) {
- var buf io.Reader = bytes.NewReader([]byte("hello world"))
- var r io.Reader
- awsutil.Copy(&r, buf)
- b, err := ioutil.ReadAll(r)
- assert.NoError(t, err)
- assert.Equal(t, []byte("hello world"), b)
-
- // empty bytes because this is not a deep copy
- b, err = ioutil.ReadAll(buf)
- assert.NoError(t, err)
- assert.Equal(t, []byte(""), b)
-}
-
-func TestCopyDifferentStructs(t *testing.T) {
- type SrcFoo struct {
- A int
- B []*string
- C map[string]*int
- SrcUnique string
- SameNameDiffType int
- }
- type DstFoo struct {
- A int
- B []*string
- C map[string]*int
- DstUnique int
- SameNameDiffType string
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- int1 := 1
- int2 := 2
- f1 := &SrcFoo{
- A: 1,
- B: []*string{&str1, &str2},
- C: map[string]*int{
- "A": &int1,
- "B": &int2,
- },
- SrcUnique: "unique",
- SameNameDiffType: 1,
- }
-
- // Do the copy
- var f2 DstFoo
- awsutil.Copy(&f2, f1)
-
- // Values are equal
- assert.Equal(t, f2.A, f1.A)
- assert.Equal(t, f2.B, f1.B)
- assert.Equal(t, f2.C, f1.C)
- assert.Equal(t, "unique", f1.SrcUnique)
- assert.Equal(t, 1, f1.SameNameDiffType)
- assert.Equal(t, 0, f2.DstUnique)
- assert.Equal(t, "", f2.SameNameDiffType)
-}
-
-func ExampleCopyOf() {
- type Foo struct {
- A int
- B []*string
- }
-
- // Create the initial value
- str1 := "hello"
- str2 := "bye bye"
- f1 := &Foo{A: 1, B: []*string{&str1, &str2}}
-
- // Do the copy
- v := awsutil.CopyOf(f1)
- var f2 *Foo = v.(*Foo)
-
- // Print the result
- fmt.Println(awsutil.Prettify(f2))
-
- // Output:
- // {
- // A: 1,
- // B: ["hello","bye bye"]
- // }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go
deleted file mode 100644
index 0da6b06fddc..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awsutil/path_value_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package awsutil_test
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awsutil"
- "github.com/stretchr/testify/assert"
-)
-
-type Struct struct {
- A []Struct
- z []Struct
- B *Struct
- D *Struct
- C string
-}
-
-var data = Struct{
- A: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}},
- z: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}},
- B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}},
- C: "initial",
-}
-
-func TestValueAtPathSuccess(t *testing.T) {
- assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "C"))
- assert.Equal(t, []interface{}{"value1"}, awsutil.ValuesAtPath(data, "A[0].C"))
- assert.Equal(t, []interface{}{"value2"}, awsutil.ValuesAtPath(data, "A[1].C"))
- assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[2].C"))
- assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtAnyPath(data, "a[2].c"))
- assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[-1].C"))
- assert.Equal(t, []interface{}{"value1", "value2", "value3"}, awsutil.ValuesAtPath(data, "A[].C"))
- assert.Equal(t, []interface{}{"terminal"}, awsutil.ValuesAtPath(data, "B . B . C"))
- assert.Equal(t, []interface{}{"terminal", "terminal2"}, awsutil.ValuesAtPath(data, "B.*.C"))
- assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "A.D.X || C"))
-}
-
-func TestValueAtPathFailure(t *testing.T) {
- assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "C.x"))
- assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, ".x"))
- assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "X.Y.Z"))
- assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[100].C"))
- assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[3].C"))
- assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "B.B.C.Z"))
- assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "z[-1].C"))
- assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(nil, "A.B.C"))
- assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(Struct{}, "A"))
-}
-
-func TestSetValueAtPathSuccess(t *testing.T) {
- var s Struct
- awsutil.SetValueAtPath(&s, "C", "test1")
- awsutil.SetValueAtPath(&s, "B.B.C", "test2")
- awsutil.SetValueAtPath(&s, "B.D.C", "test3")
- assert.Equal(t, "test1", s.C)
- assert.Equal(t, "test2", s.B.B.C)
- assert.Equal(t, "test3", s.B.D.C)
-
- awsutil.SetValueAtPath(&s, "B.*.C", "test0")
- assert.Equal(t, "test0", s.B.B.C)
- assert.Equal(t, "test0", s.B.D.C)
-
- var s2 Struct
- awsutil.SetValueAtAnyPath(&s2, "b.b.c", "test0")
- assert.Equal(t, "test0", s2.B.B.C)
- awsutil.SetValueAtAnyPath(&s2, "A", []Struct{{}})
- assert.Equal(t, []Struct{{}}, s2.A)
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go
deleted file mode 100644
index c4320ca1ede..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package aws
-
-import (
- "net/http"
- "reflect"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/credentials"
-)
-
-var testCredentials = credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
-
-var copyTestConfig = Config{
- Credentials: testCredentials,
- Endpoint: String("CopyTestEndpoint"),
- Region: String("COPY_TEST_AWS_REGION"),
- DisableSSL: Bool(true),
- HTTPClient: http.DefaultClient,
- LogLevel: LogLevel(LogDebug),
- Logger: NewDefaultLogger(),
- MaxRetries: Int(DefaultRetries),
- DisableParamValidation: Bool(true),
- DisableComputeChecksums: Bool(true),
- S3ForcePathStyle: Bool(true),
-}
-
-func TestCopy(t *testing.T) {
- want := copyTestConfig
- got := copyTestConfig.Copy()
- if !reflect.DeepEqual(*got, want) {
- t.Errorf("Copy() = %+v", got)
- t.Errorf(" want %+v", want)
- }
-}
-
-func TestCopyReturnsNewInstance(t *testing.T) {
- want := copyTestConfig
- got := copyTestConfig.Copy()
- if got == &want {
- t.Errorf("Copy() = %p; want different instance as source %p", got, &want)
- }
-}
-
-var mergeTestZeroValueConfig = Config{}
-
-var mergeTestConfig = Config{
- Credentials: testCredentials,
- Endpoint: String("MergeTestEndpoint"),
- Region: String("MERGE_TEST_AWS_REGION"),
- DisableSSL: Bool(true),
- HTTPClient: http.DefaultClient,
- LogLevel: LogLevel(LogDebug),
- Logger: NewDefaultLogger(),
- MaxRetries: Int(10),
- DisableParamValidation: Bool(true),
- DisableComputeChecksums: Bool(true),
- S3ForcePathStyle: Bool(true),
-}
-
-var mergeTests = []struct {
- cfg *Config
- in *Config
- want *Config
-}{
- {&Config{}, nil, &Config{}},
- {&Config{}, &mergeTestZeroValueConfig, &Config{}},
- {&Config{}, &mergeTestConfig, &mergeTestConfig},
-}
-
-func TestMerge(t *testing.T) {
- for i, tt := range mergeTests {
- got := tt.cfg.Merge(tt.in)
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("Config %d %+v", i, tt.cfg)
- t.Errorf(" Merge(%+v)", tt.in)
- t.Errorf(" got %+v", got)
- t.Errorf(" want %+v", tt.want)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types_test.go
deleted file mode 100644
index df7a3e5d2de..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types_test.go
+++ /dev/null
@@ -1,437 +0,0 @@
-package aws
-
-import (
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-)
-
-var testCasesStringSlice = [][]string{
- {"a", "b", "c", "d", "e"},
- {"a", "b", "", "", "e"},
-}
-
-func TestStringSlice(t *testing.T) {
- for idx, in := range testCasesStringSlice {
- if in == nil {
- continue
- }
- out := StringSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := StringValueSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesStringValueSlice = [][]*string{
- {String("a"), String("b"), nil, String("c")},
-}
-
-func TestStringValueSlice(t *testing.T) {
- for idx, in := range testCasesStringValueSlice {
- if in == nil {
- continue
- }
- out := StringValueSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- if in[i] == nil {
- assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
- }
- }
-
- out2 := StringSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- for i := range out2 {
- if in[i] == nil {
- assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
- }
- }
- }
-}
-
-var testCasesStringMap = []map[string]string{
- {"a": "1", "b": "2", "c": "3"},
-}
-
-func TestStringMap(t *testing.T) {
- for idx, in := range testCasesStringMap {
- if in == nil {
- continue
- }
- out := StringMap(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := StringValueMap(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesBoolSlice = [][]bool{
- {true, true, false, false},
-}
-
-func TestBoolSlice(t *testing.T) {
- for idx, in := range testCasesBoolSlice {
- if in == nil {
- continue
- }
- out := BoolSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := BoolValueSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesBoolValueSlice = [][]*bool{}
-
-func TestBoolValueSlice(t *testing.T) {
- for idx, in := range testCasesBoolValueSlice {
- if in == nil {
- continue
- }
- out := BoolValueSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- if in[i] == nil {
- assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
- }
- }
-
- out2 := BoolSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- for i := range out2 {
- if in[i] == nil {
- assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
- }
- }
- }
-}
-
-var testCasesBoolMap = []map[string]bool{
- {"a": true, "b": false, "c": true},
-}
-
-func TestBoolMap(t *testing.T) {
- for idx, in := range testCasesBoolMap {
- if in == nil {
- continue
- }
- out := BoolMap(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := BoolValueMap(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesIntSlice = [][]int{
- {1, 2, 3, 4},
-}
-
-func TestIntSlice(t *testing.T) {
- for idx, in := range testCasesIntSlice {
- if in == nil {
- continue
- }
- out := IntSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := IntValueSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesIntValueSlice = [][]*int{}
-
-func TestIntValueSlice(t *testing.T) {
- for idx, in := range testCasesIntValueSlice {
- if in == nil {
- continue
- }
- out := IntValueSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- if in[i] == nil {
- assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
- }
- }
-
- out2 := IntSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- for i := range out2 {
- if in[i] == nil {
- assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
- }
- }
- }
-}
-
-var testCasesIntMap = []map[string]int{
- {"a": 3, "b": 2, "c": 1},
-}
-
-func TestIntMap(t *testing.T) {
- for idx, in := range testCasesIntMap {
- if in == nil {
- continue
- }
- out := IntMap(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := IntValueMap(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesInt64Slice = [][]int64{
- {1, 2, 3, 4},
-}
-
-func TestInt64Slice(t *testing.T) {
- for idx, in := range testCasesInt64Slice {
- if in == nil {
- continue
- }
- out := Int64Slice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := Int64ValueSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesInt64ValueSlice = [][]*int64{}
-
-func TestInt64ValueSlice(t *testing.T) {
- for idx, in := range testCasesInt64ValueSlice {
- if in == nil {
- continue
- }
- out := Int64ValueSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- if in[i] == nil {
- assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
- }
- }
-
- out2 := Int64Slice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- for i := range out2 {
- if in[i] == nil {
- assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
- }
- }
- }
-}
-
-var testCasesInt64Map = []map[string]int64{
- {"a": 3, "b": 2, "c": 1},
-}
-
-func TestInt64Map(t *testing.T) {
- for idx, in := range testCasesInt64Map {
- if in == nil {
- continue
- }
- out := Int64Map(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := Int64ValueMap(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesFloat64Slice = [][]float64{
- {1, 2, 3, 4},
-}
-
-func TestFloat64Slice(t *testing.T) {
- for idx, in := range testCasesFloat64Slice {
- if in == nil {
- continue
- }
- out := Float64Slice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := Float64ValueSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesFloat64ValueSlice = [][]*float64{}
-
-func TestFloat64ValueSlice(t *testing.T) {
- for idx, in := range testCasesFloat64ValueSlice {
- if in == nil {
- continue
- }
- out := Float64ValueSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- if in[i] == nil {
- assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
- }
- }
-
- out2 := Float64Slice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- for i := range out2 {
- if in[i] == nil {
- assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
- }
- }
- }
-}
-
-var testCasesFloat64Map = []map[string]float64{
- {"a": 3, "b": 2, "c": 1},
-}
-
-func TestFloat64Map(t *testing.T) {
- for idx, in := range testCasesFloat64Map {
- if in == nil {
- continue
- }
- out := Float64Map(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := Float64ValueMap(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesTimeSlice = [][]time.Time{
- {time.Now(), time.Now().AddDate(100, 0, 0)},
-}
-
-func TestTimeSlice(t *testing.T) {
- for idx, in := range testCasesTimeSlice {
- if in == nil {
- continue
- }
- out := TimeSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := TimeValueSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
-
-var testCasesTimeValueSlice = [][]*time.Time{}
-
-func TestTimeValueSlice(t *testing.T) {
- for idx, in := range testCasesTimeValueSlice {
- if in == nil {
- continue
- }
- out := TimeValueSlice(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- if in[i] == nil {
- assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
- }
- }
-
- out2 := TimeSlice(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- for i := range out2 {
- if in[i] == nil {
- assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
- } else {
- assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
- }
- }
- }
-}
-
-var testCasesTimeMap = []map[string]time.Time{
- {"a": time.Now().AddDate(-100, 0, 0), "b": time.Now()},
-}
-
-func TestTimeMap(t *testing.T) {
- for idx, in := range testCasesTimeMap {
- if in == nil {
- continue
- }
- out := TimeMap(in)
- assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
- for i := range out {
- assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
- }
-
- out2 := TimeValueMap(out)
- assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
- assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go
deleted file mode 100644
index 214adcab088..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package corehandlers_test
-
-import (
- "fmt"
- "net/http"
- "os"
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/corehandlers"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
-)
-
-func TestValidateEndpointHandler(t *testing.T) {
- os.Clearenv()
- svc := service.New(aws.NewConfig().WithRegion("us-west-2"))
- svc.Handlers.Clear()
- svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler)
-
- req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- err := req.Build()
-
- assert.NoError(t, err)
-}
-
-func TestValidateEndpointHandlerErrorRegion(t *testing.T) {
- os.Clearenv()
- svc := service.New(nil)
- svc.Handlers.Clear()
- svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler)
-
- req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- err := req.Build()
-
- assert.Error(t, err)
- assert.Equal(t, aws.ErrMissingRegion, err)
-}
-
-type mockCredsProvider struct {
- expired bool
- retrieveCalled bool
-}
-
-func (m *mockCredsProvider) Retrieve() (credentials.Value, error) {
- m.retrieveCalled = true
- return credentials.Value{}, nil
-}
-
-func (m *mockCredsProvider) IsExpired() bool {
- return m.expired
-}
-
-func TestAfterRetryRefreshCreds(t *testing.T) {
- os.Clearenv()
- credProvider := &mockCredsProvider{}
- svc := service.New(&aws.Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: aws.Int(1)})
-
- svc.Handlers.Clear()
- svc.Handlers.ValidateResponse.PushBack(func(r *request.Request) {
- r.Error = awserr.New("UnknownError", "", nil)
- r.HTTPResponse = &http.Response{StatusCode: 400}
- })
- svc.Handlers.UnmarshalError.PushBack(func(r *request.Request) {
- r.Error = awserr.New("ExpiredTokenException", "", nil)
- })
- svc.Handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler)
-
- assert.True(t, svc.Config.Credentials.IsExpired(), "Expect to start out expired")
- assert.False(t, credProvider.retrieveCalled)
-
- req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- req.Send()
-
- assert.True(t, svc.Config.Credentials.IsExpired())
- assert.False(t, credProvider.retrieveCalled)
-
- _, err := svc.Config.Credentials.Get()
- assert.NoError(t, err)
- assert.True(t, credProvider.retrieveCalled)
-}
-
-type testSendHandlerTransport struct{}
-
-func (t *testSendHandlerTransport) RoundTrip(r *http.Request) (*http.Response, error) {
- return nil, fmt.Errorf("mock error")
-}
-
-func TestSendHandlerError(t *testing.T) {
- svc := service.New(&aws.Config{
- HTTPClient: &http.Client{
- Transport: &testSendHandlerTransport{},
- },
- })
- svc.Handlers.Clear()
- svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler)
- r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
-
- r.Send()
-
- assert.Error(t, r.Error)
- assert.NotNil(t, r.HTTPResponse)
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go
deleted file mode 100644
index db483ba408b..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package corehandlers_test
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/corehandlers"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
- "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
- "github.com/stretchr/testify/require"
-)
-
-var testSvc = func() *service.Service {
- s := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: &aws.Config{},
- ServiceName: "mock-service",
- APIVersion: "2015-01-01",
- },
- }
- return s
-}()
-
-type StructShape struct {
- RequiredList []*ConditionalStructShape `required:"true"`
- RequiredMap map[string]*ConditionalStructShape `required:"true"`
- RequiredBool *bool `required:"true"`
- OptionalStruct *ConditionalStructShape
-
- hiddenParameter *string
-
- metadataStructureShape
-}
-
-type metadataStructureShape struct {
- SDKShapeTraits bool
-}
-
-type ConditionalStructShape struct {
- Name *string `required:"true"`
- SDKShapeTraits bool
-}
-
-func TestNoErrors(t *testing.T) {
- input := &StructShape{
- RequiredList: []*ConditionalStructShape{},
- RequiredMap: map[string]*ConditionalStructShape{
- "key1": {Name: aws.String("Name")},
- "key2": {Name: aws.String("Name")},
- },
- RequiredBool: aws.Bool(true),
- OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")},
- }
-
- req := testSvc.NewRequest(&request.Operation{}, input, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
- require.NoError(t, req.Error)
-}
-
-func TestMissingRequiredParameters(t *testing.T) {
- input := &StructShape{}
- req := testSvc.NewRequest(&request.Operation{}, input, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
-
- require.Error(t, req.Error)
- assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code())
- assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList\n- missing required parameter: RequiredMap\n- missing required parameter: RequiredBool", req.Error.(awserr.Error).Message())
-}
-
-func TestNestedMissingRequiredParameters(t *testing.T) {
- input := &StructShape{
- RequiredList: []*ConditionalStructShape{{}},
- RequiredMap: map[string]*ConditionalStructShape{
- "key1": {Name: aws.String("Name")},
- "key2": {},
- },
- RequiredBool: aws.Bool(true),
- OptionalStruct: &ConditionalStructShape{},
- }
-
- req := testSvc.NewRequest(&request.Operation{}, input, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
-
- require.Error(t, req.Error)
- assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code())
- assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList[0].Name\n- missing required parameter: RequiredMap[\"key2\"].Name\n- missing required parameter: OptionalStruct.Name", req.Error.(awserr.Error).Message())
-}
-
-type testInput struct {
- StringField string `min:"5"`
- PtrStrField *string `min:"2"`
- ListField []string `min:"3"`
- MapField map[string]string `min:"4"`
-}
-
-var testsFieldMin = []struct {
- err awserr.Error
- in testInput
-}{
- {
- err: awserr.New("InvalidParameter", "1 validation errors:\n- field too short, minimum length 5: StringField", nil),
- in: testInput{StringField: "abcd"},
- },
- {
- err: awserr.New("InvalidParameter", "2 validation errors:\n- field too short, minimum length 5: StringField\n- field too short, minimum length 3: ListField", nil),
- in: testInput{StringField: "abcd", ListField: []string{"a", "b"}},
- },
- {
- err: awserr.New("InvalidParameter", "3 validation errors:\n- field too short, minimum length 5: StringField\n- field too short, minimum length 3: ListField\n- field too short, minimum length 4: MapField", nil),
- in: testInput{StringField: "abcd", ListField: []string{"a", "b"}, MapField: map[string]string{"a": "a", "b": "b"}},
- },
- {
- err: awserr.New("InvalidParameter", "1 validation errors:\n- field too short, minimum length 2: PtrStrField", nil),
- in: testInput{StringField: "abcde", PtrStrField: aws.String("v")},
- },
- {
- err: nil,
- in: testInput{StringField: "abcde", PtrStrField: aws.String("value"),
- ListField: []string{"a", "b", "c"}, MapField: map[string]string{"a": "a", "b": "b", "c": "c", "d": "d"}},
- },
-}
-
-func TestValidateFieldMinParameter(t *testing.T) {
- for i, c := range testsFieldMin {
- req := testSvc.NewRequest(&request.Operation{}, &c.in, nil)
- corehandlers.ValidateParametersHandler.Fn(req)
-
- require.Equal(t, c.err, req.Error, "%d case failed", i)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go
deleted file mode 100644
index 4fba22f29f4..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/chain_provider_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package credentials
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/stretchr/testify/assert"
-)
-
-func TestChainProviderGet(t *testing.T) {
- p := &ChainProvider{
- Providers: []Provider{
- &stubProvider{err: awserr.New("FirstError", "first provider error", nil)},
- &stubProvider{err: awserr.New("SecondError", "second provider error", nil)},
- &stubProvider{
- creds: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- },
- },
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
- assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect session token to be empty")
-}
-
-func TestChainProviderIsExpired(t *testing.T) {
- stubProvider := &stubProvider{expired: true}
- p := &ChainProvider{
- Providers: []Provider{
- stubProvider,
- },
- }
-
- assert.True(t, p.IsExpired(), "Expect expired to be true before any Retrieve")
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
- assert.False(t, p.IsExpired(), "Expect not expired after retrieve")
-
- stubProvider.expired = true
- assert.True(t, p.IsExpired(), "Expect return of expired provider")
-
- _, err = p.Retrieve()
- assert.False(t, p.IsExpired(), "Expect not expired after retrieve")
-}
-
-func TestChainProviderWithNoProvider(t *testing.T) {
- p := &ChainProvider{
- Providers: []Provider{},
- }
-
- assert.True(t, p.IsExpired(), "Expect expired with no providers")
- _, err := p.Retrieve()
- assert.Equal(t, ErrNoValidProvidersFoundInChain, err, "Expect no providers error returned")
-}
-
-func TestChainProviderWithNoValidProvider(t *testing.T) {
- p := &ChainProvider{
- Providers: []Provider{
- &stubProvider{err: awserr.New("FirstError", "first provider error", nil)},
- &stubProvider{err: awserr.New("SecondError", "second provider error", nil)},
- },
- }
-
- assert.True(t, p.IsExpired(), "Expect expired with no providers")
- _, err := p.Retrieve()
- assert.Equal(t, ErrNoValidProvidersFoundInChain, err, "Expect no providers error returned")
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go
deleted file mode 100644
index 99c2b47742e..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/credentials_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package credentials
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/stretchr/testify/assert"
-)
-
-type stubProvider struct {
- creds Value
- expired bool
- err error
-}
-
-func (s *stubProvider) Retrieve() (Value, error) {
- s.expired = false
- return s.creds, s.err
-}
-func (s *stubProvider) IsExpired() bool {
- return s.expired
-}
-
-func TestCredentialsGet(t *testing.T) {
- c := NewCredentials(&stubProvider{
- creds: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- expired: true,
- })
-
- creds, err := c.Get()
- assert.Nil(t, err, "Expected no error")
- assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect session token to be empty")
-}
-
-func TestCredentialsGetWithError(t *testing.T) {
- c := NewCredentials(&stubProvider{err: awserr.New("provider error", "", nil), expired: true})
-
- _, err := c.Get()
- assert.Equal(t, "provider error", err.(awserr.Error).Code(), "Expected provider error")
-}
-
-func TestCredentialsExpire(t *testing.T) {
- stub := &stubProvider{}
- c := NewCredentials(stub)
-
- stub.expired = false
- assert.True(t, c.IsExpired(), "Expected to start out expired")
- c.Expire()
- assert.True(t, c.IsExpired(), "Expected to be expired")
-
- c.forceRefresh = false
- assert.False(t, c.IsExpired(), "Expected not to be expired")
-
- stub.expired = true
- assert.True(t, c.IsExpired(), "Expected to be expired")
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go
deleted file mode 100644
index cd0cbc97e06..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package ec2rolecreds_test
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
- "github.com/aws/aws-sdk-go/aws/ec2metadata"
-)
-
-const credsRespTmpl = `{
- "Code": "Success",
- "Type": "AWS-HMAC",
- "AccessKeyId" : "accessKey",
- "SecretAccessKey" : "secret",
- "Token" : "token",
- "Expiration" : "%s",
- "LastUpdated" : "2009-11-23T0:00:00Z"
-}`
-
-const credsFailRespTmpl = `{
- "Code": "ErrorCode",
- "Message": "ErrorMsg",
- "LastUpdated": "2009-11-23T0:00:00Z"
-}`
-
-func initTestServer(expireOn string, failAssume bool) *httptest.Server {
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.URL.Path == "/latest/meta-data/iam/security-credentials" {
- fmt.Fprintln(w, "RoleName")
- } else if r.URL.Path == "/latest/meta-data/iam/security-credentials/RoleName" {
- if failAssume {
- fmt.Fprintf(w, credsFailRespTmpl)
- } else {
- fmt.Fprintf(w, credsRespTmpl, expireOn)
- }
- } else {
- http.Error(w, "bad request", http.StatusBadRequest)
- }
- }))
-
- return server
-}
-
-func TestEC2RoleProvider(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestEC2RoleProviderFailAssume(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", true)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
-
- creds, err := p.Retrieve()
- assert.Error(t, err, "Expect error")
-
- e := err.(awserr.Error)
- assert.Equal(t, "ErrorCode", e.Code())
- assert.Equal(t, "ErrorMsg", e.Message())
- assert.Nil(t, e.OrigErr())
-
- assert.Equal(t, "", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "", creds.SessionToken, "Expect session token to match")
-}
-
-func TestEC2RoleProviderIsExpired(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
- p.CurrentTime = func() time.Time {
- return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.")
-
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.")
-
- p.CurrentTime = func() time.Time {
- return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired.")
-}
-
-func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}),
- ExpiryWindow: time.Hour * 1,
- }
- p.CurrentTime = func() time.Time {
- return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.")
-
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.")
-
- p.CurrentTime = func() time.Time {
- return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC)
- }
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired.")
-}
-
-func BenchmarkEC2RoleProvider(b *testing.B) {
- server := initTestServer("2014-12-16T01:51:37Z", false)
- defer server.Close()
-
- p := &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}),
- }
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
-
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
- }
- })
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go
deleted file mode 100644
index 53f6ce256eb..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/env_provider_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package credentials
-
-import (
- "github.com/stretchr/testify/assert"
- "os"
- "testing"
-)
-
-func TestEnvProviderRetrieve(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
- os.Setenv("AWS_SESSION_TOKEN", "token")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "access", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestEnvProviderIsExpired(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
- os.Setenv("AWS_SESSION_TOKEN", "token")
-
- e := EnvProvider{}
-
- assert.True(t, e.IsExpired(), "Expect creds to be expired before retrieve.")
-
- _, err := e.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.False(t, e.IsExpired(), "Expect creds to not be expired after retrieve.")
-}
-
-func TestEnvProviderNoAccessKeyID(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Equal(t, ErrAccessKeyIDNotFound, err, "ErrAccessKeyIDNotFound expected, but was %#v error: %#v", creds, err)
-}
-
-func TestEnvProviderNoSecretAccessKey(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY_ID", "access")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Equal(t, ErrSecretAccessKeyNotFound, err, "ErrSecretAccessKeyNotFound expected, but was %#v error: %#v", creds, err)
-}
-
-func TestEnvProviderAlternateNames(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_ACCESS_KEY", "access")
- os.Setenv("AWS_SECRET_KEY", "secret")
-
- e := EnvProvider{}
- creds, err := e.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "access", creds.AccessKeyID, "Expected access key ID")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expected secret access key")
- assert.Empty(t, creds.SessionToken, "Expected no token")
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go
deleted file mode 100644
index 1d9983f2ce1..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package credentials
-
-import (
- "github.com/stretchr/testify/assert"
- "os"
- "testing"
-)
-
-func TestSharedCredentialsProvider(t *testing.T) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestSharedCredentialsProviderIsExpired(t *testing.T) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
-
- assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve")
-
- _, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve")
-}
-
-func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILE(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "example.ini")
- p := SharedCredentialsProvider{}
- creds, err := p.Retrieve()
-
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
-}
-
-func TestSharedCredentialsProviderWithAWS_PROFILE(t *testing.T) {
- os.Clearenv()
- os.Setenv("AWS_PROFILE", "no_token")
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect no token")
-}
-
-func TestSharedCredentialsProviderWithoutTokenFromProfile(t *testing.T) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: "no_token"}
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect no token")
-}
-
-func BenchmarkSharedCredentialsProvider(b *testing.B) {
- os.Clearenv()
-
- p := SharedCredentialsProvider{Filename: "example.ini", Profile: ""}
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go
deleted file mode 100644
index ea012369624..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/static_provider_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package credentials
-
-import (
- "github.com/stretchr/testify/assert"
- "testing"
-)
-
-func TestStaticProviderGet(t *testing.T) {
- s := StaticProvider{
- Value: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- }
-
- creds, err := s.Retrieve()
- assert.Nil(t, err, "Expect no error")
- assert.Equal(t, "AKID", creds.AccessKeyID, "Expect access key ID to match")
- assert.Equal(t, "SECRET", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Empty(t, creds.SessionToken, "Expect no session token")
-}
-
-func TestStaticProviderIsExpired(t *testing.T) {
- s := StaticProvider{
- Value: Value{
- AccessKeyID: "AKID",
- SecretAccessKey: "SECRET",
- SessionToken: "",
- },
- }
-
- assert.False(t, s.IsExpired(), "Expect static credentials to never expire")
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go
deleted file mode 100644
index f5b97c0053b..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package stscreds
-
-import (
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/sts"
- "github.com/stretchr/testify/assert"
-)
-
-type stubSTS struct {
-}
-
-func (s *stubSTS) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) {
- expiry := time.Now().Add(60 * time.Minute)
- return &sts.AssumeRoleOutput{
- Credentials: &sts.Credentials{
- // Just reflect the role arn to the provider.
- AccessKeyId: input.RoleArn,
- SecretAccessKey: aws.String("assumedSecretAccessKey"),
- SessionToken: aws.String("assumedSessionToken"),
- Expiration: &expiry,
- },
- }, nil
-}
-
-func TestAssumeRoleProvider(t *testing.T) {
- stub := &stubSTS{}
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- }
-
- creds, err := p.Retrieve()
- assert.Nil(t, err, "Expect no error")
-
- assert.Equal(t, "roleARN", creds.AccessKeyID, "Expect access key ID to be reflected role ARN")
- assert.Equal(t, "assumedSecretAccessKey", creds.SecretAccessKey, "Expect secret access key to match")
- assert.Equal(t, "assumedSessionToken", creds.SessionToken, "Expect session token to match")
-}
-
-func BenchmarkAssumeRoleProvider(b *testing.B) {
- stub := &stubSTS{}
- p := &AssumeRoleProvider{
- Client: stub,
- RoleARN: "roleARN",
- }
-
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- _, err := p.Retrieve()
- if err != nil {
- b.Fatal(err)
- }
- }
- })
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go
deleted file mode 100644
index 61ab62a5305..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package ec2metadata_test
-
-import (
- "bytes"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "path"
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/ec2metadata"
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-func initTestServer(path string, resp string) *httptest.Server {
- return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.RequestURI != path {
- http.Error(w, "not found", http.StatusNotFound)
- return
- }
-
- w.Write([]byte(resp))
- }))
-}
-
-func TestEndpoint(t *testing.T) {
- c := ec2metadata.New(&ec2metadata.Config{})
- op := &request.Operation{
- Name: "GetMetadata",
- HTTPMethod: "GET",
- HTTPPath: path.Join("/", "meta-data", "testpath"),
- }
-
- req := c.Service.NewRequest(op, nil, nil)
- assert.Equal(t, "http://169.254.169.254/latest", req.Service.Endpoint)
- assert.Equal(t, "http://169.254.169.254/latest/meta-data/testpath", req.HTTPRequest.URL.String())
-}
-
-func TestGetMetadata(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/some/path",
- "success", // real response includes suffix
- )
- defer server.Close()
- c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- resp, err := c.GetMetadata("some/path")
-
- assert.NoError(t, err)
- assert.Equal(t, "success", resp)
-}
-
-func TestGetRegion(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/placement/availability-zone",
- "us-west-2a", // real response includes suffix
- )
- defer server.Close()
- c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- region, err := c.Region()
-
- assert.NoError(t, err)
- assert.Equal(t, "us-west-2", region)
-}
-
-func TestMetadataAvailable(t *testing.T) {
- server := initTestServer(
- "/latest/meta-data/instance-id",
- "instance-id",
- )
- defer server.Close()
- c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")})
-
- available := c.Available()
-
- assert.True(t, available)
-}
-
-func TestMetadataNotAvailable(t *testing.T) {
- c := ec2metadata.New(nil)
- c.Handlers.Send.Clear()
- c.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{
- StatusCode: int(0),
- Status: http.StatusText(int(0)),
- Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
- }
- r.Error = awserr.New("RequestError", "send request failed", nil)
- r.Retryable = aws.Bool(true) // network errors are retryable
- })
-
- available := c.Available()
-
- assert.False(t, available)
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go
deleted file mode 100644
index 2ff05a8154e..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package request_test
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/request"
-)
-
-func TestHandlerList(t *testing.T) {
- s := ""
- r := &request.Request{}
- l := request.HandlerList{}
- l.PushBack(func(r *request.Request) {
- s += "a"
- r.Data = s
- })
- l.Run(r)
- assert.Equal(t, "a", s)
- assert.Equal(t, "a", r.Data)
-}
-
-func TestMultipleHandlers(t *testing.T) {
- r := &request.Request{}
- l := request.HandlerList{}
- l.PushBack(func(r *request.Request) { r.Data = nil })
- l.PushFront(func(r *request.Request) { r.Data = aws.Bool(true) })
- l.Run(r)
- if r.Data != nil {
- t.Error("Expected handler to execute")
- }
-}
-
-func TestNamedHandlers(t *testing.T) {
- l := request.HandlerList{}
- named := request.NamedHandler{"Name", func(r *request.Request) {}}
- named2 := request.NamedHandler{"NotName", func(r *request.Request) {}}
- l.PushBackNamed(named)
- l.PushBackNamed(named)
- l.PushBackNamed(named2)
- l.PushBack(func(r *request.Request) {})
- assert.Equal(t, 4, l.Len())
- l.Remove(named)
- assert.Equal(t, 2, l.Len())
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go
deleted file mode 100644
index c0f151eeea6..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go
+++ /dev/null
@@ -1,307 +0,0 @@
-package request_test
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/internal/test/unit"
- "github.com/aws/aws-sdk-go/service/dynamodb"
- "github.com/aws/aws-sdk-go/service/s3"
-)
-
-var _ = unit.Imported
-
-// Use DynamoDB methods for simplicity
-func TestPagination(t *testing.T) {
- db := dynamodb.New(nil)
- tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false
-
- reqNum := 0
- resps := []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
- {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
- {TableNames: []*string{aws.String("Table5")}},
- }
-
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- db.Handlers.Build.PushBack(func(r *request.Request) {
- in := r.Params.(*dynamodb.ListTablesInput)
- if in == nil {
- tokens = append(tokens, "")
- } else if in.ExclusiveStartTableName != nil {
- tokens = append(tokens, *in.ExclusiveStartTableName)
- }
- })
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
- numPages++
- for _, t := range p.TableNames {
- pages = append(pages, *t)
- }
- if last {
- if gotToEnd {
- assert.Fail(t, "last=true happened twice")
- }
- gotToEnd = true
- }
- return true
- })
-
- assert.Equal(t, []string{"Table2", "Table4"}, tokens)
- assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages)
- assert.Equal(t, 3, numPages)
- assert.True(t, gotToEnd)
- assert.Nil(t, err)
- assert.Nil(t, params.ExclusiveStartTableName)
-}
-
-// Use DynamoDB methods for simplicity
-func TestPaginationEachPage(t *testing.T) {
- db := dynamodb.New(nil)
- tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false
-
- reqNum := 0
- resps := []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
- {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
- {TableNames: []*string{aws.String("Table5")}},
- }
-
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- db.Handlers.Build.PushBack(func(r *request.Request) {
- in := r.Params.(*dynamodb.ListTablesInput)
- if in == nil {
- tokens = append(tokens, "")
- } else if in.ExclusiveStartTableName != nil {
- tokens = append(tokens, *in.ExclusiveStartTableName)
- }
- })
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- req, _ := db.ListTablesRequest(params)
- err := req.EachPage(func(p interface{}, last bool) bool {
- numPages++
- for _, t := range p.(*dynamodb.ListTablesOutput).TableNames {
- pages = append(pages, *t)
- }
- if last {
- if gotToEnd {
- assert.Fail(t, "last=true happened twice")
- }
- gotToEnd = true
- }
-
- return true
- })
-
- assert.Equal(t, []string{"Table2", "Table4"}, tokens)
- assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages)
- assert.Equal(t, 3, numPages)
- assert.True(t, gotToEnd)
- assert.Nil(t, err)
-}
-
-// Use DynamoDB methods for simplicity
-func TestPaginationEarlyExit(t *testing.T) {
- db := dynamodb.New(nil)
- numPages, gotToEnd := 0, false
-
- reqNum := 0
- resps := []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
- {TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
- {TableNames: []*string{aws.String("Table5")}},
- }
-
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[reqNum]
- reqNum++
- })
-
- params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
- numPages++
- if numPages == 2 {
- return false
- }
- if last {
- if gotToEnd {
- assert.Fail(t, "last=true happened twice")
- }
- gotToEnd = true
- }
- return true
- })
-
- assert.Equal(t, 2, numPages)
- assert.False(t, gotToEnd)
- assert.Nil(t, err)
-}
-
-func TestSkipPagination(t *testing.T) {
- client := s3.New(nil)
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
- client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = &s3.HeadBucketOutput{}
- })
-
- req, _ := client.HeadBucketRequest(&s3.HeadBucketInput{Bucket: aws.String("bucket")})
-
- numPages, gotToEnd := 0, false
- req.EachPage(func(p interface{}, last bool) bool {
- numPages++
- if last {
- gotToEnd = true
- }
- return true
- })
- assert.Equal(t, 1, numPages)
- assert.True(t, gotToEnd)
-}
-
-// Use S3 for simplicity
-func TestPaginationTruncation(t *testing.T) {
- count := 0
- client := s3.New(nil)
-
- reqNum := &count
- resps := []*s3.ListObjectsOutput{
- {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}},
- {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}},
- {IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}},
- {IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}},
- }
-
- client.Handlers.Send.Clear() // mock sending
- client.Handlers.Unmarshal.Clear()
- client.Handlers.UnmarshalMeta.Clear()
- client.Handlers.ValidateResponse.Clear()
- client.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = resps[*reqNum]
- *reqNum++
- })
-
- params := &s3.ListObjectsInput{Bucket: aws.String("bucket")}
-
- results := []string{}
- err := client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
- results = append(results, *p.Contents[0].Key)
- return true
- })
-
- assert.Equal(t, []string{"Key1", "Key2", "Key3"}, results)
- assert.Nil(t, err)
-
- // Try again without truncation token at all
- count = 0
- resps[1].IsTruncated = nil
- resps[2].IsTruncated = aws.Bool(true)
- results = []string{}
- err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
- results = append(results, *p.Contents[0].Key)
- return true
- })
-
- assert.Equal(t, []string{"Key1", "Key2"}, results)
- assert.Nil(t, err)
-
-}
-
-// Benchmarks
-var benchResps = []*dynamodb.ListTablesOutput{
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
- {TableNames: []*string{aws.String("TABLE")}},
-}
-
-var benchDb = func() *dynamodb.DynamoDB {
- db := dynamodb.New(nil)
- db.Handlers.Send.Clear() // mock sending
- db.Handlers.Unmarshal.Clear()
- db.Handlers.UnmarshalMeta.Clear()
- db.Handlers.ValidateResponse.Clear()
- return db
-}
-
-func BenchmarkCodegenIterator(b *testing.B) {
- reqNum := 0
- db := benchDb()
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = benchResps[reqNum]
- reqNum++
- })
-
- input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- iter := func(fn func(*dynamodb.ListTablesOutput, bool) bool) error {
- page, _ := db.ListTablesRequest(input)
- for ; page != nil; page = page.NextPage() {
- page.Send()
- out := page.Data.(*dynamodb.ListTablesOutput)
- if result := fn(out, !page.HasNextPage()); page.Error != nil || !result {
- return page.Error
- }
- }
- return nil
- }
-
- for i := 0; i < b.N; i++ {
- reqNum = 0
- iter(func(p *dynamodb.ListTablesOutput, last bool) bool {
- return true
- })
- }
-}
-
-func BenchmarkEachPageIterator(b *testing.B) {
- reqNum := 0
- db := benchDb()
- db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
- r.Data = benchResps[reqNum]
- reqNum++
- })
-
- input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
- for i := 0; i < b.N; i++ {
- reqNum = 0
- req, _ := db.ListTablesRequest(input)
- req.EachPage(func(p interface{}, last bool) bool {
- return true
- })
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go
deleted file mode 100644
index 6cea0bd2fff..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go
+++ /dev/null
@@ -1,228 +0,0 @@
-package request_test
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
- "github.com/stretchr/testify/assert"
-)
-
-type testData struct {
- Data string
-}
-
-func body(str string) io.ReadCloser {
- return ioutil.NopCloser(bytes.NewReader([]byte(str)))
-}
-
-func unmarshal(req *request.Request) {
- defer req.HTTPResponse.Body.Close()
- if req.Data != nil {
- json.NewDecoder(req.HTTPResponse.Body).Decode(req.Data)
- }
- return
-}
-
-func unmarshalError(req *request.Request) {
- bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body)
- if err != nil {
- req.Error = awserr.New("UnmarshaleError", req.HTTPResponse.Status, err)
- return
- }
- if len(bodyBytes) == 0 {
- req.Error = awserr.NewRequestFailure(
- awserr.New("UnmarshaleError", req.HTTPResponse.Status, fmt.Errorf("empty body")),
- req.HTTPResponse.StatusCode,
- "",
- )
- return
- }
- var jsonErr jsonErrorResponse
- if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil {
- req.Error = awserr.New("UnmarshaleError", "JSON unmarshal", err)
- return
- }
- req.Error = awserr.NewRequestFailure(
- awserr.New(jsonErr.Code, jsonErr.Message, nil),
- req.HTTPResponse.StatusCode,
- "",
- )
-}
-
-type jsonErrorResponse struct {
- Code string `json:"__type"`
- Message string `json:"message"`
-}
-
-// test that retries occur for 5xx status codes
-func TestRequestRecoverRetry5xx(t *testing.T) {
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 501, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
-
- s := service.New(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- assert.Nil(t, err)
- assert.Equal(t, 2, int(r.RetryCount))
- assert.Equal(t, "valid", out.Data)
-}
-
-// test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry`
-func TestRequestRecoverRetry4xxRetryable(t *testing.T) {
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 400, Body: body(`{"__type":"Throttling","message":"Rate exceeded."}`)},
- {StatusCode: 429, Body: body(`{"__type":"ProvisionedThroughputExceededException","message":"Rate exceeded."}`)},
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
-
- s := service.New(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- assert.Nil(t, err)
- assert.Equal(t, 2, int(r.RetryCount))
- assert.Equal(t, "valid", out.Data)
-}
-
-// test that retries don't occur for 4xx status codes with a response type that can't be retried
-func TestRequest4xxUnretryable(t *testing.T) {
- s := service.New(aws.NewConfig().WithMaxRetries(10))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &http.Response{StatusCode: 401, Body: body(`{"__type":"SignatureDoesNotMatch","message":"Signature does not match."}`)}
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- assert.NotNil(t, err)
- if e, ok := err.(awserr.RequestFailure); ok {
- assert.Equal(t, 401, e.StatusCode())
- } else {
- assert.Fail(t, "Expected error to be a service failure")
- }
- assert.Equal(t, "SignatureDoesNotMatch", err.(awserr.Error).Code())
- assert.Equal(t, "Signature does not match.", err.(awserr.Error).Message())
- assert.Equal(t, 0, int(r.RetryCount))
-}
-
-func TestRequestExhaustRetries(t *testing.T) {
- delays := []time.Duration{}
- sleepDelay := func(delay time.Duration) {
- delays = append(delays, delay)
- }
-
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
- }
-
- s := service.New(aws.NewConfig().WithMaxRetries(aws.DefaultRetries).WithSleepDelay(sleepDelay))
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil)
- err := r.Send()
- assert.NotNil(t, err)
- if e, ok := err.(awserr.RequestFailure); ok {
- assert.Equal(t, 500, e.StatusCode())
- } else {
- assert.Fail(t, "Expected error to be a service failure")
- }
- assert.Equal(t, "UnknownError", err.(awserr.Error).Code())
- assert.Equal(t, "An error occurred.", err.(awserr.Error).Message())
- assert.Equal(t, 3, int(r.RetryCount))
-
- expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}}
- for i, v := range delays {
- min := expectDelays[i].min * time.Millisecond
- max := expectDelays[i].max * time.Millisecond
- assert.True(t, min <= v && v <= max,
- "Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max)
- }
-}
-
-// test that the request is retried after the credentials are expired.
-func TestRequestRecoverExpiredCreds(t *testing.T) {
- reqNum := 0
- reqs := []http.Response{
- {StatusCode: 400, Body: body(`{"__type":"ExpiredTokenException","message":"expired token"}`)},
- {StatusCode: 200, Body: body(`{"data":"valid"}`)},
- }
-
- s := service.New(&aws.Config{MaxRetries: aws.Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")})
- s.Handlers.Validate.Clear()
- s.Handlers.Unmarshal.PushBack(unmarshal)
- s.Handlers.UnmarshalError.PushBack(unmarshalError)
-
- credExpiredBeforeRetry := false
- credExpiredAfterRetry := false
-
- s.Handlers.AfterRetry.PushBack(func(r *request.Request) {
- credExpiredAfterRetry = r.Service.Config.Credentials.IsExpired()
- })
-
- s.Handlers.Sign.Clear()
- s.Handlers.Sign.PushBack(func(r *request.Request) {
- r.Service.Config.Credentials.Get()
- })
- s.Handlers.Send.Clear() // mock sending
- s.Handlers.Send.PushBack(func(r *request.Request) {
- r.HTTPResponse = &reqs[reqNum]
- reqNum++
- })
- out := &testData{}
- r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out)
- err := r.Send()
- assert.Nil(t, err)
-
- assert.False(t, credExpiredBeforeRetry, "Expect valid creds before retry check")
- assert.True(t, credExpiredAfterRetry, "Expect expired creds after retry check")
- assert.False(t, s.Config.Credentials.IsExpired(), "Expect valid creds after cred expired recovery")
-
- assert.Equal(t, 1, int(r.RetryCount))
- assert.Equal(t, "valid", out.Data)
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types_test.go
deleted file mode 100644
index a4ed20e7d22..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package aws
-
-import (
- "math/rand"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestWriteAtBuffer(t *testing.T) {
- b := &WriteAtBuffer{}
-
- n, err := b.WriteAt([]byte{1}, 0)
- assert.NoError(t, err)
- assert.Equal(t, 1, n)
-
- n, err = b.WriteAt([]byte{1, 1, 1}, 5)
- assert.NoError(t, err)
- assert.Equal(t, 3, n)
-
- n, err = b.WriteAt([]byte{2}, 1)
- assert.NoError(t, err)
- assert.Equal(t, 1, n)
-
- n, err = b.WriteAt([]byte{3}, 2)
- assert.NoError(t, err)
- assert.Equal(t, 1, n)
-
- assert.Equal(t, []byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes())
-}
-
-func BenchmarkWriteAtBuffer(b *testing.B) {
- buf := &WriteAtBuffer{}
- r := rand.New(rand.NewSource(1))
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- to := r.Intn(10) * 4096
- bs := make([]byte, to)
- buf.WriteAt(bs, r.Int63n(10)*4096)
- }
-}
-
-func BenchmarkWriteAtBufferParallel(b *testing.B) {
- buf := &WriteAtBuffer{}
- r := rand.New(rand.NewSource(1))
-
- b.ResetTimer()
- b.RunParallel(func(pb *testing.PB) {
- for pb.Next() {
- to := r.Intn(10) * 4096
- bs := make([]byte, to)
- buf.WriteAt(bs, r.Int63n(10)*4096)
- }
- })
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints/endpoints_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints/endpoints_test.go
deleted file mode 100644
index 8af65879d40..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints/endpoints_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package endpoints
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestGlobalEndpoints(t *testing.T) {
- region := "mock-region-1"
- svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts"}
-
- for _, name := range svcs {
- ep, sr := EndpointForRegion(name, region)
- assert.Equal(t, name+".amazonaws.com", ep)
- assert.Equal(t, "us-east-1", sr)
- }
-}
-
-func TestServicesInCN(t *testing.T) {
- region := "cn-north-1"
- svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "s3"}
-
- for _, name := range svcs {
- ep, _ := EndpointForRegion(name, region)
- assert.Equal(t, name+"."+region+".amazonaws.com.cn", ep)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/build_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/build_test.go
deleted file mode 100644
index 8b2e59a8ae0..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/build_test.go
+++ /dev/null
@@ -1,880 +0,0 @@
-package ec2query_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/defaults"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
- "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
- "github.com/aws/aws-sdk-go/internal/protocol/ec2query"
- "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/internal/signer/v4"
- "github.com/aws/aws-sdk-go/internal/util"
- "github.com/stretchr/testify/assert"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-
-type InputService1ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService1ProtocolTest client.
-func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice1protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService1ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService1TestCaseOperation1 = "OperationName"
-
-// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService1TestShapeInputService1TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) {
- req, out := c.InputService1TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService1TestShapeInputService1TestCaseOperation1Input struct {
- Bar *string `type:"string"`
-
- Foo *string `type:"string"`
-
- metadataInputService1TestShapeInputService1TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService1TestShapeInputService1TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService1TestShapeInputService1TestCaseOperation1Output struct {
- metadataInputService1TestShapeInputService1TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService2ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService2ProtocolTest client.
-func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice2protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService2ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService2TestCaseOperation1 = "OperationName"
-
-// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation.
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService2TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService2TestShapeInputService2TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService2TestShapeInputService2TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) {
- req, out := c.InputService2TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Input struct {
- Bar *string `locationName:"barLocationName" type:"string"`
-
- Foo *string `type:"string"`
-
- Yuck *string `locationName:"yuckLocationName" queryName:"yuckQueryName" type:"string"`
-
- metadataInputService2TestShapeInputService2TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService2TestShapeInputService2TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Output struct {
- metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService3ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService3ProtocolTest client.
-func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice3protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService3ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService3TestCaseOperation1 = "OperationName"
-
-// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService3TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService3TestShapeInputService3TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService3TestShapeInputService3TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) {
- req, out := c.InputService3TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService3TestShapeInputService3TestCaseOperation1Input struct {
- StructArg *InputService3TestShapeStructType `locationName:"Struct" type:"structure"`
-
- metadataInputService3TestShapeInputService3TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService3TestShapeInputService3TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService3TestShapeInputService3TestCaseOperation1Output struct {
- metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService3TestShapeStructType struct {
- ScalarArg *string `locationName:"Scalar" type:"string"`
-
- metadataInputService3TestShapeStructType `json:"-" xml:"-"`
-}
-
-type metadataInputService3TestShapeStructType struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService4ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService4ProtocolTest client.
-func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice4protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService4ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService4TestCaseOperation1 = "OperationName"
-
-// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService4TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService4TestShapeInputService4TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService4TestShapeInputService4TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) {
- req, out := c.InputService4TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService4TestShapeInputService4TestCaseOperation1Input struct {
- ListArg []*string `type:"list"`
-
- metadataInputService4TestShapeInputService4TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService4TestShapeInputService4TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService4TestShapeInputService4TestCaseOperation1Output struct {
- metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService5ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService5ProtocolTest client.
-func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice5protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService5ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService5TestCaseOperation1 = "OperationName"
-
-// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation.
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService5TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService5TestShapeInputService5TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService5TestShapeInputService5TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) {
- req, out := c.InputService5TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Input struct {
- ListArg []*string `locationName:"ListMemberName" locationNameList:"item" type:"list"`
-
- metadataInputService5TestShapeInputService5TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService5TestShapeInputService5TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Output struct {
- metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService6ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService6ProtocolTest client.
-func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice6protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService6ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService6TestCaseOperation1 = "OperationName"
-
-// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation.
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService6TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService6TestShapeInputService6TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService6TestShapeInputService6TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) {
- req, out := c.InputService6TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Input struct {
- ListArg []*string `locationName:"ListMemberName" queryName:"ListQueryName" locationNameList:"item" type:"list"`
-
- metadataInputService6TestShapeInputService6TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService6TestShapeInputService6TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Output struct {
- metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService7ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService7ProtocolTest client.
-func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice7protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService7ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService7TestCaseOperation1 = "OperationName"
-
-// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation.
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService7TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService7TestShapeInputService7TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService7TestShapeInputService7TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) {
- req, out := c.InputService7TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Input struct {
- BlobArg []byte `type:"blob"`
-
- metadataInputService7TestShapeInputService7TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService7TestShapeInputService7TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Output struct {
- metadataInputService7TestShapeInputService7TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService8ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService8ProtocolTest client.
-func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice8protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &InputService8ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService8TestCaseOperation1 = "OperationName"
-
-// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation.
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService8TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService8TestShapeInputService8TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService8TestShapeInputService8TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
- req, out := c.InputService8TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Input struct {
- TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"`
-
- metadataInputService8TestShapeInputService8TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService8TestShapeInputService8TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Output struct {
- metadataInputService8TestShapeInputService8TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-//
-// Tests begin here
-//
-
-func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
- svc := NewInputService1ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService1TestShapeInputService1TestCaseOperation1Input{
- Bar: aws.String("val2"),
- Foo: aws.String("val1"),
- }
- req, _ := svc.InputService1TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) {
- svc := NewInputService2ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService2TestShapeInputService2TestCaseOperation1Input{
- Bar: aws.String("val2"),
- Foo: aws.String("val1"),
- Yuck: aws.String("val3"),
- }
- req, _ := svc.InputService2TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) {
- svc := NewInputService3ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService3TestShapeInputService3TestCaseOperation1Input{
- StructArg: &InputService3TestShapeStructType{
- ScalarArg: aws.String("foo"),
- },
- }
- req, _ := svc.InputService3TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService4ProtocolTestListTypesCase1(t *testing.T) {
- svc := NewInputService4ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService4TestShapeInputService4TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("foo"),
- aws.String("bar"),
- aws.String("baz"),
- },
- }
- req, _ := svc.InputService4TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) {
- svc := NewInputService5ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService5TestShapeInputService5TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("a"),
- aws.String("b"),
- aws.String("c"),
- },
- }
- req, _ := svc.InputService5TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&ListMemberName.1=a&ListMemberName.2=b&ListMemberName.3=c&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) {
- svc := NewInputService6ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService6TestShapeInputService6TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("a"),
- aws.String("b"),
- aws.String("c"),
- },
- }
- req, _ := svc.InputService6TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
- svc := NewInputService7ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService7TestShapeInputService7TestCaseOperation1Input{
- BlobArg: []byte("foo"),
- }
- req, _ := svc.InputService7TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) {
- svc := NewInputService8ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService8TestShapeInputService8TestCaseOperation1Input{
- TimeArg: aws.Time(time.Unix(1422172800, 0)),
- }
- req, _ := svc.InputService8TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- ec2query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go
deleted file mode 100644
index 3d7b0430bdc..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go
+++ /dev/null
@@ -1,836 +0,0 @@
-package ec2query_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/defaults"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
- "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
- "github.com/aws/aws-sdk-go/internal/protocol/ec2query"
- "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/internal/signer/v4"
- "github.com/aws/aws-sdk-go/internal/util"
- "github.com/stretchr/testify/assert"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-
-type OutputService1ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService1ProtocolTest client.
-func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice1protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService1ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService1TestCaseOperation1 = "OperationName"
-
-// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService1TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) {
- req, out := c.OutputService1TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation1Input struct {
- metadataOutputService1TestShapeOutputService1TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService1TestShapeOutputService1TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation1Output struct {
- Char *string `type:"character"`
-
- Double *float64 `type:"double"`
-
- FalseBool *bool `type:"boolean"`
-
- Float *float64 `type:"float"`
-
- Long *int64 `type:"long"`
-
- Num *int64 `locationName:"FooNum" type:"integer"`
-
- Str *string `type:"string"`
-
- TrueBool *bool `type:"boolean"`
-
- metadataOutputService1TestShapeOutputService1TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService1TestShapeOutputService1TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService2ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService2ProtocolTest client.
-func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice2protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService2ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService2TestCaseOperation1 = "OperationName"
-
-// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation.
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService2TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
- req, out := c.OutputService2TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Input struct {
- metadataOutputService2TestShapeOutputService2TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService2TestShapeOutputService2TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Output struct {
- Blob []byte `type:"blob"`
-
- metadataOutputService2TestShapeOutputService2TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService2TestShapeOutputService2TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService3ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService3ProtocolTest client.
-func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice3protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService3ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService3TestCaseOperation1 = "OperationName"
-
-// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation.
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService3TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
- req, out := c.OutputService3TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Input struct {
- metadataOutputService3TestShapeOutputService3TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService3TestShapeOutputService3TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Output struct {
- ListMember []*string `type:"list"`
-
- metadataOutputService3TestShapeOutputService3TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService3TestShapeOutputService3TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService4ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService4ProtocolTest client.
-func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice4protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService4ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService4TestCaseOperation1 = "OperationName"
-
-// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation.
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService4TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) {
- req, out := c.OutputService4TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Input struct {
- metadataOutputService4TestShapeOutputService4TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService4TestShapeOutputService4TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Output struct {
- ListMember []*string `locationNameList:"item" type:"list"`
-
- metadataOutputService4TestShapeOutputService4TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService4TestShapeOutputService4TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService5ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService5ProtocolTest client.
-func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice5protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService5ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService5TestCaseOperation1 = "OperationName"
-
-// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation.
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService5TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
- req, out := c.OutputService5TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Input struct {
- metadataOutputService5TestShapeOutputService5TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService5TestShapeOutputService5TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Output struct {
- ListMember []*string `type:"list" flattened:"true"`
-
- metadataOutputService5TestShapeOutputService5TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService5TestShapeOutputService5TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService6ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService6ProtocolTest client.
-func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice6protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService6ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService6TestCaseOperation1 = "OperationName"
-
-// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation.
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService6TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
- req, out := c.OutputService6TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Input struct {
- metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Output struct {
- Map map[string]*OutputService6TestShapeStructureType `type:"map"`
-
- metadataOutputService6TestShapeOutputService6TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService6TestShapeOutputService6TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService6TestShapeStructureType struct {
- Foo *string `locationName:"foo" type:"string"`
-
- metadataOutputService6TestShapeStructureType `json:"-" xml:"-"`
-}
-
-type metadataOutputService6TestShapeStructureType struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService7ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService7ProtocolTest client.
-func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice7protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService7ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService7TestCaseOperation1 = "OperationName"
-
-// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation.
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService7TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
- req, out := c.OutputService7TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Input struct {
- metadataOutputService7TestShapeOutputService7TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService7TestShapeOutputService7TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Output struct {
- Map map[string]*string `type:"map" flattened:"true"`
-
- metadataOutputService7TestShapeOutputService7TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService7TestShapeOutputService7TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService8ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService8ProtocolTest client.
-func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice8protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(ec2query.Build)
- service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
-
- return &OutputService8ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService8TestCaseOperation1 = "OperationName"
-
-// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation.
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService8TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) {
- req, out := c.OutputService8TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Input struct {
- metadataOutputService8TestShapeOutputService8TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService8TestShapeOutputService8TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Output struct {
- Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"`
-
- metadataOutputService8TestShapeOutputService8TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService8TestShapeOutputService8TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-//
-// Tests begin here
-//
-
-func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
- svc := NewOutputService1ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200arequest-id"))
- req, out := svc.OutputService1TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "a", *out.Char)
- assert.Equal(t, 1.3, *out.Double)
- assert.Equal(t, false, *out.FalseBool)
- assert.Equal(t, 1.2, *out.Float)
- assert.Equal(t, int64(200), *out.Long)
- assert.Equal(t, int64(123), *out.Num)
- assert.Equal(t, "myname", *out.Str)
- assert.Equal(t, true, *out.TrueBool)
-
-}
-
-func TestOutputService2ProtocolTestBlobCase1(t *testing.T) {
- svc := NewOutputService2ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("dmFsdWU=requestid"))
- req, out := svc.OutputService2TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "value", string(out.Blob))
-
-}
-
-func TestOutputService3ProtocolTestListsCase1(t *testing.T) {
- svc := NewOutputService3ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("abc123requestid"))
- req, out := svc.OutputService3TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "abc", *out.ListMember[0])
- assert.Equal(t, "123", *out.ListMember[1])
-
-}
-
-func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) {
- svc := NewOutputService4ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("- abc
- 123
requestid"))
- req, out := svc.OutputService4TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "abc", *out.ListMember[0])
- assert.Equal(t, "123", *out.ListMember[1])
-
-}
-
-func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) {
- svc := NewOutputService5ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("abc123requestid"))
- req, out := svc.OutputService5TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "abc", *out.ListMember[0])
- assert.Equal(t, "123", *out.ListMember[1])
-
-}
-
-func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) {
- svc := NewOutputService6ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("requestid"))
- req, out := svc.OutputService6TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "bam", *out.Map["baz"].Foo)
- assert.Equal(t, "bar", *out.Map["qux"].Foo)
-
-}
-
-func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) {
- svc := NewOutputService7ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("requestid"))
- req, out := svc.OutputService7TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "bam", *out.Map["baz"])
- assert.Equal(t, "bar", *out.Map["qux"])
-
-}
-
-func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) {
- svc := NewOutputService8ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("requestid"))
- req, out := svc.OutputService8TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- ec2query.UnmarshalMeta(req)
- ec2query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "bam", *out.Map["baz"])
- assert.Equal(t, "bar", *out.Map["qux"])
-
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/query/build_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/query/build_test.go
deleted file mode 100644
index 7b29fd79d74..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/query/build_test.go
+++ /dev/null
@@ -1,1333 +0,0 @@
-package query_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/defaults"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
- "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
- "github.com/aws/aws-sdk-go/internal/protocol/query"
- "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/internal/signer/v4"
- "github.com/aws/aws-sdk-go/internal/util"
- "github.com/stretchr/testify/assert"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-
-type InputService1ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService1ProtocolTest client.
-func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice1protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService1ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService1TestCaseOperation1 = "OperationName"
-
-// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation.
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService1TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService1TestShapeInputService1TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService1TestShapeInputService1TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) {
- req, out := c.InputService1TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService1TestShapeInputService1TestCaseOperation1Input struct {
- Bar *string `type:"string"`
-
- Foo *string `type:"string"`
-
- metadataInputService1TestShapeInputService1TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService1TestShapeInputService1TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService1TestShapeInputService1TestCaseOperation1Output struct {
- metadataInputService1TestShapeInputService1TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService2ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService2ProtocolTest client.
-func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice2protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService2ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService2TestCaseOperation1 = "OperationName"
-
-// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation.
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService2TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService2TestShapeInputService2TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService2TestShapeInputService2TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) {
- req, out := c.InputService2TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Input struct {
- StructArg *InputService2TestShapeStructType `type:"structure"`
-
- metadataInputService2TestShapeInputService2TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService2TestShapeInputService2TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService2TestShapeInputService2TestCaseOperation1Output struct {
- metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService2TestShapeStructType struct {
- ScalarArg *string `type:"string"`
-
- metadataInputService2TestShapeStructType `json:"-" xml:"-"`
-}
-
-type metadataInputService2TestShapeStructType struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService3ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService3ProtocolTest client.
-func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice3protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService3ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService3TestCaseOperation1 = "OperationName"
-
-// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation.
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService3TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService3TestShapeInputService3TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService3TestShapeInputService3TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) {
- req, out := c.InputService3TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService3TestShapeInputService3TestCaseOperation1Input struct {
- ListArg []*string `type:"list"`
-
- metadataInputService3TestShapeInputService3TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService3TestShapeInputService3TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService3TestShapeInputService3TestCaseOperation1Output struct {
- metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService4ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService4ProtocolTest client.
-func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice4protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService4ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService4TestCaseOperation1 = "OperationName"
-
-// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation.
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService4TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService4TestShapeInputService4TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService4TestShapeInputService4TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) {
- req, out := c.InputService4TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService4TestShapeInputService4TestCaseOperation1Input struct {
- ListArg []*string `type:"list" flattened:"true"`
-
- ScalarArg *string `type:"string"`
-
- metadataInputService4TestShapeInputService4TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService4TestShapeInputService4TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService4TestShapeInputService4TestCaseOperation1Output struct {
- metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService5ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService5ProtocolTest client.
-func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice5protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService5ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService5TestCaseOperation1 = "OperationName"
-
-// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation.
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService5TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService5TestShapeInputService5TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService5TestShapeInputService5TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) {
- req, out := c.InputService5TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Input struct {
- ListArg []*string `locationNameList:"ListArgLocation" type:"list" flattened:"true"`
-
- ScalarArg *string `type:"string"`
-
- metadataInputService5TestShapeInputService5TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService5TestShapeInputService5TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService5TestShapeInputService5TestCaseOperation1Output struct {
- metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService6ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService6ProtocolTest client.
-func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice6protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService6ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService6TestCaseOperation1 = "OperationName"
-
-// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation.
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService6TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService6TestShapeInputService6TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService6TestShapeInputService6TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) {
- req, out := c.InputService6TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Input struct {
- MapArg map[string]*string `type:"map"`
-
- metadataInputService6TestShapeInputService6TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService6TestShapeInputService6TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService6TestShapeInputService6TestCaseOperation1Output struct {
- metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService7ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService7ProtocolTest client.
-func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice7protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService7ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService7TestCaseOperation1 = "OperationName"
-
-// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation.
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService7TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService7TestShapeInputService7TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService7TestShapeInputService7TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) {
- req, out := c.InputService7TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Input struct {
- BlobArg []byte `type:"blob"`
-
- metadataInputService7TestShapeInputService7TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService7TestShapeInputService7TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService7TestShapeInputService7TestCaseOperation1Output struct {
- metadataInputService7TestShapeInputService7TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService8ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService8ProtocolTest client.
-func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice8protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService8ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService8TestCaseOperation1 = "OperationName"
-
-// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation.
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService8TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService8TestShapeInputService8TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService8TestShapeInputService8TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
- req, out := c.InputService8TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Input struct {
- TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"`
-
- metadataInputService8TestShapeInputService8TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataInputService8TestShapeInputService8TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService8TestShapeInputService8TestCaseOperation1Output struct {
- metadataInputService8TestShapeInputService8TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new InputService9ProtocolTest client.
-func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "inputservice9protocoltest",
- APIVersion: "2014-01-01",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &InputService9ProtocolTest{service}
-}
-
-// newRequest creates a new request for a InputService9ProtocolTest operation and runs any
-// custom request initialization.
-func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opInputService9TestCaseOperation1 = "OperationName"
-
-// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputShape) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation1,
- }
-
- if input == nil {
- input = &InputService9TestShapeInputShape{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService9TestShapeInputService9TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputShape) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) {
- req, out := c.InputService9TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-const opInputService9TestCaseOperation2 = "OperationName"
-
-// InputService9TestCaseOperation2Request generates a request for the InputService9TestCaseOperation2 operation.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation2Request(input *InputService9TestShapeInputShape) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation2Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation2,
- }
-
- if input == nil {
- input = &InputService9TestShapeInputShape{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService9TestShapeInputService9TestCaseOperation2Output{}
- req.Data = output
- return
-}
-
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation2(input *InputService9TestShapeInputShape) (*InputService9TestShapeInputService9TestCaseOperation2Output, error) {
- req, out := c.InputService9TestCaseOperation2Request(input)
- err := req.Send()
- return out, err
-}
-
-const opInputService9TestCaseOperation3 = "OperationName"
-
-// InputService9TestCaseOperation3Request generates a request for the InputService9TestCaseOperation3 operation.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation3Request(input *InputService9TestShapeInputShape) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation3Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation3,
- }
-
- if input == nil {
- input = &InputService9TestShapeInputShape{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService9TestShapeInputService9TestCaseOperation3Output{}
- req.Data = output
- return
-}
-
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation3(input *InputService9TestShapeInputShape) (*InputService9TestShapeInputService9TestCaseOperation3Output, error) {
- req, out := c.InputService9TestCaseOperation3Request(input)
- err := req.Send()
- return out, err
-}
-
-const opInputService9TestCaseOperation4 = "OperationName"
-
-// InputService9TestCaseOperation4Request generates a request for the InputService9TestCaseOperation4 operation.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation4Request(input *InputService9TestShapeInputShape) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation4Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation4,
- }
-
- if input == nil {
- input = &InputService9TestShapeInputShape{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService9TestShapeInputService9TestCaseOperation4Output{}
- req.Data = output
- return
-}
-
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation4(input *InputService9TestShapeInputShape) (*InputService9TestShapeInputService9TestCaseOperation4Output, error) {
- req, out := c.InputService9TestCaseOperation4Request(input)
- err := req.Send()
- return out, err
-}
-
-const opInputService9TestCaseOperation5 = "OperationName"
-
-// InputService9TestCaseOperation5Request generates a request for the InputService9TestCaseOperation5 operation.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation5Request(input *InputService9TestShapeInputShape) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation5Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation5,
- }
-
- if input == nil {
- input = &InputService9TestShapeInputShape{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService9TestShapeInputService9TestCaseOperation5Output{}
- req.Data = output
- return
-}
-
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation5(input *InputService9TestShapeInputShape) (*InputService9TestShapeInputService9TestCaseOperation5Output, error) {
- req, out := c.InputService9TestCaseOperation5Request(input)
- err := req.Send()
- return out, err
-}
-
-const opInputService9TestCaseOperation6 = "OperationName"
-
-// InputService9TestCaseOperation6Request generates a request for the InputService9TestCaseOperation6 operation.
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation6Request(input *InputService9TestShapeInputShape) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation6Output) {
- op := &request.Operation{
- Name: opInputService9TestCaseOperation6,
- }
-
- if input == nil {
- input = &InputService9TestShapeInputShape{}
- }
-
- req = c.newRequest(op, input, output)
- output = &InputService9TestShapeInputService9TestCaseOperation6Output{}
- req.Data = output
- return
-}
-
-func (c *InputService9ProtocolTest) InputService9TestCaseOperation6(input *InputService9TestShapeInputShape) (*InputService9TestShapeInputService9TestCaseOperation6Output, error) {
- req, out := c.InputService9TestCaseOperation6Request(input)
- err := req.Send()
- return out, err
-}
-
-type InputService9TestShapeInputService9TestCaseOperation1Output struct {
- metadataInputService9TestShapeInputService9TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeInputService9TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9TestShapeInputService9TestCaseOperation2Output struct {
- metadataInputService9TestShapeInputService9TestCaseOperation2Output `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeInputService9TestCaseOperation2Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9TestShapeInputService9TestCaseOperation3Output struct {
- metadataInputService9TestShapeInputService9TestCaseOperation3Output `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeInputService9TestCaseOperation3Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9TestShapeInputService9TestCaseOperation4Output struct {
- metadataInputService9TestShapeInputService9TestCaseOperation4Output `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeInputService9TestCaseOperation4Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9TestShapeInputService9TestCaseOperation5Output struct {
- metadataInputService9TestShapeInputService9TestCaseOperation5Output `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeInputService9TestCaseOperation5Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9TestShapeInputService9TestCaseOperation6Output struct {
- metadataInputService9TestShapeInputService9TestCaseOperation6Output `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeInputService9TestCaseOperation6Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9TestShapeInputShape struct {
- RecursiveStruct *InputService9TestShapeRecursiveStructType `type:"structure"`
-
- metadataInputService9TestShapeInputShape `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeInputShape struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type InputService9TestShapeRecursiveStructType struct {
- NoRecurse *string `type:"string"`
-
- RecursiveList []*InputService9TestShapeRecursiveStructType `type:"list"`
-
- RecursiveMap map[string]*InputService9TestShapeRecursiveStructType `type:"map"`
-
- RecursiveStruct *InputService9TestShapeRecursiveStructType `type:"structure"`
-
- metadataInputService9TestShapeRecursiveStructType `json:"-" xml:"-"`
-}
-
-type metadataInputService9TestShapeRecursiveStructType struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-//
-// Tests begin here
-//
-
-func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
- svc := NewInputService1ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService1TestShapeInputService1TestCaseOperation1Input{
- Bar: aws.String("val2"),
- Foo: aws.String("val1"),
- }
- req, _ := svc.InputService1TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) {
- svc := NewInputService2ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService2TestShapeInputService2TestCaseOperation1Input{
- StructArg: &InputService2TestShapeStructType{
- ScalarArg: aws.String("foo"),
- },
- }
- req, _ := svc.InputService2TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&StructArg.ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService3ProtocolTestListTypesCase1(t *testing.T) {
- svc := NewInputService3ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService3TestShapeInputService3TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("foo"),
- aws.String("bar"),
- aws.String("baz"),
- },
- }
- req, _ := svc.InputService3TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) {
- svc := NewInputService4ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService4TestShapeInputService4TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("a"),
- aws.String("b"),
- aws.String("c"),
- },
- ScalarArg: aws.String("foo"),
- }
- req, _ := svc.InputService4TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&ListArg.1=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService5ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) {
- svc := NewInputService5ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService5TestShapeInputService5TestCaseOperation1Input{
- ListArg: []*string{
- aws.String("a"),
- aws.String("b"),
- aws.String("c"),
- },
- ScalarArg: aws.String("foo"),
- }
- req, _ := svc.InputService5TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&ListArgLocation.1=a&ListArgLocation.2=b&ListArgLocation.3=c&ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService6ProtocolTestSerializeMapTypeCase1(t *testing.T) {
- svc := NewInputService6ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService6TestShapeInputService6TestCaseOperation1Input{
- MapArg: map[string]*string{
- "key1": aws.String("val1"),
- "key2": aws.String("val2"),
- },
- }
- req, _ := svc.InputService6TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&MapArg.entry.1.key=key1&MapArg.entry.1.value=val1&MapArg.entry.2.key=key2&MapArg.entry.2.value=val2&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
- svc := NewInputService7ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService7TestShapeInputService7TestCaseOperation1Input{
- BlobArg: []byte("foo"),
- }
- req, _ := svc.InputService7TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) {
- svc := NewInputService8ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService8TestShapeInputService8TestCaseOperation1Input{
- TimeArg: aws.Time(time.Unix(1422172800, 0)),
- }
- req, _ := svc.InputService8TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestRecursiveShapesCase1(t *testing.T) {
- svc := NewInputService9ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService9TestShapeInputShape{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- }
- req, _ := svc.InputService9TestCaseOperation1Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestRecursiveShapesCase2(t *testing.T) {
- svc := NewInputService9ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService9TestShapeInputShape{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- },
- }
- req, _ := svc.InputService9TestCaseOperation2Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestRecursiveShapesCase3(t *testing.T) {
- svc := NewInputService9ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService9TestShapeInputShape{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- NoRecurse: aws.String("foo"),
- },
- },
- },
- },
- }
- req, _ := svc.InputService9TestCaseOperation3Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveStruct.RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestRecursiveShapesCase4(t *testing.T) {
- svc := NewInputService9ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService9TestShapeInputShape{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- RecursiveList: []*InputService9TestShapeRecursiveStructType{
- {
- NoRecurse: aws.String("foo"),
- },
- {
- NoRecurse: aws.String("bar"),
- },
- },
- },
- }
- req, _ := svc.InputService9TestCaseOperation4Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.NoRecurse=bar&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestRecursiveShapesCase5(t *testing.T) {
- svc := NewInputService9ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService9TestShapeInputShape{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- RecursiveList: []*InputService9TestShapeRecursiveStructType{
- {
- NoRecurse: aws.String("foo"),
- },
- {
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- NoRecurse: aws.String("bar"),
- },
- },
- },
- },
- }
- req, _ := svc.InputService9TestCaseOperation5Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.RecursiveStruct.NoRecurse=bar&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
-
-func TestInputService9ProtocolTestRecursiveShapesCase6(t *testing.T) {
- svc := NewInputService9ProtocolTest(nil)
- svc.Endpoint = "https://test"
-
- input := &InputService9TestShapeInputShape{
- RecursiveStruct: &InputService9TestShapeRecursiveStructType{
- RecursiveMap: map[string]*InputService9TestShapeRecursiveStructType{
- "bar": {
- NoRecurse: aws.String("bar"),
- },
- "foo": {
- NoRecurse: aws.String("foo"),
- },
- },
- },
- }
- req, _ := svc.InputService9TestCaseOperation6Request(input)
- r := req.HTTPRequest
-
- // build request
- query.Build(req)
- assert.NoError(t, req.Error)
-
- // assert body
- assert.NotNil(t, r.Body)
- body, _ := ioutil.ReadAll(r.Body)
- assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveMap.entry.1.key=bar&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=bar&RecursiveStruct.RecursiveMap.entry.2.key=foo&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body)))
-
- // assert URL
- assert.Equal(t, "https://test/", r.URL.String())
-
- // assert headers
-
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/query/unmarshal_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/query/unmarshal_test.go
deleted file mode 100644
index a0dcfc43adb..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/query/unmarshal_test.go
+++ /dev/null
@@ -1,1450 +0,0 @@
-package query_test
-
-import (
- "bytes"
- "encoding/json"
- "encoding/xml"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/defaults"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
- "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
- "github.com/aws/aws-sdk-go/internal/protocol/query"
- "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
- "github.com/aws/aws-sdk-go/internal/signer/v4"
- "github.com/aws/aws-sdk-go/internal/util"
- "github.com/stretchr/testify/assert"
-)
-
-var _ bytes.Buffer // always import bytes
-var _ http.Request
-var _ json.Marshaler
-var _ time.Time
-var _ xmlutil.XMLNode
-var _ xml.Attr
-var _ = ioutil.Discard
-var _ = util.Trim("")
-var _ = url.Values{}
-var _ = io.EOF
-
-type OutputService1ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService1ProtocolTest client.
-func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice1protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService1ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService1TestCaseOperation1 = "OperationName"
-
-// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation.
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService1TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) {
- req, out := c.OutputService1TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation1Input struct {
- metadataOutputService1TestShapeOutputService1TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService1TestShapeOutputService1TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService1TestShapeOutputService1TestCaseOperation1Output struct {
- Char *string `type:"character"`
-
- Double *float64 `type:"double"`
-
- FalseBool *bool `type:"boolean"`
-
- Float *float64 `type:"float"`
-
- Long *int64 `type:"long"`
-
- Num *int64 `locationName:"FooNum" type:"integer"`
-
- Str *string `type:"string"`
-
- Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
-
- TrueBool *bool `type:"boolean"`
-
- metadataOutputService1TestShapeOutputService1TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService1TestShapeOutputService1TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService2ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService2ProtocolTest client.
-func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice2protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService2ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService2TestCaseOperation1 = "OperationName"
-
-// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation.
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService2TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
- req, out := c.OutputService2TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Input struct {
- metadataOutputService2TestShapeOutputService2TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService2TestShapeOutputService2TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService2TestShapeOutputService2TestCaseOperation1Output struct {
- Num *int64 `type:"integer"`
-
- Str *string `type:"string"`
-
- metadataOutputService2TestShapeOutputService2TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService2TestShapeOutputService2TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService3ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService3ProtocolTest client.
-func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice3protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService3ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService3TestCaseOperation1 = "OperationName"
-
-// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation.
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService3TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
- req, out := c.OutputService3TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Input struct {
- metadataOutputService3TestShapeOutputService3TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService3TestShapeOutputService3TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService3TestShapeOutputService3TestCaseOperation1Output struct {
- Blob []byte `type:"blob"`
-
- metadataOutputService3TestShapeOutputService3TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService3TestShapeOutputService3TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService4ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService4ProtocolTest client.
-func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice4protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService4ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService4TestCaseOperation1 = "OperationName"
-
-// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation.
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService4TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) {
- req, out := c.OutputService4TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Input struct {
- metadataOutputService4TestShapeOutputService4TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService4TestShapeOutputService4TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService4TestShapeOutputService4TestCaseOperation1Output struct {
- ListMember []*string `type:"list"`
-
- metadataOutputService4TestShapeOutputService4TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService4TestShapeOutputService4TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService5ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService5ProtocolTest client.
-func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice5protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService5ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService5TestCaseOperation1 = "OperationName"
-
-// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation.
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService5TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
- req, out := c.OutputService5TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Input struct {
- metadataOutputService5TestShapeOutputService5TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService5TestShapeOutputService5TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService5TestShapeOutputService5TestCaseOperation1Output struct {
- ListMember []*string `locationNameList:"item" type:"list"`
-
- metadataOutputService5TestShapeOutputService5TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService5TestShapeOutputService5TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService6ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService6ProtocolTest client.
-func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice6protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService6ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService6TestCaseOperation1 = "OperationName"
-
-// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation.
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService6TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
- req, out := c.OutputService6TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Input struct {
- metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService6TestShapeOutputService6TestCaseOperation1Output struct {
- ListMember []*string `type:"list" flattened:"true"`
-
- metadataOutputService6TestShapeOutputService6TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService6TestShapeOutputService6TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService7ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService7ProtocolTest client.
-func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice7protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService7ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService7TestCaseOperation1 = "OperationName"
-
-// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation.
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService7TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
- req, out := c.OutputService7TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Input struct {
- metadataOutputService7TestShapeOutputService7TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService7TestShapeOutputService7TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService7TestShapeOutputService7TestCaseOperation1Output struct {
- ListMember []*string `type:"list" flattened:"true"`
-
- metadataOutputService7TestShapeOutputService7TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService7TestShapeOutputService7TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService8ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService8ProtocolTest client.
-func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice8protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService8ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService8TestCaseOperation1 = "OperationName"
-
-// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation.
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService8TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) {
- req, out := c.OutputService8TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Input struct {
- metadataOutputService8TestShapeOutputService8TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService8TestShapeOutputService8TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService8TestShapeOutputService8TestCaseOperation1Output struct {
- List []*OutputService8TestShapeStructureShape `type:"list"`
-
- metadataOutputService8TestShapeOutputService8TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService8TestShapeOutputService8TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService8TestShapeStructureShape struct {
- Bar *string `type:"string"`
-
- Baz *string `type:"string"`
-
- Foo *string `type:"string"`
-
- metadataOutputService8TestShapeStructureShape `json:"-" xml:"-"`
-}
-
-type metadataOutputService8TestShapeStructureShape struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService9ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService9ProtocolTest client.
-func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice9protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService9ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService9TestCaseOperation1 = "OperationName"
-
-// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation.
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService9TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) {
- req, out := c.OutputService9TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService9TestShapeOutputService9TestCaseOperation1Input struct {
- metadataOutputService9TestShapeOutputService9TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService9TestShapeOutputService9TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService9TestShapeOutputService9TestCaseOperation1Output struct {
- List []*OutputService9TestShapeStructureShape `type:"list" flattened:"true"`
-
- metadataOutputService9TestShapeOutputService9TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService9TestShapeOutputService9TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService9TestShapeStructureShape struct {
- Bar *string `type:"string"`
-
- Baz *string `type:"string"`
-
- Foo *string `type:"string"`
-
- metadataOutputService9TestShapeStructureShape `json:"-" xml:"-"`
-}
-
-type metadataOutputService9TestShapeStructureShape struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService10ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService10ProtocolTest client.
-func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice10protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService10ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService10TestCaseOperation1 = "OperationName"
-
-// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation.
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService10TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) {
- req, out := c.OutputService10TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService10TestShapeOutputService10TestCaseOperation1Input struct {
- metadataOutputService10TestShapeOutputService10TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService10TestShapeOutputService10TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService10TestShapeOutputService10TestCaseOperation1Output struct {
- List []*string `locationNameList:"NamedList" type:"list" flattened:"true"`
-
- metadataOutputService10TestShapeOutputService10TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService10TestShapeOutputService10TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService11ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService11ProtocolTest client.
-func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice11protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService11ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService11TestCaseOperation1 = "OperationName"
-
-// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation.
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService11TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) {
- req, out := c.OutputService11TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService11TestShapeOutputService11TestCaseOperation1Input struct {
- metadataOutputService11TestShapeOutputService11TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService11TestShapeOutputService11TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService11TestShapeOutputService11TestCaseOperation1Output struct {
- Map map[string]*OutputService11TestShapeStructType `type:"map"`
-
- metadataOutputService11TestShapeOutputService11TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService11TestShapeOutputService11TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService11TestShapeStructType struct {
- Foo *string `locationName:"foo" type:"string"`
-
- metadataOutputService11TestShapeStructType `json:"-" xml:"-"`
-}
-
-type metadataOutputService11TestShapeStructType struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService12ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService12ProtocolTest client.
-func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice12protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService12ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService12TestCaseOperation1 = "OperationName"
-
-// OutputService12TestCaseOperation1Request generates a request for the OutputService12TestCaseOperation1 operation.
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService12TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) {
- req, out := c.OutputService12TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService12TestShapeOutputService12TestCaseOperation1Input struct {
- metadataOutputService12TestShapeOutputService12TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService12TestShapeOutputService12TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService12TestShapeOutputService12TestCaseOperation1Output struct {
- Map map[string]*string `type:"map" flattened:"true"`
-
- metadataOutputService12TestShapeOutputService12TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService12TestShapeOutputService12TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService13ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService13ProtocolTest client.
-func NewOutputService13ProtocolTest(config *aws.Config) *OutputService13ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice13protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService13ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService13ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService13TestCaseOperation1 = "OperationName"
-
-// OutputService13TestCaseOperation1Request generates a request for the OutputService13TestCaseOperation1 operation.
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService13TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService13TestShapeOutputService13TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (*OutputService13TestShapeOutputService13TestCaseOperation1Output, error) {
- req, out := c.OutputService13TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService13TestShapeOutputService13TestCaseOperation1Input struct {
- metadataOutputService13TestShapeOutputService13TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService13TestShapeOutputService13TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService13TestShapeOutputService13TestCaseOperation1Output struct {
- Map map[string]*string `locationName:"Attribute" locationNameKey:"Name" locationNameValue:"Value" type:"map" flattened:"true"`
-
- metadataOutputService13TestShapeOutputService13TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService13TestShapeOutputService13TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService14ProtocolTest struct {
- *service.Service
-}
-
-// New returns a new OutputService14ProtocolTest client.
-func NewOutputService14ProtocolTest(config *aws.Config) *OutputService14ProtocolTest {
- service := &service.Service{
- ServiceInfo: serviceinfo.ServiceInfo{
- Config: defaults.DefaultConfig.Merge(config),
- ServiceName: "outputservice14protocoltest",
- APIVersion: "",
- },
- }
- service.Initialize()
-
- // Handlers
- service.Handlers.Sign.PushBack(v4.Sign)
- service.Handlers.Build.PushBack(query.Build)
- service.Handlers.Unmarshal.PushBack(query.Unmarshal)
- service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
- service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
-
- return &OutputService14ProtocolTest{service}
-}
-
-// newRequest creates a new request for a OutputService14ProtocolTest operation and runs any
-// custom request initialization.
-func (c *OutputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
- req := c.NewRequest(op, params, data)
-
- return req
-}
-
-const opOutputService14TestCaseOperation1 = "OperationName"
-
-// OutputService14TestCaseOperation1Request generates a request for the OutputService14TestCaseOperation1 operation.
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *request.Request, output *OutputService14TestShapeOutputService14TestCaseOperation1Output) {
- op := &request.Operation{
- Name: opOutputService14TestCaseOperation1,
- }
-
- if input == nil {
- input = &OutputService14TestShapeOutputService14TestCaseOperation1Input{}
- }
-
- req = c.newRequest(op, input, output)
- output = &OutputService14TestShapeOutputService14TestCaseOperation1Output{}
- req.Data = output
- return
-}
-
-func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) {
- req, out := c.OutputService14TestCaseOperation1Request(input)
- err := req.Send()
- return out, err
-}
-
-type OutputService14TestShapeOutputService14TestCaseOperation1Input struct {
- metadataOutputService14TestShapeOutputService14TestCaseOperation1Input `json:"-" xml:"-"`
-}
-
-type metadataOutputService14TestShapeOutputService14TestCaseOperation1Input struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-type OutputService14TestShapeOutputService14TestCaseOperation1Output struct {
- Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"`
-
- metadataOutputService14TestShapeOutputService14TestCaseOperation1Output `json:"-" xml:"-"`
-}
-
-type metadataOutputService14TestShapeOutputService14TestCaseOperation1Output struct {
- SDKShapeTraits bool `type:"structure"`
-}
-
-//
-// Tests begin here
-//
-
-func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
- svc := NewOutputService1ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Zrequest-id"))
- req, out := svc.OutputService1TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "a", *out.Char)
- assert.Equal(t, 1.3, *out.Double)
- assert.Equal(t, false, *out.FalseBool)
- assert.Equal(t, 1.2, *out.Float)
- assert.Equal(t, int64(200), *out.Long)
- assert.Equal(t, int64(123), *out.Num)
- assert.Equal(t, "myname", *out.Str)
- assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String())
- assert.Equal(t, true, *out.TrueBool)
-
-}
-
-func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) {
- svc := NewOutputService2ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("mynamerequest-id"))
- req, out := svc.OutputService2TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "myname", *out.Str)
-
-}
-
-func TestOutputService3ProtocolTestBlobCase1(t *testing.T) {
- svc := NewOutputService3ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("dmFsdWU=requestid"))
- req, out := svc.OutputService3TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "value", string(out.Blob))
-
-}
-
-func TestOutputService4ProtocolTestListsCase1(t *testing.T) {
- svc := NewOutputService4ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("abc123requestid"))
- req, out := svc.OutputService4TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "abc", *out.ListMember[0])
- assert.Equal(t, "123", *out.ListMember[1])
-
-}
-
-func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) {
- svc := NewOutputService5ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("- abc
- 123
requestid"))
- req, out := svc.OutputService5TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "abc", *out.ListMember[0])
- assert.Equal(t, "123", *out.ListMember[1])
-
-}
-
-func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) {
- svc := NewOutputService6ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("abc123requestid"))
- req, out := svc.OutputService6TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "abc", *out.ListMember[0])
- assert.Equal(t, "123", *out.ListMember[1])
-
-}
-
-func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) {
- svc := NewOutputService7ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("abcrequestid"))
- req, out := svc.OutputService7TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "abc", *out.ListMember[0])
-
-}
-
-func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) {
- svc := NewOutputService8ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbaz
requestid"))
- req, out := svc.OutputService8TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "firstbar", *out.List[0].Bar)
- assert.Equal(t, "firstbaz", *out.List[0].Baz)
- assert.Equal(t, "firstfoo", *out.List[0].Foo)
- assert.Equal(t, "secondbar", *out.List[1].Bar)
- assert.Equal(t, "secondbaz", *out.List[1].Baz)
- assert.Equal(t, "secondfoo", *out.List[1].Foo)
-
-}
-
-func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) {
- svc := NewOutputService9ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("firstfoofirstbarfirstbaz
secondfoosecondbarsecondbaz
requestid"))
- req, out := svc.OutputService9TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "firstbar", *out.List[0].Bar)
- assert.Equal(t, "firstbaz", *out.List[0].Baz)
- assert.Equal(t, "firstfoo", *out.List[0].Foo)
- assert.Equal(t, "secondbar", *out.List[1].Bar)
- assert.Equal(t, "secondbaz", *out.List[1].Baz)
- assert.Equal(t, "secondfoo", *out.List[1].Foo)
-
-}
-
-func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) {
- svc := NewOutputService10ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("abrequestid"))
- req, out := svc.OutputService10TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "a", *out.List[0])
- assert.Equal(t, "b", *out.List[1])
-
-}
-
-func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) {
- svc := NewOutputService11ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("requestid"))
- req, out := svc.OutputService11TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "bam", *out.Map["baz"].Foo)
- assert.Equal(t, "bar", *out.Map["qux"].Foo)
-
-}
-
-func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) {
- svc := NewOutputService12ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("requestid"))
- req, out := svc.OutputService12TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "bam", *out.Map["baz"])
- assert.Equal(t, "bar", *out.Map["qux"])
-
-}
-
-func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) {
- svc := NewOutputService13ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("quxbarrequestid"))
- req, out := svc.OutputService13TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "bar", *out.Map["qux"])
-
-}
-
-func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) {
- svc := NewOutputService14ProtocolTest(nil)
-
- buf := bytes.NewReader([]byte("requestid"))
- req, out := svc.OutputService14TestCaseOperation1Request(nil)
- req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
-
- // set headers
-
- // unmarshal response
- query.UnmarshalMeta(req)
- query.Unmarshal(req)
- assert.NoError(t, req.Error)
-
- // assert response
- assert.NotNil(t, out) // ensure out variable is used
- assert.Equal(t, "bam", *out.Map["baz"])
- assert.Equal(t, "bar", *out.Map["qux"])
-
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4/functional_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4/functional_test.go
deleted file mode 100644
index fbb0e41cdc1..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4/functional_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package v4_test
-
-import (
- "net/url"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/internal/test/unit"
- "github.com/aws/aws-sdk-go/service/s3"
- "github.com/stretchr/testify/assert"
-)
-
-var _ = unit.Imported
-
-func TestPresignHandler(t *testing.T) {
- svc := s3.New(nil)
- req, _ := svc.PutObjectRequest(&s3.PutObjectInput{
- Bucket: aws.String("bucket"),
- Key: aws.String("key"),
- ContentDisposition: aws.String("a+b c$d"),
- ACL: aws.String("public-read"),
- })
- req.Time = time.Unix(0, 0)
- urlstr, err := req.Presign(5 * time.Minute)
-
- assert.NoError(t, err)
-
- expectedDate := "19700101T000000Z"
- expectedHeaders := "host;x-amz-acl"
- expectedSig := "7edcb4e3a1bf12f4989018d75acbe3a7f03df24bd6f3112602d59fc551f0e4e2"
- expectedCred := "AKID/19700101/mock-region/s3/aws4_request"
-
- u, _ := url.Parse(urlstr)
- urlQ := u.Query()
- assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature"))
- assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential"))
- assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders"))
- assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date"))
- assert.Equal(t, "300", urlQ.Get("X-Amz-Expires"))
-
- assert.NotContains(t, urlstr, "+") // + encoded as %20
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4/v4_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4/v4_test.go
deleted file mode 100644
index 0ba9ff25f73..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4/v4_test.go
+++ /dev/null
@@ -1,247 +0,0 @@
-package v4
-
-import (
- "net/http"
- "strings"
- "testing"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/request"
- "github.com/aws/aws-sdk-go/aws/service"
- "github.com/stretchr/testify/assert"
-)
-
-func buildSigner(serviceName string, region string, signTime time.Time, expireTime time.Duration, body string) signer {
- endpoint := "https://" + serviceName + "." + region + ".amazonaws.com"
- reader := strings.NewReader(body)
- req, _ := http.NewRequest("POST", endpoint, reader)
- req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()"
- req.Header.Add("X-Amz-Target", "prefix.Operation")
- req.Header.Add("Content-Type", "application/x-amz-json-1.0")
- req.Header.Add("Content-Length", string(len(body)))
- req.Header.Add("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)")
-
- return signer{
- Request: req,
- Time: signTime,
- ExpireTime: expireTime,
- Query: req.URL.Query(),
- Body: reader,
- ServiceName: serviceName,
- Region: region,
- Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
- }
-}
-
-func removeWS(text string) string {
- text = strings.Replace(text, " ", "", -1)
- text = strings.Replace(text, "\n", "", -1)
- text = strings.Replace(text, "\t", "", -1)
- return text
-}
-
-func assertEqual(t *testing.T, expected, given string) {
- if removeWS(expected) != removeWS(given) {
- t.Errorf("\nExpected: %s\nGiven: %s", expected, given)
- }
-}
-
-func TestPresignRequest(t *testing.T) {
- signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 300*time.Second, "{}")
- signer.sign()
-
- expectedDate := "19700101T000000Z"
- expectedHeaders := "host;x-amz-meta-other-header;x-amz-target"
- expectedSig := "5eeedebf6f995145ce56daa02902d10485246d3defb34f97b973c1f40ab82d36"
- expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request"
-
- q := signer.Request.URL.Query()
- assert.Equal(t, expectedSig, q.Get("X-Amz-Signature"))
- assert.Equal(t, expectedCred, q.Get("X-Amz-Credential"))
- assert.Equal(t, expectedHeaders, q.Get("X-Amz-SignedHeaders"))
- assert.Equal(t, expectedDate, q.Get("X-Amz-Date"))
-}
-
-func TestSignRequest(t *testing.T) {
- signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 0, "{}")
- signer.sign()
-
- expectedDate := "19700101T000000Z"
- expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=host;x-amz-date;x-amz-meta-other-header;x-amz-security-token;x-amz-target, Signature=69ada33fec48180dab153576e4dd80c4e04124f80dda3eccfed8a67c2b91ed5e"
-
- q := signer.Request.Header
- assert.Equal(t, expectedSig, q.Get("Authorization"))
- assert.Equal(t, expectedDate, q.Get("X-Amz-Date"))
-}
-
-func TestSignEmptyBody(t *testing.T) {
- signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "")
- signer.Body = nil
- signer.sign()
- hash := signer.Request.Header.Get("X-Amz-Content-Sha256")
- assert.Equal(t, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", hash)
-}
-
-func TestSignBody(t *testing.T) {
- signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello")
- signer.sign()
- hash := signer.Request.Header.Get("X-Amz-Content-Sha256")
- assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash)
-}
-
-func TestSignSeekedBody(t *testing.T) {
- signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, " hello")
- signer.Body.Read(make([]byte, 3)) // consume first 3 bytes so body is now "hello"
- signer.sign()
- hash := signer.Request.Header.Get("X-Amz-Content-Sha256")
- assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash)
-
- start, _ := signer.Body.Seek(0, 1)
- assert.Equal(t, int64(3), start)
-}
-
-func TestPresignEmptyBodyS3(t *testing.T) {
- signer := buildSigner("s3", "us-east-1", time.Now(), 5*time.Minute, "hello")
- signer.sign()
- hash := signer.Request.Header.Get("X-Amz-Content-Sha256")
- assert.Equal(t, "UNSIGNED-PAYLOAD", hash)
-}
-
-func TestSignPrecomputedBodyChecksum(t *testing.T) {
- signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello")
- signer.Request.Header.Set("X-Amz-Content-Sha256", "PRECOMPUTED")
- signer.sign()
- hash := signer.Request.Header.Get("X-Amz-Content-Sha256")
- assert.Equal(t, "PRECOMPUTED", hash)
-}
-
-func TestAnonymousCredentials(t *testing.T) {
- svc := service.New(&aws.Config{Credentials: credentials.AnonymousCredentials})
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- Sign(r)
-
- urlQ := r.HTTPRequest.URL.Query()
- assert.Empty(t, urlQ.Get("X-Amz-Signature"))
- assert.Empty(t, urlQ.Get("X-Amz-Credential"))
- assert.Empty(t, urlQ.Get("X-Amz-SignedHeaders"))
- assert.Empty(t, urlQ.Get("X-Amz-Date"))
-
- hQ := r.HTTPRequest.Header
- assert.Empty(t, hQ.Get("Authorization"))
- assert.Empty(t, hQ.Get("X-Amz-Date"))
-}
-
-func TestIgnoreResignRequestWithValidCreds(t *testing.T) {
- svc := service.New(&aws.Config{
- Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
- Region: aws.String("us-west-2"),
- })
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
-
- Sign(r)
- sig := r.HTTPRequest.Header.Get("Authorization")
-
- Sign(r)
- assert.Equal(t, sig, r.HTTPRequest.Header.Get("Authorization"))
-}
-
-func TestIgnorePreResignRequestWithValidCreds(t *testing.T) {
- svc := service.New(&aws.Config{
- Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
- Region: aws.String("us-west-2"),
- })
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- r.ExpireTime = time.Minute * 10
-
- Sign(r)
- sig := r.HTTPRequest.Header.Get("X-Amz-Signature")
-
- Sign(r)
- assert.Equal(t, sig, r.HTTPRequest.Header.Get("X-Amz-Signature"))
-}
-
-func TestResignRequestExpiredCreds(t *testing.T) {
- creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
- svc := service.New(&aws.Config{Credentials: creds})
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- Sign(r)
- querySig := r.HTTPRequest.Header.Get("Authorization")
-
- creds.Expire()
-
- Sign(r)
- assert.NotEqual(t, querySig, r.HTTPRequest.Header.Get("Authorization"))
-}
-
-func TestPreResignRequestExpiredCreds(t *testing.T) {
- provider := &credentials.StaticProvider{credentials.Value{"AKID", "SECRET", "SESSION"}}
- creds := credentials.NewCredentials(provider)
- svc := service.New(&aws.Config{Credentials: creds})
- r := svc.NewRequest(
- &request.Operation{
- Name: "BatchGetItem",
- HTTPMethod: "POST",
- HTTPPath: "/",
- },
- nil,
- nil,
- )
- r.ExpireTime = time.Minute * 10
-
- Sign(r)
- querySig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature")
-
- creds.Expire()
- r.Time = time.Now().Add(time.Hour * 48)
-
- Sign(r)
- assert.NotEqual(t, querySig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature"))
-}
-
-func BenchmarkPresignRequest(b *testing.B) {
- signer := buildSigner("dynamodb", "us-east-1", time.Now(), 300*time.Second, "{}")
- for i := 0; i < b.N; i++ {
- signer.sign()
- }
-}
-
-func BenchmarkSignRequest(b *testing.B) {
- signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "{}")
- for i := 0; i < b.N; i++ {
- signer.sign()
- }
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface/interface_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface/interface_test.go
deleted file mode 100644
index 0c36b19cc1b..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface/interface_test.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
-
-package autoscalingiface_test
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/service/autoscaling"
- "github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface"
- "github.com/stretchr/testify/assert"
-)
-
-func TestInterface(t *testing.T) {
- assert.Implements(t, (*autoscalingiface.AutoScalingAPI)(nil), autoscaling.New(nil))
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/autoscaling/examples_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/autoscaling/examples_test.go
deleted file mode 100644
index bdcac9be04f..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/autoscaling/examples_test.go
+++ /dev/null
@@ -1,1179 +0,0 @@
-// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
-
-package autoscaling_test
-
-import (
- "bytes"
- "fmt"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/autoscaling"
-)
-
-var _ time.Duration
-var _ bytes.Buffer
-
-func ExampleAutoScaling_AttachInstances() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.AttachInstancesInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- InstanceIds: []*string{
- aws.String("XmlStringMaxLen16"), // Required
- // More values...
- },
- }
- resp, err := svc.AttachInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_AttachLoadBalancers() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.AttachLoadBalancersInput{
- AutoScalingGroupName: aws.String("ResourceName"),
- LoadBalancerNames: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- }
- resp, err := svc.AttachLoadBalancers(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_CompleteLifecycleAction() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.CompleteLifecycleActionInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- LifecycleActionResult: aws.String("LifecycleActionResult"), // Required
- LifecycleActionToken: aws.String("LifecycleActionToken"), // Required
- LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
- }
- resp, err := svc.CompleteLifecycleAction(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_CreateAutoScalingGroup() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.CreateAutoScalingGroupInput{
- AutoScalingGroupName: aws.String("XmlStringMaxLen255"), // Required
- MaxSize: aws.Int64(1), // Required
- MinSize: aws.Int64(1), // Required
- AvailabilityZones: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- DefaultCooldown: aws.Int64(1),
- DesiredCapacity: aws.Int64(1),
- HealthCheckGracePeriod: aws.Int64(1),
- HealthCheckType: aws.String("XmlStringMaxLen32"),
- InstanceId: aws.String("XmlStringMaxLen16"),
- LaunchConfigurationName: aws.String("ResourceName"),
- LoadBalancerNames: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- PlacementGroup: aws.String("XmlStringMaxLen255"),
- Tags: []*autoscaling.Tag{
- { // Required
- Key: aws.String("TagKey"), // Required
- PropagateAtLaunch: aws.Bool(true),
- ResourceId: aws.String("XmlString"),
- ResourceType: aws.String("XmlString"),
- Value: aws.String("TagValue"),
- },
- // More values...
- },
- TerminationPolicies: []*string{
- aws.String("XmlStringMaxLen1600"), // Required
- // More values...
- },
- VPCZoneIdentifier: aws.String("XmlStringMaxLen255"),
- }
- resp, err := svc.CreateAutoScalingGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_CreateLaunchConfiguration() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.CreateLaunchConfigurationInput{
- LaunchConfigurationName: aws.String("XmlStringMaxLen255"), // Required
- AssociatePublicIpAddress: aws.Bool(true),
- BlockDeviceMappings: []*autoscaling.BlockDeviceMapping{
- { // Required
- DeviceName: aws.String("XmlStringMaxLen255"), // Required
- Ebs: &autoscaling.Ebs{
- DeleteOnTermination: aws.Bool(true),
- Iops: aws.Int64(1),
- SnapshotId: aws.String("XmlStringMaxLen255"),
- VolumeSize: aws.Int64(1),
- VolumeType: aws.String("BlockDeviceEbsVolumeType"),
- },
- NoDevice: aws.Bool(true),
- VirtualName: aws.String("XmlStringMaxLen255"),
- },
- // More values...
- },
- ClassicLinkVPCId: aws.String("XmlStringMaxLen255"),
- ClassicLinkVPCSecurityGroups: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- EbsOptimized: aws.Bool(true),
- IamInstanceProfile: aws.String("XmlStringMaxLen1600"),
- ImageId: aws.String("XmlStringMaxLen255"),
- InstanceId: aws.String("XmlStringMaxLen16"),
- InstanceMonitoring: &autoscaling.InstanceMonitoring{
- Enabled: aws.Bool(true),
- },
- InstanceType: aws.String("XmlStringMaxLen255"),
- KernelId: aws.String("XmlStringMaxLen255"),
- KeyName: aws.String("XmlStringMaxLen255"),
- PlacementTenancy: aws.String("XmlStringMaxLen64"),
- RamdiskId: aws.String("XmlStringMaxLen255"),
- SecurityGroups: []*string{
- aws.String("XmlString"), // Required
- // More values...
- },
- SpotPrice: aws.String("SpotPrice"),
- UserData: aws.String("XmlStringUserData"),
- }
- resp, err := svc.CreateLaunchConfiguration(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_CreateOrUpdateTags() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.CreateOrUpdateTagsInput{
- Tags: []*autoscaling.Tag{ // Required
- { // Required
- Key: aws.String("TagKey"), // Required
- PropagateAtLaunch: aws.Bool(true),
- ResourceId: aws.String("XmlString"),
- ResourceType: aws.String("XmlString"),
- Value: aws.String("TagValue"),
- },
- // More values...
- },
- }
- resp, err := svc.CreateOrUpdateTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DeleteAutoScalingGroup() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DeleteAutoScalingGroupInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- ForceDelete: aws.Bool(true),
- }
- resp, err := svc.DeleteAutoScalingGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DeleteLaunchConfiguration() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DeleteLaunchConfigurationInput{
- LaunchConfigurationName: aws.String("ResourceName"), // Required
- }
- resp, err := svc.DeleteLaunchConfiguration(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DeleteLifecycleHook() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DeleteLifecycleHookInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
- }
- resp, err := svc.DeleteLifecycleHook(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DeleteNotificationConfiguration() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DeleteNotificationConfigurationInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- TopicARN: aws.String("ResourceName"), // Required
- }
- resp, err := svc.DeleteNotificationConfiguration(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DeletePolicy() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DeletePolicyInput{
- PolicyName: aws.String("ResourceName"), // Required
- AutoScalingGroupName: aws.String("ResourceName"),
- }
- resp, err := svc.DeletePolicy(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DeleteScheduledAction() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DeleteScheduledActionInput{
- ScheduledActionName: aws.String("ResourceName"), // Required
- AutoScalingGroupName: aws.String("ResourceName"),
- }
- resp, err := svc.DeleteScheduledAction(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DeleteTags() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DeleteTagsInput{
- Tags: []*autoscaling.Tag{ // Required
- { // Required
- Key: aws.String("TagKey"), // Required
- PropagateAtLaunch: aws.Bool(true),
- ResourceId: aws.String("XmlString"),
- ResourceType: aws.String("XmlString"),
- Value: aws.String("TagValue"),
- },
- // More values...
- },
- }
- resp, err := svc.DeleteTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeAccountLimits() {
- svc := autoscaling.New(nil)
-
- var params *autoscaling.DescribeAccountLimitsInput
- resp, err := svc.DescribeAccountLimits(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeAdjustmentTypes() {
- svc := autoscaling.New(nil)
-
- var params *autoscaling.DescribeAdjustmentTypesInput
- resp, err := svc.DescribeAdjustmentTypes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeAutoScalingGroups() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeAutoScalingGroupsInput{
- AutoScalingGroupNames: []*string{
- aws.String("ResourceName"), // Required
- // More values...
- },
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- }
- resp, err := svc.DescribeAutoScalingGroups(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeAutoScalingInstances() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeAutoScalingInstancesInput{
- InstanceIds: []*string{
- aws.String("XmlStringMaxLen16"), // Required
- // More values...
- },
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- }
- resp, err := svc.DescribeAutoScalingInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeAutoScalingNotificationTypes() {
- svc := autoscaling.New(nil)
-
- var params *autoscaling.DescribeAutoScalingNotificationTypesInput
- resp, err := svc.DescribeAutoScalingNotificationTypes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeLaunchConfigurations() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeLaunchConfigurationsInput{
- LaunchConfigurationNames: []*string{
- aws.String("ResourceName"), // Required
- // More values...
- },
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- }
- resp, err := svc.DescribeLaunchConfigurations(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeLifecycleHookTypes() {
- svc := autoscaling.New(nil)
-
- var params *autoscaling.DescribeLifecycleHookTypesInput
- resp, err := svc.DescribeLifecycleHookTypes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeLifecycleHooks() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeLifecycleHooksInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- LifecycleHookNames: []*string{
- aws.String("AsciiStringMaxLen255"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeLifecycleHooks(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeLoadBalancers() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeLoadBalancersInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- }
- resp, err := svc.DescribeLoadBalancers(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeMetricCollectionTypes() {
- svc := autoscaling.New(nil)
-
- var params *autoscaling.DescribeMetricCollectionTypesInput
- resp, err := svc.DescribeMetricCollectionTypes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeNotificationConfigurations() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeNotificationConfigurationsInput{
- AutoScalingGroupNames: []*string{
- aws.String("ResourceName"), // Required
- // More values...
- },
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- }
- resp, err := svc.DescribeNotificationConfigurations(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribePolicies() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribePoliciesInput{
- AutoScalingGroupName: aws.String("ResourceName"),
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- PolicyNames: []*string{
- aws.String("ResourceName"), // Required
- // More values...
- },
- PolicyTypes: []*string{
- aws.String("XmlStringMaxLen64"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribePolicies(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeScalingActivities() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeScalingActivitiesInput{
- ActivityIds: []*string{
- aws.String("XmlString"), // Required
- // More values...
- },
- AutoScalingGroupName: aws.String("ResourceName"),
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- }
- resp, err := svc.DescribeScalingActivities(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeScalingProcessTypes() {
- svc := autoscaling.New(nil)
-
- var params *autoscaling.DescribeScalingProcessTypesInput
- resp, err := svc.DescribeScalingProcessTypes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeScheduledActions() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeScheduledActionsInput{
- AutoScalingGroupName: aws.String("ResourceName"),
- EndTime: aws.Time(time.Now()),
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- ScheduledActionNames: []*string{
- aws.String("ResourceName"), // Required
- // More values...
- },
- StartTime: aws.Time(time.Now()),
- }
- resp, err := svc.DescribeScheduledActions(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeTags() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DescribeTagsInput{
- Filters: []*autoscaling.Filter{
- { // Required
- Name: aws.String("XmlString"),
- Values: []*string{
- aws.String("XmlString"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxRecords: aws.Int64(1),
- NextToken: aws.String("XmlString"),
- }
- resp, err := svc.DescribeTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DescribeTerminationPolicyTypes() {
- svc := autoscaling.New(nil)
-
- var params *autoscaling.DescribeTerminationPolicyTypesInput
- resp, err := svc.DescribeTerminationPolicyTypes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DetachInstances() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DetachInstancesInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
- InstanceIds: []*string{
- aws.String("XmlStringMaxLen16"), // Required
- // More values...
- },
- }
- resp, err := svc.DetachInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DetachLoadBalancers() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DetachLoadBalancersInput{
- AutoScalingGroupName: aws.String("ResourceName"),
- LoadBalancerNames: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- }
- resp, err := svc.DetachLoadBalancers(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_DisableMetricsCollection() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.DisableMetricsCollectionInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- Metrics: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- }
- resp, err := svc.DisableMetricsCollection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_EnableMetricsCollection() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.EnableMetricsCollectionInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- Granularity: aws.String("XmlStringMaxLen255"), // Required
- Metrics: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- }
- resp, err := svc.EnableMetricsCollection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_EnterStandby() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.EnterStandbyInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
- InstanceIds: []*string{
- aws.String("XmlStringMaxLen16"), // Required
- // More values...
- },
- }
- resp, err := svc.EnterStandby(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_ExecutePolicy() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.ExecutePolicyInput{
- PolicyName: aws.String("ResourceName"), // Required
- AutoScalingGroupName: aws.String("ResourceName"),
- BreachThreshold: aws.Float64(1.0),
- HonorCooldown: aws.Bool(true),
- MetricValue: aws.Float64(1.0),
- }
- resp, err := svc.ExecutePolicy(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_ExitStandby() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.ExitStandbyInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- InstanceIds: []*string{
- aws.String("XmlStringMaxLen16"), // Required
- // More values...
- },
- }
- resp, err := svc.ExitStandby(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_PutLifecycleHook() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.PutLifecycleHookInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
- DefaultResult: aws.String("LifecycleActionResult"),
- HeartbeatTimeout: aws.Int64(1),
- LifecycleTransition: aws.String("LifecycleTransition"),
- NotificationMetadata: aws.String("XmlStringMaxLen1023"),
- NotificationTargetARN: aws.String("ResourceName"),
- RoleARN: aws.String("ResourceName"),
- }
- resp, err := svc.PutLifecycleHook(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_PutNotificationConfiguration() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.PutNotificationConfigurationInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- NotificationTypes: []*string{ // Required
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- TopicARN: aws.String("ResourceName"), // Required
- }
- resp, err := svc.PutNotificationConfiguration(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_PutScalingPolicy() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.PutScalingPolicyInput{
- AdjustmentType: aws.String("XmlStringMaxLen255"), // Required
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- PolicyName: aws.String("XmlStringMaxLen255"), // Required
- Cooldown: aws.Int64(1),
- EstimatedInstanceWarmup: aws.Int64(1),
- MetricAggregationType: aws.String("XmlStringMaxLen32"),
- MinAdjustmentMagnitude: aws.Int64(1),
- MinAdjustmentStep: aws.Int64(1),
- PolicyType: aws.String("XmlStringMaxLen64"),
- ScalingAdjustment: aws.Int64(1),
- StepAdjustments: []*autoscaling.StepAdjustment{
- { // Required
- ScalingAdjustment: aws.Int64(1), // Required
- MetricIntervalLowerBound: aws.Float64(1.0),
- MetricIntervalUpperBound: aws.Float64(1.0),
- },
- // More values...
- },
- }
- resp, err := svc.PutScalingPolicy(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_PutScheduledUpdateGroupAction() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.PutScheduledUpdateGroupActionInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- ScheduledActionName: aws.String("XmlStringMaxLen255"), // Required
- DesiredCapacity: aws.Int64(1),
- EndTime: aws.Time(time.Now()),
- MaxSize: aws.Int64(1),
- MinSize: aws.Int64(1),
- Recurrence: aws.String("XmlStringMaxLen255"),
- StartTime: aws.Time(time.Now()),
- Time: aws.Time(time.Now()),
- }
- resp, err := svc.PutScheduledUpdateGroupAction(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_RecordLifecycleActionHeartbeat() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.RecordLifecycleActionHeartbeatInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- LifecycleActionToken: aws.String("LifecycleActionToken"), // Required
- LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
- }
- resp, err := svc.RecordLifecycleActionHeartbeat(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_ResumeProcesses() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.ScalingProcessQuery{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- ScalingProcesses: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- }
- resp, err := svc.ResumeProcesses(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_SetDesiredCapacity() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.SetDesiredCapacityInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- DesiredCapacity: aws.Int64(1), // Required
- HonorCooldown: aws.Bool(true),
- }
- resp, err := svc.SetDesiredCapacity(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_SetInstanceHealth() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.SetInstanceHealthInput{
- HealthStatus: aws.String("XmlStringMaxLen32"), // Required
- InstanceId: aws.String("XmlStringMaxLen16"), // Required
- ShouldRespectGracePeriod: aws.Bool(true),
- }
- resp, err := svc.SetInstanceHealth(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_SuspendProcesses() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.ScalingProcessQuery{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- ScalingProcesses: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- }
- resp, err := svc.SuspendProcesses(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{
- InstanceId: aws.String("XmlStringMaxLen16"), // Required
- ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
- }
- resp, err := svc.TerminateInstanceInAutoScalingGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleAutoScaling_UpdateAutoScalingGroup() {
- svc := autoscaling.New(nil)
-
- params := &autoscaling.UpdateAutoScalingGroupInput{
- AutoScalingGroupName: aws.String("ResourceName"), // Required
- AvailabilityZones: []*string{
- aws.String("XmlStringMaxLen255"), // Required
- // More values...
- },
- DefaultCooldown: aws.Int64(1),
- DesiredCapacity: aws.Int64(1),
- HealthCheckGracePeriod: aws.Int64(1),
- HealthCheckType: aws.String("XmlStringMaxLen32"),
- LaunchConfigurationName: aws.String("ResourceName"),
- MaxSize: aws.Int64(1),
- MinSize: aws.Int64(1),
- PlacementGroup: aws.String("XmlStringMaxLen255"),
- TerminationPolicies: []*string{
- aws.String("XmlStringMaxLen1600"), // Required
- // More values...
- },
- VPCZoneIdentifier: aws.String("XmlStringMaxLen255"),
- }
- resp, err := svc.UpdateAutoScalingGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go
deleted file mode 100644
index 38617b1ffee..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package ec2_test
-
-import (
- "io/ioutil"
- "net/url"
- "testing"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/internal/test/unit"
- "github.com/aws/aws-sdk-go/service/ec2"
- "github.com/stretchr/testify/assert"
-)
-
-var _ = unit.Imported
-
-func TestCopySnapshotPresignedURL(t *testing.T) {
- svc := ec2.New(&aws.Config{Region: aws.String("us-west-2")})
-
- assert.NotPanics(t, func() {
- // Doesn't panic on nil input
- req, _ := svc.CopySnapshotRequest(nil)
- req.Sign()
- })
-
- req, _ := svc.CopySnapshotRequest(&ec2.CopySnapshotInput{
- SourceRegion: aws.String("us-west-1"),
- SourceSnapshotId: aws.String("snap-id"),
- })
- req.Sign()
-
- b, _ := ioutil.ReadAll(req.HTTPRequest.Body)
- q, _ := url.ParseQuery(string(b))
- url, _ := url.QueryUnescape(q.Get("PresignedUrl"))
- assert.Equal(t, "us-west-2", q.Get("DestinationRegion"))
- assert.Regexp(t, `^https://ec2\.us-west-1\.amazon.+&DestinationRegion=us-west-2`, url)
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go
deleted file mode 100644
index 3941d260db0..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
-
-package ec2iface_test
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/service/ec2"
- "github.com/aws/aws-sdk-go/service/ec2/ec2iface"
- "github.com/stretchr/testify/assert"
-)
-
-func TestInterface(t *testing.T) {
- assert.Implements(t, (*ec2iface.EC2API)(nil), ec2.New(nil))
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go
deleted file mode 100644
index 6da3b190cc2..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go
+++ /dev/null
@@ -1,5164 +0,0 @@
-// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
-
-package ec2_test
-
-import (
- "bytes"
- "fmt"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/ec2"
-)
-
-var _ time.Duration
-var _ bytes.Buffer
-
-func ExampleEC2_AcceptVpcPeeringConnection() {
- svc := ec2.New(nil)
-
- params := &ec2.AcceptVpcPeeringConnectionInput{
- DryRun: aws.Bool(true),
- VpcPeeringConnectionId: aws.String("String"),
- }
- resp, err := svc.AcceptVpcPeeringConnection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AllocateAddress() {
- svc := ec2.New(nil)
-
- params := &ec2.AllocateAddressInput{
- Domain: aws.String("DomainType"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AllocateAddress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AssignPrivateIpAddresses() {
- svc := ec2.New(nil)
-
- params := &ec2.AssignPrivateIpAddressesInput{
- NetworkInterfaceId: aws.String("String"), // Required
- AllowReassignment: aws.Bool(true),
- PrivateIpAddresses: []*string{
- aws.String("String"), // Required
- // More values...
- },
- SecondaryPrivateIpAddressCount: aws.Int64(1),
- }
- resp, err := svc.AssignPrivateIpAddresses(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AssociateAddress() {
- svc := ec2.New(nil)
-
- params := &ec2.AssociateAddressInput{
- AllocationId: aws.String("String"),
- AllowReassociation: aws.Bool(true),
- DryRun: aws.Bool(true),
- InstanceId: aws.String("String"),
- NetworkInterfaceId: aws.String("String"),
- PrivateIpAddress: aws.String("String"),
- PublicIp: aws.String("String"),
- }
- resp, err := svc.AssociateAddress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AssociateDhcpOptions() {
- svc := ec2.New(nil)
-
- params := &ec2.AssociateDhcpOptionsInput{
- DhcpOptionsId: aws.String("String"), // Required
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AssociateDhcpOptions(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AssociateRouteTable() {
- svc := ec2.New(nil)
-
- params := &ec2.AssociateRouteTableInput{
- RouteTableId: aws.String("String"), // Required
- SubnetId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AssociateRouteTable(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AttachClassicLinkVpc() {
- svc := ec2.New(nil)
-
- params := &ec2.AttachClassicLinkVpcInput{
- Groups: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- InstanceId: aws.String("String"), // Required
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AttachClassicLinkVpc(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AttachInternetGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.AttachInternetGatewayInput{
- InternetGatewayId: aws.String("String"), // Required
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AttachInternetGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AttachNetworkInterface() {
- svc := ec2.New(nil)
-
- params := &ec2.AttachNetworkInterfaceInput{
- DeviceIndex: aws.Int64(1), // Required
- InstanceId: aws.String("String"), // Required
- NetworkInterfaceId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AttachNetworkInterface(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AttachVolume() {
- svc := ec2.New(nil)
-
- params := &ec2.AttachVolumeInput{
- Device: aws.String("String"), // Required
- InstanceId: aws.String("String"), // Required
- VolumeId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AttachVolume(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AttachVpnGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.AttachVpnGatewayInput{
- VpcId: aws.String("String"), // Required
- VpnGatewayId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.AttachVpnGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AuthorizeSecurityGroupEgress() {
- svc := ec2.New(nil)
-
- params := &ec2.AuthorizeSecurityGroupEgressInput{
- GroupId: aws.String("String"), // Required
- CidrIp: aws.String("String"),
- DryRun: aws.Bool(true),
- FromPort: aws.Int64(1),
- IpPermissions: []*ec2.IpPermission{
- { // Required
- FromPort: aws.Int64(1),
- IpProtocol: aws.String("String"),
- IpRanges: []*ec2.IpRange{
- { // Required
- CidrIp: aws.String("String"),
- },
- // More values...
- },
- PrefixListIds: []*ec2.PrefixListId{
- { // Required
- PrefixListId: aws.String("String"),
- },
- // More values...
- },
- ToPort: aws.Int64(1),
- UserIdGroupPairs: []*ec2.UserIdGroupPair{
- { // Required
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- },
- // More values...
- },
- IpProtocol: aws.String("String"),
- SourceSecurityGroupName: aws.String("String"),
- SourceSecurityGroupOwnerId: aws.String("String"),
- ToPort: aws.Int64(1),
- }
- resp, err := svc.AuthorizeSecurityGroupEgress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_AuthorizeSecurityGroupIngress() {
- svc := ec2.New(nil)
-
- params := &ec2.AuthorizeSecurityGroupIngressInput{
- CidrIp: aws.String("String"),
- DryRun: aws.Bool(true),
- FromPort: aws.Int64(1),
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- IpPermissions: []*ec2.IpPermission{
- { // Required
- FromPort: aws.Int64(1),
- IpProtocol: aws.String("String"),
- IpRanges: []*ec2.IpRange{
- { // Required
- CidrIp: aws.String("String"),
- },
- // More values...
- },
- PrefixListIds: []*ec2.PrefixListId{
- { // Required
- PrefixListId: aws.String("String"),
- },
- // More values...
- },
- ToPort: aws.Int64(1),
- UserIdGroupPairs: []*ec2.UserIdGroupPair{
- { // Required
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- },
- // More values...
- },
- IpProtocol: aws.String("String"),
- SourceSecurityGroupName: aws.String("String"),
- SourceSecurityGroupOwnerId: aws.String("String"),
- ToPort: aws.Int64(1),
- }
- resp, err := svc.AuthorizeSecurityGroupIngress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_BundleInstance() {
- svc := ec2.New(nil)
-
- params := &ec2.BundleInstanceInput{
- InstanceId: aws.String("String"), // Required
- Storage: &ec2.Storage{ // Required
- S3: &ec2.S3Storage{
- AWSAccessKeyId: aws.String("String"),
- Bucket: aws.String("String"),
- Prefix: aws.String("String"),
- UploadPolicy: []byte("PAYLOAD"),
- UploadPolicySignature: aws.String("String"),
- },
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.BundleInstance(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CancelBundleTask() {
- svc := ec2.New(nil)
-
- params := &ec2.CancelBundleTaskInput{
- BundleId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CancelBundleTask(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CancelConversionTask() {
- svc := ec2.New(nil)
-
- params := &ec2.CancelConversionTaskInput{
- ConversionTaskId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- ReasonMessage: aws.String("String"),
- }
- resp, err := svc.CancelConversionTask(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CancelExportTask() {
- svc := ec2.New(nil)
-
- params := &ec2.CancelExportTaskInput{
- ExportTaskId: aws.String("String"), // Required
- }
- resp, err := svc.CancelExportTask(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CancelImportTask() {
- svc := ec2.New(nil)
-
- params := &ec2.CancelImportTaskInput{
- CancelReason: aws.String("String"),
- DryRun: aws.Bool(true),
- ImportTaskId: aws.String("String"),
- }
- resp, err := svc.CancelImportTask(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CancelReservedInstancesListing() {
- svc := ec2.New(nil)
-
- params := &ec2.CancelReservedInstancesListingInput{
- ReservedInstancesListingId: aws.String("String"), // Required
- }
- resp, err := svc.CancelReservedInstancesListing(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CancelSpotFleetRequests() {
- svc := ec2.New(nil)
-
- params := &ec2.CancelSpotFleetRequestsInput{
- SpotFleetRequestIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- TerminateInstances: aws.Bool(true), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CancelSpotFleetRequests(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CancelSpotInstanceRequests() {
- svc := ec2.New(nil)
-
- params := &ec2.CancelSpotInstanceRequestsInput{
- SpotInstanceRequestIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CancelSpotInstanceRequests(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ConfirmProductInstance() {
- svc := ec2.New(nil)
-
- params := &ec2.ConfirmProductInstanceInput{
- InstanceId: aws.String("String"), // Required
- ProductCode: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ConfirmProductInstance(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CopyImage() {
- svc := ec2.New(nil)
-
- params := &ec2.CopyImageInput{
- Name: aws.String("String"), // Required
- SourceImageId: aws.String("String"), // Required
- SourceRegion: aws.String("String"), // Required
- ClientToken: aws.String("String"),
- Description: aws.String("String"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CopyImage(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CopySnapshot() {
- svc := ec2.New(nil)
-
- params := &ec2.CopySnapshotInput{
- SourceRegion: aws.String("String"), // Required
- SourceSnapshotId: aws.String("String"), // Required
- Description: aws.String("String"),
- DestinationRegion: aws.String("String"),
- DryRun: aws.Bool(true),
- Encrypted: aws.Bool(true),
- KmsKeyId: aws.String("String"),
- PresignedUrl: aws.String("String"),
- }
- resp, err := svc.CopySnapshot(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateCustomerGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateCustomerGatewayInput{
- BgpAsn: aws.Int64(1), // Required
- PublicIp: aws.String("String"), // Required
- Type: aws.String("GatewayType"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateCustomerGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateDhcpOptions() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateDhcpOptionsInput{
- DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required
- { // Required
- Key: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateDhcpOptions(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateFlowLogs() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateFlowLogsInput{
- DeliverLogsPermissionArn: aws.String("String"), // Required
- LogGroupName: aws.String("String"), // Required
- ResourceIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- ResourceType: aws.String("FlowLogsResourceType"), // Required
- TrafficType: aws.String("TrafficType"), // Required
- ClientToken: aws.String("String"),
- }
- resp, err := svc.CreateFlowLogs(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateImage() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateImageInput{
- InstanceId: aws.String("String"), // Required
- Name: aws.String("String"), // Required
- BlockDeviceMappings: []*ec2.BlockDeviceMapping{
- { // Required
- DeviceName: aws.String("String"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: aws.Bool(true),
- Iops: aws.Int64(1),
- SnapshotId: aws.String("String"),
- VolumeSize: aws.Int64(1),
- VolumeType: aws.String("VolumeType"),
- },
- NoDevice: aws.String("String"),
- VirtualName: aws.String("String"),
- },
- // More values...
- },
- Description: aws.String("String"),
- DryRun: aws.Bool(true),
- NoReboot: aws.Bool(true),
- }
- resp, err := svc.CreateImage(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateInstanceExportTask() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateInstanceExportTaskInput{
- InstanceId: aws.String("String"), // Required
- Description: aws.String("String"),
- ExportToS3Task: &ec2.ExportToS3TaskSpecification{
- ContainerFormat: aws.String("ContainerFormat"),
- DiskImageFormat: aws.String("DiskImageFormat"),
- S3Bucket: aws.String("String"),
- S3Prefix: aws.String("String"),
- },
- TargetEnvironment: aws.String("ExportEnvironment"),
- }
- resp, err := svc.CreateInstanceExportTask(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateInternetGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateInternetGatewayInput{
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateInternetGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateKeyPair() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateKeyPairInput{
- KeyName: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateKeyPair(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateNetworkAcl() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateNetworkAclInput{
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateNetworkAcl(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateNetworkAclEntry() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateNetworkAclEntryInput{
- CidrBlock: aws.String("String"), // Required
- Egress: aws.Bool(true), // Required
- NetworkAclId: aws.String("String"), // Required
- Protocol: aws.String("String"), // Required
- RuleAction: aws.String("RuleAction"), // Required
- RuleNumber: aws.Int64(1), // Required
- DryRun: aws.Bool(true),
- IcmpTypeCode: &ec2.IcmpTypeCode{
- Code: aws.Int64(1),
- Type: aws.Int64(1),
- },
- PortRange: &ec2.PortRange{
- From: aws.Int64(1),
- To: aws.Int64(1),
- },
- }
- resp, err := svc.CreateNetworkAclEntry(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateNetworkInterface() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateNetworkInterfaceInput{
- SubnetId: aws.String("String"), // Required
- Description: aws.String("String"),
- DryRun: aws.Bool(true),
- Groups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- PrivateIpAddress: aws.String("String"),
- PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
- { // Required
- PrivateIpAddress: aws.String("String"), // Required
- Primary: aws.Bool(true),
- },
- // More values...
- },
- SecondaryPrivateIpAddressCount: aws.Int64(1),
- }
- resp, err := svc.CreateNetworkInterface(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreatePlacementGroup() {
- svc := ec2.New(nil)
-
- params := &ec2.CreatePlacementGroupInput{
- GroupName: aws.String("String"), // Required
- Strategy: aws.String("PlacementStrategy"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreatePlacementGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateReservedInstancesListing() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateReservedInstancesListingInput{
- ClientToken: aws.String("String"), // Required
- InstanceCount: aws.Int64(1), // Required
- PriceSchedules: []*ec2.PriceScheduleSpecification{ // Required
- { // Required
- CurrencyCode: aws.String("CurrencyCodeValues"),
- Price: aws.Float64(1.0),
- Term: aws.Int64(1),
- },
- // More values...
- },
- ReservedInstancesId: aws.String("String"), // Required
- }
- resp, err := svc.CreateReservedInstancesListing(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateRoute() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateRouteInput{
- DestinationCidrBlock: aws.String("String"), // Required
- RouteTableId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- GatewayId: aws.String("String"),
- InstanceId: aws.String("String"),
- NetworkInterfaceId: aws.String("String"),
- VpcPeeringConnectionId: aws.String("String"),
- }
- resp, err := svc.CreateRoute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateRouteTable() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateRouteTableInput{
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateRouteTable(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateSecurityGroup() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateSecurityGroupInput{
- Description: aws.String("String"), // Required
- GroupName: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- VpcId: aws.String("String"),
- }
- resp, err := svc.CreateSecurityGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateSnapshot() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateSnapshotInput{
- VolumeId: aws.String("String"), // Required
- Description: aws.String("String"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateSnapshot(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateSpotDatafeedSubscription() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateSpotDatafeedSubscriptionInput{
- Bucket: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- Prefix: aws.String("String"),
- }
- resp, err := svc.CreateSpotDatafeedSubscription(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateSubnet() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateSubnetInput{
- CidrBlock: aws.String("String"), // Required
- VpcId: aws.String("String"), // Required
- AvailabilityZone: aws.String("String"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateSubnet(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateTags() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateTagsInput{
- Resources: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- Tags: []*ec2.Tag{ // Required
- { // Required
- Key: aws.String("String"),
- Value: aws.String("String"),
- },
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateVolume() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateVolumeInput{
- AvailabilityZone: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- Encrypted: aws.Bool(true),
- Iops: aws.Int64(1),
- KmsKeyId: aws.String("String"),
- Size: aws.Int64(1),
- SnapshotId: aws.String("String"),
- VolumeType: aws.String("VolumeType"),
- }
- resp, err := svc.CreateVolume(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateVpc() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateVpcInput{
- CidrBlock: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- InstanceTenancy: aws.String("Tenancy"),
- }
- resp, err := svc.CreateVpc(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateVpcEndpoint() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateVpcEndpointInput{
- ServiceName: aws.String("String"), // Required
- VpcId: aws.String("String"), // Required
- ClientToken: aws.String("String"),
- DryRun: aws.Bool(true),
- PolicyDocument: aws.String("String"),
- RouteTableIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.CreateVpcEndpoint(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateVpcPeeringConnection() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateVpcPeeringConnectionInput{
- DryRun: aws.Bool(true),
- PeerOwnerId: aws.String("String"),
- PeerVpcId: aws.String("String"),
- VpcId: aws.String("String"),
- }
- resp, err := svc.CreateVpcPeeringConnection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateVpnConnection() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateVpnConnectionInput{
- CustomerGatewayId: aws.String("String"), // Required
- Type: aws.String("String"), // Required
- VpnGatewayId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- Options: &ec2.VpnConnectionOptionsSpecification{
- StaticRoutesOnly: aws.Bool(true),
- },
- }
- resp, err := svc.CreateVpnConnection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateVpnConnectionRoute() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateVpnConnectionRouteInput{
- DestinationCidrBlock: aws.String("String"), // Required
- VpnConnectionId: aws.String("String"), // Required
- }
- resp, err := svc.CreateVpnConnectionRoute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_CreateVpnGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.CreateVpnGatewayInput{
- Type: aws.String("GatewayType"), // Required
- AvailabilityZone: aws.String("String"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.CreateVpnGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteCustomerGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteCustomerGatewayInput{
- CustomerGatewayId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteCustomerGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteDhcpOptions() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteDhcpOptionsInput{
- DhcpOptionsId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteDhcpOptions(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteFlowLogs() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteFlowLogsInput{
- FlowLogIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DeleteFlowLogs(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteInternetGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteInternetGatewayInput{
- InternetGatewayId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteInternetGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteKeyPair() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteKeyPairInput{
- KeyName: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteKeyPair(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteNetworkAcl() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteNetworkAclInput{
- NetworkAclId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteNetworkAcl(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteNetworkAclEntry() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteNetworkAclEntryInput{
- Egress: aws.Bool(true), // Required
- NetworkAclId: aws.String("String"), // Required
- RuleNumber: aws.Int64(1), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteNetworkAclEntry(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteNetworkInterface() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteNetworkInterfaceInput{
- NetworkInterfaceId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteNetworkInterface(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeletePlacementGroup() {
- svc := ec2.New(nil)
-
- params := &ec2.DeletePlacementGroupInput{
- GroupName: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeletePlacementGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteRoute() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteRouteInput{
- DestinationCidrBlock: aws.String("String"), // Required
- RouteTableId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteRoute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteRouteTable() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteRouteTableInput{
- RouteTableId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteRouteTable(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteSecurityGroup() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteSecurityGroupInput{
- DryRun: aws.Bool(true),
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- }
- resp, err := svc.DeleteSecurityGroup(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteSnapshot() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteSnapshotInput{
- SnapshotId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteSnapshot(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteSpotDatafeedSubscription() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteSpotDatafeedSubscriptionInput{
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteSpotDatafeedSubscription(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteSubnet() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteSubnetInput{
- SubnetId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteSubnet(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteTags() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteTagsInput{
- Resources: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- Tags: []*ec2.Tag{
- { // Required
- Key: aws.String("String"),
- Value: aws.String("String"),
- },
- // More values...
- },
- }
- resp, err := svc.DeleteTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteVolume() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteVolumeInput{
- VolumeId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteVolume(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteVpc() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteVpcInput{
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteVpc(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteVpcEndpoints() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteVpcEndpointsInput{
- VpcEndpointIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteVpcEndpoints(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteVpcPeeringConnection() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteVpcPeeringConnectionInput{
- VpcPeeringConnectionId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteVpcPeeringConnection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteVpnConnection() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteVpnConnectionInput{
- VpnConnectionId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteVpnConnection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteVpnConnectionRoute() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteVpnConnectionRouteInput{
- DestinationCidrBlock: aws.String("String"), // Required
- VpnConnectionId: aws.String("String"), // Required
- }
- resp, err := svc.DeleteVpnConnectionRoute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeleteVpnGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.DeleteVpnGatewayInput{
- VpnGatewayId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeleteVpnGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DeregisterImage() {
- svc := ec2.New(nil)
-
- params := &ec2.DeregisterImageInput{
- ImageId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DeregisterImage(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeAccountAttributes() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeAccountAttributesInput{
- AttributeNames: []*string{
- aws.String("AccountAttributeName"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeAccountAttributes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeAddresses() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeAddressesInput{
- AllocationIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- PublicIps: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeAddresses(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeAvailabilityZones() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeAvailabilityZonesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- ZoneNames: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeAvailabilityZones(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeBundleTasks() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeBundleTasksInput{
- BundleIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- }
- resp, err := svc.DescribeBundleTasks(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeClassicLinkInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeClassicLinkInstancesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- InstanceIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeClassicLinkInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeConversionTasks() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeConversionTasksInput{
- ConversionTaskIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- }
- resp, err := svc.DescribeConversionTasks(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeCustomerGateways() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeCustomerGatewaysInput{
- CustomerGatewayIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- }
- resp, err := svc.DescribeCustomerGateways(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeDhcpOptions() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeDhcpOptionsInput{
- DhcpOptionsIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- }
- resp, err := svc.DescribeDhcpOptions(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeExportTasks() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeExportTasksInput{
- ExportTaskIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeExportTasks(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeFlowLogs() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeFlowLogsInput{
- Filter: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- FlowLogIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeFlowLogs(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeImageAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeImageAttributeInput{
- Attribute: aws.String("ImageAttributeName"), // Required
- ImageId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeImageAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeImages() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeImagesInput{
- DryRun: aws.Bool(true),
- ExecutableUsers: []*string{
- aws.String("String"), // Required
- // More values...
- },
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- ImageIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- Owners: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeImages(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeImportImageTasks() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeImportImageTasksInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- ImportTaskIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeImportImageTasks(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeImportSnapshotTasks() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeImportSnapshotTasksInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- ImportTaskIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeImportSnapshotTasks(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeInstanceAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeInstanceAttributeInput{
- Attribute: aws.String("InstanceAttributeName"), // Required
- InstanceId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeInstanceAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeInstanceStatus() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeInstanceStatusInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- IncludeAllInstances: aws.Bool(true),
- InstanceIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeInstanceStatus(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeInstancesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- InstanceIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeInternetGateways() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeInternetGatewaysInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- InternetGatewayIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeInternetGateways(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeKeyPairs() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeKeyPairsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- KeyNames: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeKeyPairs(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeMovingAddresses() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeMovingAddressesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- PublicIps: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeMovingAddresses(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeNetworkAcls() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeNetworkAclsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- NetworkAclIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeNetworkAcls(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeNetworkInterfaceAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeNetworkInterfaceAttributeInput{
- NetworkInterfaceId: aws.String("String"), // Required
- Attribute: aws.String("NetworkInterfaceAttribute"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeNetworkInterfaceAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeNetworkInterfaces() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeNetworkInterfacesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- NetworkInterfaceIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeNetworkInterfaces(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribePlacementGroups() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribePlacementGroupsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- GroupNames: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribePlacementGroups(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribePrefixLists() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribePrefixListsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- PrefixListIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribePrefixLists(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeRegions() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeRegionsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- RegionNames: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeRegions(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeReservedInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeReservedInstancesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- OfferingType: aws.String("OfferingTypeValues"),
- ReservedInstancesIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeReservedInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeReservedInstancesListings() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeReservedInstancesListingsInput{
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- ReservedInstancesId: aws.String("String"),
- ReservedInstancesListingId: aws.String("String"),
- }
- resp, err := svc.DescribeReservedInstancesListings(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeReservedInstancesModifications() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeReservedInstancesModificationsInput{
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- NextToken: aws.String("String"),
- ReservedInstancesModificationIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeReservedInstancesModifications(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeReservedInstancesOfferings() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeReservedInstancesOfferingsInput{
- AvailabilityZone: aws.String("String"),
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- IncludeMarketplace: aws.Bool(true),
- InstanceTenancy: aws.String("Tenancy"),
- InstanceType: aws.String("InstanceType"),
- MaxDuration: aws.Int64(1),
- MaxInstanceCount: aws.Int64(1),
- MaxResults: aws.Int64(1),
- MinDuration: aws.Int64(1),
- NextToken: aws.String("String"),
- OfferingType: aws.String("OfferingTypeValues"),
- ProductDescription: aws.String("RIProductDescription"),
- ReservedInstancesOfferingIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeReservedInstancesOfferings(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeRouteTables() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeRouteTablesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- RouteTableIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeRouteTables(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSecurityGroups() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSecurityGroupsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- GroupIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- GroupNames: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeSecurityGroups(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSnapshotAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSnapshotAttributeInput{
- Attribute: aws.String("SnapshotAttributeName"), // Required
- SnapshotId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeSnapshotAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSnapshots() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSnapshotsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- OwnerIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- RestorableByUserIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- SnapshotIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeSnapshots(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSpotDatafeedSubscription() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSpotDatafeedSubscriptionInput{
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeSpotDatafeedSubscription(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSpotFleetInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSpotFleetInstancesInput{
- SpotFleetRequestId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeSpotFleetInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSpotFleetRequestHistory() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSpotFleetRequestHistoryInput{
- SpotFleetRequestId: aws.String("String"), // Required
- StartTime: aws.Time(time.Now()), // Required
- DryRun: aws.Bool(true),
- EventType: aws.String("EventType"),
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeSpotFleetRequestHistory(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSpotFleetRequests() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSpotFleetRequestsInput{
- DryRun: aws.Bool(true),
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- SpotFleetRequestIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeSpotFleetRequests(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSpotInstanceRequests() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSpotInstanceRequestsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- SpotInstanceRequestIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeSpotInstanceRequests(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSpotPriceHistory() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSpotPriceHistoryInput{
- AvailabilityZone: aws.String("String"),
- DryRun: aws.Bool(true),
- EndTime: aws.Time(time.Now()),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- InstanceTypes: []*string{
- aws.String("InstanceType"), // Required
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- ProductDescriptions: []*string{
- aws.String("String"), // Required
- // More values...
- },
- StartTime: aws.Time(time.Now()),
- }
- resp, err := svc.DescribeSpotPriceHistory(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeSubnets() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeSubnetsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- SubnetIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeSubnets(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeTags() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeTagsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVolumeAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVolumeAttributeInput{
- VolumeId: aws.String("String"), // Required
- Attribute: aws.String("VolumeAttributeName"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeVolumeAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVolumeStatus() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVolumeStatusInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- VolumeIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVolumeStatus(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVolumes() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVolumesInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- VolumeIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVolumes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpcAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpcAttributeInput{
- VpcId: aws.String("String"), // Required
- Attribute: aws.String("VpcAttributeName"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DescribeVpcAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpcClassicLink() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpcClassicLinkInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- VpcIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVpcClassicLink(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpcEndpointServices() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpcEndpointServicesInput{
- DryRun: aws.Bool(true),
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- }
- resp, err := svc.DescribeVpcEndpointServices(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpcEndpoints() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpcEndpointsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("String"),
- VpcEndpointIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVpcEndpoints(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpcPeeringConnections() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpcPeeringConnectionsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- VpcPeeringConnectionIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVpcPeeringConnections(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpcs() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpcsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- VpcIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVpcs(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpnConnections() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpnConnectionsInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- VpnConnectionIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVpnConnections(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DescribeVpnGateways() {
- svc := ec2.New(nil)
-
- params := &ec2.DescribeVpnGatewaysInput{
- DryRun: aws.Bool(true),
- Filters: []*ec2.Filter{
- { // Required
- Name: aws.String("String"),
- Values: []*string{
- aws.String("String"), // Required
- // More values...
- },
- },
- // More values...
- },
- VpnGatewayIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeVpnGateways(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DetachClassicLinkVpc() {
- svc := ec2.New(nil)
-
- params := &ec2.DetachClassicLinkVpcInput{
- InstanceId: aws.String("String"), // Required
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DetachClassicLinkVpc(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DetachInternetGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.DetachInternetGatewayInput{
- InternetGatewayId: aws.String("String"), // Required
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DetachInternetGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DetachNetworkInterface() {
- svc := ec2.New(nil)
-
- params := &ec2.DetachNetworkInterfaceInput{
- AttachmentId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- Force: aws.Bool(true),
- }
- resp, err := svc.DetachNetworkInterface(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DetachVolume() {
- svc := ec2.New(nil)
-
- params := &ec2.DetachVolumeInput{
- VolumeId: aws.String("String"), // Required
- Device: aws.String("String"),
- DryRun: aws.Bool(true),
- Force: aws.Bool(true),
- InstanceId: aws.String("String"),
- }
- resp, err := svc.DetachVolume(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DetachVpnGateway() {
- svc := ec2.New(nil)
-
- params := &ec2.DetachVpnGatewayInput{
- VpcId: aws.String("String"), // Required
- VpnGatewayId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DetachVpnGateway(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DisableVgwRoutePropagation() {
- svc := ec2.New(nil)
-
- params := &ec2.DisableVgwRoutePropagationInput{
- GatewayId: aws.String("String"), // Required
- RouteTableId: aws.String("String"), // Required
- }
- resp, err := svc.DisableVgwRoutePropagation(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DisableVpcClassicLink() {
- svc := ec2.New(nil)
-
- params := &ec2.DisableVpcClassicLinkInput{
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DisableVpcClassicLink(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DisassociateAddress() {
- svc := ec2.New(nil)
-
- params := &ec2.DisassociateAddressInput{
- AssociationId: aws.String("String"),
- DryRun: aws.Bool(true),
- PublicIp: aws.String("String"),
- }
- resp, err := svc.DisassociateAddress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_DisassociateRouteTable() {
- svc := ec2.New(nil)
-
- params := &ec2.DisassociateRouteTableInput{
- AssociationId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.DisassociateRouteTable(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_EnableVgwRoutePropagation() {
- svc := ec2.New(nil)
-
- params := &ec2.EnableVgwRoutePropagationInput{
- GatewayId: aws.String("String"), // Required
- RouteTableId: aws.String("String"), // Required
- }
- resp, err := svc.EnableVgwRoutePropagation(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_EnableVolumeIO() {
- svc := ec2.New(nil)
-
- params := &ec2.EnableVolumeIOInput{
- VolumeId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.EnableVolumeIO(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_EnableVpcClassicLink() {
- svc := ec2.New(nil)
-
- params := &ec2.EnableVpcClassicLinkInput{
- VpcId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.EnableVpcClassicLink(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_GetConsoleOutput() {
- svc := ec2.New(nil)
-
- params := &ec2.GetConsoleOutputInput{
- InstanceId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.GetConsoleOutput(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_GetPasswordData() {
- svc := ec2.New(nil)
-
- params := &ec2.GetPasswordDataInput{
- InstanceId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.GetPasswordData(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ImportImage() {
- svc := ec2.New(nil)
-
- params := &ec2.ImportImageInput{
- Architecture: aws.String("String"),
- ClientData: &ec2.ClientData{
- Comment: aws.String("String"),
- UploadEnd: aws.Time(time.Now()),
- UploadSize: aws.Float64(1.0),
- UploadStart: aws.Time(time.Now()),
- },
- ClientToken: aws.String("String"),
- Description: aws.String("String"),
- DiskContainers: []*ec2.ImageDiskContainer{
- { // Required
- Description: aws.String("String"),
- DeviceName: aws.String("String"),
- Format: aws.String("String"),
- SnapshotId: aws.String("String"),
- Url: aws.String("String"),
- UserBucket: &ec2.UserBucket{
- S3Bucket: aws.String("String"),
- S3Key: aws.String("String"),
- },
- },
- // More values...
- },
- DryRun: aws.Bool(true),
- Hypervisor: aws.String("String"),
- LicenseType: aws.String("String"),
- Platform: aws.String("String"),
- RoleName: aws.String("String"),
- }
- resp, err := svc.ImportImage(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ImportInstance() {
- svc := ec2.New(nil)
-
- params := &ec2.ImportInstanceInput{
- Platform: aws.String("PlatformValues"), // Required
- Description: aws.String("String"),
- DiskImages: []*ec2.DiskImage{
- { // Required
- Description: aws.String("String"),
- Image: &ec2.DiskImageDetail{
- Bytes: aws.Int64(1), // Required
- Format: aws.String("DiskImageFormat"), // Required
- ImportManifestUrl: aws.String("String"), // Required
- },
- Volume: &ec2.VolumeDetail{
- Size: aws.Int64(1), // Required
- },
- },
- // More values...
- },
- DryRun: aws.Bool(true),
- LaunchSpecification: &ec2.ImportInstanceLaunchSpecification{
- AdditionalInfo: aws.String("String"),
- Architecture: aws.String("ArchitectureValues"),
- GroupIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- GroupNames: []*string{
- aws.String("String"), // Required
- // More values...
- },
- InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
- InstanceType: aws.String("InstanceType"),
- Monitoring: aws.Bool(true),
- Placement: &ec2.Placement{
- AvailabilityZone: aws.String("String"),
- GroupName: aws.String("String"),
- Tenancy: aws.String("Tenancy"),
- },
- PrivateIpAddress: aws.String("String"),
- SubnetId: aws.String("String"),
- UserData: &ec2.UserData{
- Data: aws.String("String"),
- },
- },
- }
- resp, err := svc.ImportInstance(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ImportKeyPair() {
- svc := ec2.New(nil)
-
- params := &ec2.ImportKeyPairInput{
- KeyName: aws.String("String"), // Required
- PublicKeyMaterial: []byte("PAYLOAD"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ImportKeyPair(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ImportSnapshot() {
- svc := ec2.New(nil)
-
- params := &ec2.ImportSnapshotInput{
- ClientData: &ec2.ClientData{
- Comment: aws.String("String"),
- UploadEnd: aws.Time(time.Now()),
- UploadSize: aws.Float64(1.0),
- UploadStart: aws.Time(time.Now()),
- },
- ClientToken: aws.String("String"),
- Description: aws.String("String"),
- DiskContainer: &ec2.SnapshotDiskContainer{
- Description: aws.String("String"),
- Format: aws.String("String"),
- Url: aws.String("String"),
- UserBucket: &ec2.UserBucket{
- S3Bucket: aws.String("String"),
- S3Key: aws.String("String"),
- },
- },
- DryRun: aws.Bool(true),
- RoleName: aws.String("String"),
- }
- resp, err := svc.ImportSnapshot(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ImportVolume() {
- svc := ec2.New(nil)
-
- params := &ec2.ImportVolumeInput{
- AvailabilityZone: aws.String("String"), // Required
- Image: &ec2.DiskImageDetail{ // Required
- Bytes: aws.Int64(1), // Required
- Format: aws.String("DiskImageFormat"), // Required
- ImportManifestUrl: aws.String("String"), // Required
- },
- Volume: &ec2.VolumeDetail{ // Required
- Size: aws.Int64(1), // Required
- },
- Description: aws.String("String"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ImportVolume(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifyImageAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifyImageAttributeInput{
- ImageId: aws.String("String"), // Required
- Attribute: aws.String("String"),
- Description: &ec2.AttributeValue{
- Value: aws.String("String"),
- },
- DryRun: aws.Bool(true),
- LaunchPermission: &ec2.LaunchPermissionModifications{
- Add: []*ec2.LaunchPermission{
- { // Required
- Group: aws.String("PermissionGroup"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- Remove: []*ec2.LaunchPermission{
- { // Required
- Group: aws.String("PermissionGroup"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- },
- OperationType: aws.String("OperationType"),
- ProductCodes: []*string{
- aws.String("String"), // Required
- // More values...
- },
- UserGroups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- UserIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- Value: aws.String("String"),
- }
- resp, err := svc.ModifyImageAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifyInstanceAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifyInstanceAttributeInput{
- InstanceId: aws.String("String"), // Required
- Attribute: aws.String("InstanceAttributeName"),
- BlockDeviceMappings: []*ec2.InstanceBlockDeviceMappingSpecification{
- { // Required
- DeviceName: aws.String("String"),
- Ebs: &ec2.EbsInstanceBlockDeviceSpecification{
- DeleteOnTermination: aws.Bool(true),
- VolumeId: aws.String("String"),
- },
- NoDevice: aws.String("String"),
- VirtualName: aws.String("String"),
- },
- // More values...
- },
- DisableApiTermination: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- DryRun: aws.Bool(true),
- EbsOptimized: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- Groups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- InstanceInitiatedShutdownBehavior: &ec2.AttributeValue{
- Value: aws.String("String"),
- },
- InstanceType: &ec2.AttributeValue{
- Value: aws.String("String"),
- },
- Kernel: &ec2.AttributeValue{
- Value: aws.String("String"),
- },
- Ramdisk: &ec2.AttributeValue{
- Value: aws.String("String"),
- },
- SourceDestCheck: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- SriovNetSupport: &ec2.AttributeValue{
- Value: aws.String("String"),
- },
- UserData: &ec2.BlobAttributeValue{
- Value: []byte("PAYLOAD"),
- },
- Value: aws.String("String"),
- }
- resp, err := svc.ModifyInstanceAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifyNetworkInterfaceAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifyNetworkInterfaceAttributeInput{
- NetworkInterfaceId: aws.String("String"), // Required
- Attachment: &ec2.NetworkInterfaceAttachmentChanges{
- AttachmentId: aws.String("String"),
- DeleteOnTermination: aws.Bool(true),
- },
- Description: &ec2.AttributeValue{
- Value: aws.String("String"),
- },
- DryRun: aws.Bool(true),
- Groups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- SourceDestCheck: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- }
- resp, err := svc.ModifyNetworkInterfaceAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifyReservedInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifyReservedInstancesInput{
- ReservedInstancesIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- TargetConfigurations: []*ec2.ReservedInstancesConfiguration{ // Required
- { // Required
- AvailabilityZone: aws.String("String"),
- InstanceCount: aws.Int64(1),
- InstanceType: aws.String("InstanceType"),
- Platform: aws.String("String"),
- },
- // More values...
- },
- ClientToken: aws.String("String"),
- }
- resp, err := svc.ModifyReservedInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifySnapshotAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifySnapshotAttributeInput{
- SnapshotId: aws.String("String"), // Required
- Attribute: aws.String("SnapshotAttributeName"),
- CreateVolumePermission: &ec2.CreateVolumePermissionModifications{
- Add: []*ec2.CreateVolumePermission{
- { // Required
- Group: aws.String("PermissionGroup"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- Remove: []*ec2.CreateVolumePermission{
- { // Required
- Group: aws.String("PermissionGroup"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- },
- DryRun: aws.Bool(true),
- GroupNames: []*string{
- aws.String("String"), // Required
- // More values...
- },
- OperationType: aws.String("OperationType"),
- UserIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.ModifySnapshotAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifySubnetAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifySubnetAttributeInput{
- SubnetId: aws.String("String"), // Required
- MapPublicIpOnLaunch: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- }
- resp, err := svc.ModifySubnetAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifyVolumeAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifyVolumeAttributeInput{
- VolumeId: aws.String("String"), // Required
- AutoEnableIO: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ModifyVolumeAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifyVpcAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifyVpcAttributeInput{
- VpcId: aws.String("String"), // Required
- EnableDnsHostnames: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- EnableDnsSupport: &ec2.AttributeBooleanValue{
- Value: aws.Bool(true),
- },
- }
- resp, err := svc.ModifyVpcAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ModifyVpcEndpoint() {
- svc := ec2.New(nil)
-
- params := &ec2.ModifyVpcEndpointInput{
- VpcEndpointId: aws.String("String"), // Required
- AddRouteTableIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- PolicyDocument: aws.String("String"),
- RemoveRouteTableIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- ResetPolicy: aws.Bool(true),
- }
- resp, err := svc.ModifyVpcEndpoint(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_MonitorInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.MonitorInstancesInput{
- InstanceIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.MonitorInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_MoveAddressToVpc() {
- svc := ec2.New(nil)
-
- params := &ec2.MoveAddressToVpcInput{
- PublicIp: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.MoveAddressToVpc(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_PurchaseReservedInstancesOffering() {
- svc := ec2.New(nil)
-
- params := &ec2.PurchaseReservedInstancesOfferingInput{
- InstanceCount: aws.Int64(1), // Required
- ReservedInstancesOfferingId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- LimitPrice: &ec2.ReservedInstanceLimitPrice{
- Amount: aws.Float64(1.0),
- CurrencyCode: aws.String("CurrencyCodeValues"),
- },
- }
- resp, err := svc.PurchaseReservedInstancesOffering(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RebootInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.RebootInstancesInput{
- InstanceIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.RebootInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RegisterImage() {
- svc := ec2.New(nil)
-
- params := &ec2.RegisterImageInput{
- Name: aws.String("String"), // Required
- Architecture: aws.String("ArchitectureValues"),
- BlockDeviceMappings: []*ec2.BlockDeviceMapping{
- { // Required
- DeviceName: aws.String("String"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: aws.Bool(true),
- Iops: aws.Int64(1),
- SnapshotId: aws.String("String"),
- VolumeSize: aws.Int64(1),
- VolumeType: aws.String("VolumeType"),
- },
- NoDevice: aws.String("String"),
- VirtualName: aws.String("String"),
- },
- // More values...
- },
- Description: aws.String("String"),
- DryRun: aws.Bool(true),
- ImageLocation: aws.String("String"),
- KernelId: aws.String("String"),
- RamdiskId: aws.String("String"),
- RootDeviceName: aws.String("String"),
- SriovNetSupport: aws.String("String"),
- VirtualizationType: aws.String("String"),
- }
- resp, err := svc.RegisterImage(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RejectVpcPeeringConnection() {
- svc := ec2.New(nil)
-
- params := &ec2.RejectVpcPeeringConnectionInput{
- VpcPeeringConnectionId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.RejectVpcPeeringConnection(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ReleaseAddress() {
- svc := ec2.New(nil)
-
- params := &ec2.ReleaseAddressInput{
- AllocationId: aws.String("String"),
- DryRun: aws.Bool(true),
- PublicIp: aws.String("String"),
- }
- resp, err := svc.ReleaseAddress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ReplaceNetworkAclAssociation() {
- svc := ec2.New(nil)
-
- params := &ec2.ReplaceNetworkAclAssociationInput{
- AssociationId: aws.String("String"), // Required
- NetworkAclId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ReplaceNetworkAclAssociation(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ReplaceNetworkAclEntry() {
- svc := ec2.New(nil)
-
- params := &ec2.ReplaceNetworkAclEntryInput{
- CidrBlock: aws.String("String"), // Required
- Egress: aws.Bool(true), // Required
- NetworkAclId: aws.String("String"), // Required
- Protocol: aws.String("String"), // Required
- RuleAction: aws.String("RuleAction"), // Required
- RuleNumber: aws.Int64(1), // Required
- DryRun: aws.Bool(true),
- IcmpTypeCode: &ec2.IcmpTypeCode{
- Code: aws.Int64(1),
- Type: aws.Int64(1),
- },
- PortRange: &ec2.PortRange{
- From: aws.Int64(1),
- To: aws.Int64(1),
- },
- }
- resp, err := svc.ReplaceNetworkAclEntry(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ReplaceRoute() {
- svc := ec2.New(nil)
-
- params := &ec2.ReplaceRouteInput{
- DestinationCidrBlock: aws.String("String"), // Required
- RouteTableId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- GatewayId: aws.String("String"),
- InstanceId: aws.String("String"),
- NetworkInterfaceId: aws.String("String"),
- VpcPeeringConnectionId: aws.String("String"),
- }
- resp, err := svc.ReplaceRoute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ReplaceRouteTableAssociation() {
- svc := ec2.New(nil)
-
- params := &ec2.ReplaceRouteTableAssociationInput{
- AssociationId: aws.String("String"), // Required
- RouteTableId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ReplaceRouteTableAssociation(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ReportInstanceStatus() {
- svc := ec2.New(nil)
-
- params := &ec2.ReportInstanceStatusInput{
- Instances: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- ReasonCodes: []*string{ // Required
- aws.String("ReportInstanceReasonCodes"), // Required
- // More values...
- },
- Status: aws.String("ReportStatusType"), // Required
- Description: aws.String("String"),
- DryRun: aws.Bool(true),
- EndTime: aws.Time(time.Now()),
- StartTime: aws.Time(time.Now()),
- }
- resp, err := svc.ReportInstanceStatus(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RequestSpotFleet() {
- svc := ec2.New(nil)
-
- params := &ec2.RequestSpotFleetInput{
- SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required
- IamFleetRole: aws.String("String"), // Required
- LaunchSpecifications: []*ec2.SpotFleetLaunchSpecification{ // Required
- { // Required
- AddressingType: aws.String("String"),
- BlockDeviceMappings: []*ec2.BlockDeviceMapping{
- { // Required
- DeviceName: aws.String("String"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: aws.Bool(true),
- Iops: aws.Int64(1),
- SnapshotId: aws.String("String"),
- VolumeSize: aws.Int64(1),
- VolumeType: aws.String("VolumeType"),
- },
- NoDevice: aws.String("String"),
- VirtualName: aws.String("String"),
- },
- // More values...
- },
- EbsOptimized: aws.Bool(true),
- IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
- Arn: aws.String("String"),
- Name: aws.String("String"),
- },
- ImageId: aws.String("String"),
- InstanceType: aws.String("InstanceType"),
- KernelId: aws.String("String"),
- KeyName: aws.String("String"),
- Monitoring: &ec2.SpotFleetMonitoring{
- Enabled: aws.Bool(true),
- },
- NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
- { // Required
- AssociatePublicIpAddress: aws.Bool(true),
- DeleteOnTermination: aws.Bool(true),
- Description: aws.String("String"),
- DeviceIndex: aws.Int64(1),
- Groups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- NetworkInterfaceId: aws.String("String"),
- PrivateIpAddress: aws.String("String"),
- PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
- { // Required
- PrivateIpAddress: aws.String("String"), // Required
- Primary: aws.Bool(true),
- },
- // More values...
- },
- SecondaryPrivateIpAddressCount: aws.Int64(1),
- SubnetId: aws.String("String"),
- },
- // More values...
- },
- Placement: &ec2.SpotPlacement{
- AvailabilityZone: aws.String("String"),
- GroupName: aws.String("String"),
- },
- RamdiskId: aws.String("String"),
- SecurityGroups: []*ec2.GroupIdentifier{
- { // Required
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- },
- // More values...
- },
- SpotPrice: aws.String("String"),
- SubnetId: aws.String("String"),
- UserData: aws.String("String"),
- WeightedCapacity: aws.Float64(1.0),
- },
- // More values...
- },
- SpotPrice: aws.String("String"), // Required
- TargetCapacity: aws.Int64(1), // Required
- AllocationStrategy: aws.String("AllocationStrategy"),
- ClientToken: aws.String("String"),
- TerminateInstancesWithExpiration: aws.Bool(true),
- ValidFrom: aws.Time(time.Now()),
- ValidUntil: aws.Time(time.Now()),
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.RequestSpotFleet(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RequestSpotInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.RequestSpotInstancesInput{
- SpotPrice: aws.String("String"), // Required
- AvailabilityZoneGroup: aws.String("String"),
- ClientToken: aws.String("String"),
- DryRun: aws.Bool(true),
- InstanceCount: aws.Int64(1),
- LaunchGroup: aws.String("String"),
- LaunchSpecification: &ec2.RequestSpotLaunchSpecification{
- AddressingType: aws.String("String"),
- BlockDeviceMappings: []*ec2.BlockDeviceMapping{
- { // Required
- DeviceName: aws.String("String"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: aws.Bool(true),
- Iops: aws.Int64(1),
- SnapshotId: aws.String("String"),
- VolumeSize: aws.Int64(1),
- VolumeType: aws.String("VolumeType"),
- },
- NoDevice: aws.String("String"),
- VirtualName: aws.String("String"),
- },
- // More values...
- },
- EbsOptimized: aws.Bool(true),
- IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
- Arn: aws.String("String"),
- Name: aws.String("String"),
- },
- ImageId: aws.String("String"),
- InstanceType: aws.String("InstanceType"),
- KernelId: aws.String("String"),
- KeyName: aws.String("String"),
- Monitoring: &ec2.RunInstancesMonitoringEnabled{
- Enabled: aws.Bool(true), // Required
- },
- NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
- { // Required
- AssociatePublicIpAddress: aws.Bool(true),
- DeleteOnTermination: aws.Bool(true),
- Description: aws.String("String"),
- DeviceIndex: aws.Int64(1),
- Groups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- NetworkInterfaceId: aws.String("String"),
- PrivateIpAddress: aws.String("String"),
- PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
- { // Required
- PrivateIpAddress: aws.String("String"), // Required
- Primary: aws.Bool(true),
- },
- // More values...
- },
- SecondaryPrivateIpAddressCount: aws.Int64(1),
- SubnetId: aws.String("String"),
- },
- // More values...
- },
- Placement: &ec2.SpotPlacement{
- AvailabilityZone: aws.String("String"),
- GroupName: aws.String("String"),
- },
- RamdiskId: aws.String("String"),
- SecurityGroupIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- SecurityGroups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- SubnetId: aws.String("String"),
- UserData: aws.String("String"),
- },
- Type: aws.String("SpotInstanceType"),
- ValidFrom: aws.Time(time.Now()),
- ValidUntil: aws.Time(time.Now()),
- }
- resp, err := svc.RequestSpotInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ResetImageAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ResetImageAttributeInput{
- Attribute: aws.String("ResetImageAttributeName"), // Required
- ImageId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ResetImageAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ResetInstanceAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ResetInstanceAttributeInput{
- Attribute: aws.String("InstanceAttributeName"), // Required
- InstanceId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ResetInstanceAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ResetNetworkInterfaceAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ResetNetworkInterfaceAttributeInput{
- NetworkInterfaceId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- SourceDestCheck: aws.String("String"),
- }
- resp, err := svc.ResetNetworkInterfaceAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_ResetSnapshotAttribute() {
- svc := ec2.New(nil)
-
- params := &ec2.ResetSnapshotAttributeInput{
- Attribute: aws.String("SnapshotAttributeName"), // Required
- SnapshotId: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.ResetSnapshotAttribute(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RestoreAddressToClassic() {
- svc := ec2.New(nil)
-
- params := &ec2.RestoreAddressToClassicInput{
- PublicIp: aws.String("String"), // Required
- DryRun: aws.Bool(true),
- }
- resp, err := svc.RestoreAddressToClassic(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RevokeSecurityGroupEgress() {
- svc := ec2.New(nil)
-
- params := &ec2.RevokeSecurityGroupEgressInput{
- GroupId: aws.String("String"), // Required
- CidrIp: aws.String("String"),
- DryRun: aws.Bool(true),
- FromPort: aws.Int64(1),
- IpPermissions: []*ec2.IpPermission{
- { // Required
- FromPort: aws.Int64(1),
- IpProtocol: aws.String("String"),
- IpRanges: []*ec2.IpRange{
- { // Required
- CidrIp: aws.String("String"),
- },
- // More values...
- },
- PrefixListIds: []*ec2.PrefixListId{
- { // Required
- PrefixListId: aws.String("String"),
- },
- // More values...
- },
- ToPort: aws.Int64(1),
- UserIdGroupPairs: []*ec2.UserIdGroupPair{
- { // Required
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- },
- // More values...
- },
- IpProtocol: aws.String("String"),
- SourceSecurityGroupName: aws.String("String"),
- SourceSecurityGroupOwnerId: aws.String("String"),
- ToPort: aws.Int64(1),
- }
- resp, err := svc.RevokeSecurityGroupEgress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RevokeSecurityGroupIngress() {
- svc := ec2.New(nil)
-
- params := &ec2.RevokeSecurityGroupIngressInput{
- CidrIp: aws.String("String"),
- DryRun: aws.Bool(true),
- FromPort: aws.Int64(1),
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- IpPermissions: []*ec2.IpPermission{
- { // Required
- FromPort: aws.Int64(1),
- IpProtocol: aws.String("String"),
- IpRanges: []*ec2.IpRange{
- { // Required
- CidrIp: aws.String("String"),
- },
- // More values...
- },
- PrefixListIds: []*ec2.PrefixListId{
- { // Required
- PrefixListId: aws.String("String"),
- },
- // More values...
- },
- ToPort: aws.Int64(1),
- UserIdGroupPairs: []*ec2.UserIdGroupPair{
- { // Required
- GroupId: aws.String("String"),
- GroupName: aws.String("String"),
- UserId: aws.String("String"),
- },
- // More values...
- },
- },
- // More values...
- },
- IpProtocol: aws.String("String"),
- SourceSecurityGroupName: aws.String("String"),
- SourceSecurityGroupOwnerId: aws.String("String"),
- ToPort: aws.Int64(1),
- }
- resp, err := svc.RevokeSecurityGroupIngress(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_RunInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.RunInstancesInput{
- ImageId: aws.String("String"), // Required
- MaxCount: aws.Int64(1), // Required
- MinCount: aws.Int64(1), // Required
- AdditionalInfo: aws.String("String"),
- BlockDeviceMappings: []*ec2.BlockDeviceMapping{
- { // Required
- DeviceName: aws.String("String"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: aws.Bool(true),
- Iops: aws.Int64(1),
- SnapshotId: aws.String("String"),
- VolumeSize: aws.Int64(1),
- VolumeType: aws.String("VolumeType"),
- },
- NoDevice: aws.String("String"),
- VirtualName: aws.String("String"),
- },
- // More values...
- },
- ClientToken: aws.String("String"),
- DisableApiTermination: aws.Bool(true),
- DryRun: aws.Bool(true),
- EbsOptimized: aws.Bool(true),
- IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
- Arn: aws.String("String"),
- Name: aws.String("String"),
- },
- InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
- InstanceType: aws.String("InstanceType"),
- KernelId: aws.String("String"),
- KeyName: aws.String("String"),
- Monitoring: &ec2.RunInstancesMonitoringEnabled{
- Enabled: aws.Bool(true), // Required
- },
- NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
- { // Required
- AssociatePublicIpAddress: aws.Bool(true),
- DeleteOnTermination: aws.Bool(true),
- Description: aws.String("String"),
- DeviceIndex: aws.Int64(1),
- Groups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- NetworkInterfaceId: aws.String("String"),
- PrivateIpAddress: aws.String("String"),
- PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
- { // Required
- PrivateIpAddress: aws.String("String"), // Required
- Primary: aws.Bool(true),
- },
- // More values...
- },
- SecondaryPrivateIpAddressCount: aws.Int64(1),
- SubnetId: aws.String("String"),
- },
- // More values...
- },
- Placement: &ec2.Placement{
- AvailabilityZone: aws.String("String"),
- GroupName: aws.String("String"),
- Tenancy: aws.String("Tenancy"),
- },
- PrivateIpAddress: aws.String("String"),
- RamdiskId: aws.String("String"),
- SecurityGroupIds: []*string{
- aws.String("String"), // Required
- // More values...
- },
- SecurityGroups: []*string{
- aws.String("String"), // Required
- // More values...
- },
- SubnetId: aws.String("String"),
- UserData: aws.String("String"),
- }
- resp, err := svc.RunInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_StartInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.StartInstancesInput{
- InstanceIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- AdditionalInfo: aws.String("String"),
- DryRun: aws.Bool(true),
- }
- resp, err := svc.StartInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_StopInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.StopInstancesInput{
- InstanceIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- Force: aws.Bool(true),
- }
- resp, err := svc.StopInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_TerminateInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.TerminateInstancesInput{
- InstanceIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.TerminateInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_UnassignPrivateIpAddresses() {
- svc := ec2.New(nil)
-
- params := &ec2.UnassignPrivateIpAddressesInput{
- NetworkInterfaceId: aws.String("String"), // Required
- PrivateIpAddresses: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- }
- resp, err := svc.UnassignPrivateIpAddresses(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleEC2_UnmonitorInstances() {
- svc := ec2.New(nil)
-
- params := &ec2.UnmonitorInstancesInput{
- InstanceIds: []*string{ // Required
- aws.String("String"), // Required
- // More values...
- },
- DryRun: aws.Bool(true),
- }
- resp, err := svc.UnmonitorInstances(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/elb/elbiface/interface_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/elb/elbiface/interface_test.go
deleted file mode 100644
index acf9105707f..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/elb/elbiface/interface_test.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
-
-package elbiface_test
-
-import (
- "testing"
-
- "github.com/aws/aws-sdk-go/service/elb"
- "github.com/aws/aws-sdk-go/service/elb/elbiface"
- "github.com/stretchr/testify/assert"
-)
-
-func TestInterface(t *testing.T) {
- assert.Implements(t, (*elbiface.ELBAPI)(nil), elb.New(nil))
-}
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/elb/examples_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/elb/examples_test.go
deleted file mode 100644
index 765c050eaaf..00000000000
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/elb/examples_test.go
+++ /dev/null
@@ -1,721 +0,0 @@
-// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
-
-package elb_test
-
-import (
- "bytes"
- "fmt"
- "time"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/elb"
-)
-
-var _ time.Duration
-var _ bytes.Buffer
-
-func ExampleELB_AddTags() {
- svc := elb.New(nil)
-
- params := &elb.AddTagsInput{
- LoadBalancerNames: []*string{ // Required
- aws.String("AccessPointName"), // Required
- // More values...
- },
- Tags: []*elb.Tag{ // Required
- { // Required
- Key: aws.String("TagKey"), // Required
- Value: aws.String("TagValue"),
- },
- // More values...
- },
- }
- resp, err := svc.AddTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_ApplySecurityGroupsToLoadBalancer() {
- svc := elb.New(nil)
-
- params := &elb.ApplySecurityGroupsToLoadBalancerInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- SecurityGroups: []*string{ // Required
- aws.String("SecurityGroupId"), // Required
- // More values...
- },
- }
- resp, err := svc.ApplySecurityGroupsToLoadBalancer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_AttachLoadBalancerToSubnets() {
- svc := elb.New(nil)
-
- params := &elb.AttachLoadBalancerToSubnetsInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- Subnets: []*string{ // Required
- aws.String("SubnetId"), // Required
- // More values...
- },
- }
- resp, err := svc.AttachLoadBalancerToSubnets(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_ConfigureHealthCheck() {
- svc := elb.New(nil)
-
- params := &elb.ConfigureHealthCheckInput{
- HealthCheck: &elb.HealthCheck{ // Required
- HealthyThreshold: aws.Int64(1), // Required
- Interval: aws.Int64(1), // Required
- Target: aws.String("HealthCheckTarget"), // Required
- Timeout: aws.Int64(1), // Required
- UnhealthyThreshold: aws.Int64(1), // Required
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.ConfigureHealthCheck(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_CreateAppCookieStickinessPolicy() {
- svc := elb.New(nil)
-
- params := &elb.CreateAppCookieStickinessPolicyInput{
- CookieName: aws.String("CookieName"), // Required
- LoadBalancerName: aws.String("AccessPointName"), // Required
- PolicyName: aws.String("PolicyName"), // Required
- }
- resp, err := svc.CreateAppCookieStickinessPolicy(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_CreateLBCookieStickinessPolicy() {
- svc := elb.New(nil)
-
- params := &elb.CreateLBCookieStickinessPolicyInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- PolicyName: aws.String("PolicyName"), // Required
- CookieExpirationPeriod: aws.Int64(1),
- }
- resp, err := svc.CreateLBCookieStickinessPolicy(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_CreateLoadBalancer() {
- svc := elb.New(nil)
-
- params := &elb.CreateLoadBalancerInput{
- Listeners: []*elb.Listener{ // Required
- { // Required
- InstancePort: aws.Int64(1), // Required
- LoadBalancerPort: aws.Int64(1), // Required
- Protocol: aws.String("Protocol"), // Required
- InstanceProtocol: aws.String("Protocol"),
- SSLCertificateId: aws.String("SSLCertificateId"),
- },
- // More values...
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- AvailabilityZones: []*string{
- aws.String("AvailabilityZone"), // Required
- // More values...
- },
- Scheme: aws.String("LoadBalancerScheme"),
- SecurityGroups: []*string{
- aws.String("SecurityGroupId"), // Required
- // More values...
- },
- Subnets: []*string{
- aws.String("SubnetId"), // Required
- // More values...
- },
- Tags: []*elb.Tag{
- { // Required
- Key: aws.String("TagKey"), // Required
- Value: aws.String("TagValue"),
- },
- // More values...
- },
- }
- resp, err := svc.CreateLoadBalancer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_CreateLoadBalancerListeners() {
- svc := elb.New(nil)
-
- params := &elb.CreateLoadBalancerListenersInput{
- Listeners: []*elb.Listener{ // Required
- { // Required
- InstancePort: aws.Int64(1), // Required
- LoadBalancerPort: aws.Int64(1), // Required
- Protocol: aws.String("Protocol"), // Required
- InstanceProtocol: aws.String("Protocol"),
- SSLCertificateId: aws.String("SSLCertificateId"),
- },
- // More values...
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.CreateLoadBalancerListeners(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_CreateLoadBalancerPolicy() {
- svc := elb.New(nil)
-
- params := &elb.CreateLoadBalancerPolicyInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- PolicyName: aws.String("PolicyName"), // Required
- PolicyTypeName: aws.String("PolicyTypeName"), // Required
- PolicyAttributes: []*elb.PolicyAttribute{
- { // Required
- AttributeName: aws.String("AttributeName"),
- AttributeValue: aws.String("AttributeValue"),
- },
- // More values...
- },
- }
- resp, err := svc.CreateLoadBalancerPolicy(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DeleteLoadBalancer() {
- svc := elb.New(nil)
-
- params := &elb.DeleteLoadBalancerInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.DeleteLoadBalancer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DeleteLoadBalancerListeners() {
- svc := elb.New(nil)
-
- params := &elb.DeleteLoadBalancerListenersInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- LoadBalancerPorts: []*int64{ // Required
- aws.Int64(1), // Required
- // More values...
- },
- }
- resp, err := svc.DeleteLoadBalancerListeners(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DeleteLoadBalancerPolicy() {
- svc := elb.New(nil)
-
- params := &elb.DeleteLoadBalancerPolicyInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- PolicyName: aws.String("PolicyName"), // Required
- }
- resp, err := svc.DeleteLoadBalancerPolicy(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DeregisterInstancesFromLoadBalancer() {
- svc := elb.New(nil)
-
- params := &elb.DeregisterInstancesFromLoadBalancerInput{
- Instances: []*elb.Instance{ // Required
- { // Required
- InstanceId: aws.String("InstanceId"),
- },
- // More values...
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.DeregisterInstancesFromLoadBalancer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DescribeInstanceHealth() {
- svc := elb.New(nil)
-
- params := &elb.DescribeInstanceHealthInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- Instances: []*elb.Instance{
- { // Required
- InstanceId: aws.String("InstanceId"),
- },
- // More values...
- },
- }
- resp, err := svc.DescribeInstanceHealth(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DescribeLoadBalancerAttributes() {
- svc := elb.New(nil)
-
- params := &elb.DescribeLoadBalancerAttributesInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.DescribeLoadBalancerAttributes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DescribeLoadBalancerPolicies() {
- svc := elb.New(nil)
-
- params := &elb.DescribeLoadBalancerPoliciesInput{
- LoadBalancerName: aws.String("AccessPointName"),
- PolicyNames: []*string{
- aws.String("PolicyName"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeLoadBalancerPolicies(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DescribeLoadBalancerPolicyTypes() {
- svc := elb.New(nil)
-
- params := &elb.DescribeLoadBalancerPolicyTypesInput{
- PolicyTypeNames: []*string{
- aws.String("PolicyTypeName"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeLoadBalancerPolicyTypes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DescribeLoadBalancers() {
- svc := elb.New(nil)
-
- params := &elb.DescribeLoadBalancersInput{
- LoadBalancerNames: []*string{
- aws.String("AccessPointName"), // Required
- // More values...
- },
- Marker: aws.String("Marker"),
- PageSize: aws.Int64(1),
- }
- resp, err := svc.DescribeLoadBalancers(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DescribeTags() {
- svc := elb.New(nil)
-
- params := &elb.DescribeTagsInput{
- LoadBalancerNames: []*string{ // Required
- aws.String("AccessPointName"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DetachLoadBalancerFromSubnets() {
- svc := elb.New(nil)
-
- params := &elb.DetachLoadBalancerFromSubnetsInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- Subnets: []*string{ // Required
- aws.String("SubnetId"), // Required
- // More values...
- },
- }
- resp, err := svc.DetachLoadBalancerFromSubnets(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_DisableAvailabilityZonesForLoadBalancer() {
- svc := elb.New(nil)
-
- params := &elb.DisableAvailabilityZonesForLoadBalancerInput{
- AvailabilityZones: []*string{ // Required
- aws.String("AvailabilityZone"), // Required
- // More values...
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.DisableAvailabilityZonesForLoadBalancer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_EnableAvailabilityZonesForLoadBalancer() {
- svc := elb.New(nil)
-
- params := &elb.EnableAvailabilityZonesForLoadBalancerInput{
- AvailabilityZones: []*string{ // Required
- aws.String("AvailabilityZone"), // Required
- // More values...
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.EnableAvailabilityZonesForLoadBalancer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_ModifyLoadBalancerAttributes() {
- svc := elb.New(nil)
-
- params := &elb.ModifyLoadBalancerAttributesInput{
- LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required
- AccessLog: &elb.AccessLog{
- Enabled: aws.Bool(true), // Required
- EmitInterval: aws.Int64(1),
- S3BucketName: aws.String("S3BucketName"),
- S3BucketPrefix: aws.String("AccessLogPrefix"),
- },
- AdditionalAttributes: []*elb.AdditionalAttribute{
- { // Required
- Key: aws.String("StringVal"),
- Value: aws.String("StringVal"),
- },
- // More values...
- },
- ConnectionDraining: &elb.ConnectionDraining{
- Enabled: aws.Bool(true), // Required
- Timeout: aws.Int64(1),
- },
- ConnectionSettings: &elb.ConnectionSettings{
- IdleTimeout: aws.Int64(1), // Required
- },
- CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{
- Enabled: aws.Bool(true), // Required
- },
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.ModifyLoadBalancerAttributes(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_RegisterInstancesWithLoadBalancer() {
- svc := elb.New(nil)
-
- params := &elb.RegisterInstancesWithLoadBalancerInput{
- Instances: []*elb.Instance{ // Required
- { // Required
- InstanceId: aws.String("InstanceId"),
- },
- // More values...
- },
- LoadBalancerName: aws.String("AccessPointName"), // Required
- }
- resp, err := svc.RegisterInstancesWithLoadBalancer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_RemoveTags() {
- svc := elb.New(nil)
-
- params := &elb.RemoveTagsInput{
- LoadBalancerNames: []*string{ // Required
- aws.String("AccessPointName"), // Required
- // More values...
- },
- Tags: []*elb.TagKeyOnly{ // Required
- { // Required
- Key: aws.String("TagKey"),
- },
- // More values...
- },
- }
- resp, err := svc.RemoveTags(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_SetLoadBalancerListenerSSLCertificate() {
- svc := elb.New(nil)
-
- params := &elb.SetLoadBalancerListenerSSLCertificateInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- LoadBalancerPort: aws.Int64(1), // Required
- SSLCertificateId: aws.String("SSLCertificateId"), // Required
- }
- resp, err := svc.SetLoadBalancerListenerSSLCertificate(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_SetLoadBalancerPoliciesForBackendServer() {
- svc := elb.New(nil)
-
- params := &elb.SetLoadBalancerPoliciesForBackendServerInput{
- InstancePort: aws.Int64(1), // Required
- LoadBalancerName: aws.String("AccessPointName"), // Required
- PolicyNames: []*string{ // Required
- aws.String("PolicyName"), // Required
- // More values...
- },
- }
- resp, err := svc.SetLoadBalancerPoliciesForBackendServer(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
-
-func ExampleELB_SetLoadBalancerPoliciesOfListener() {
- svc := elb.New(nil)
-
- params := &elb.SetLoadBalancerPoliciesOfListenerInput{
- LoadBalancerName: aws.String("AccessPointName"), // Required
- LoadBalancerPort: aws.Int64(1), // Required
- PolicyNames: []*string{ // Required
- aws.String("PolicyName"), // Required
- // More values...
- },
- }
- resp, err := svc.SetLoadBalancerPoliciesOfListener(params)
-
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
-
- // Pretty-print the response data.
- fmt.Println(resp)
-}
diff --git a/Godeps/_workspace/src/github.com/beorn7/perks/quantile/bench_test.go b/Godeps/_workspace/src/github.com/beorn7/perks/quantile/bench_test.go
deleted file mode 100644
index 0bd0e4e7752..00000000000
--- a/Godeps/_workspace/src/github.com/beorn7/perks/quantile/bench_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package quantile
-
-import (
- "testing"
-)
-
-func BenchmarkInsertTargeted(b *testing.B) {
- b.ReportAllocs()
-
- s := NewTargeted(Targets)
- b.ResetTimer()
- for i := float64(0); i < float64(b.N); i++ {
- s.Insert(i)
- }
-}
-
-func BenchmarkInsertTargetedSmallEpsilon(b *testing.B) {
- s := NewTargeted(TargetsSmallEpsilon)
- b.ResetTimer()
- for i := float64(0); i < float64(b.N); i++ {
- s.Insert(i)
- }
-}
-
-func BenchmarkInsertBiased(b *testing.B) {
- s := NewLowBiased(0.01)
- b.ResetTimer()
- for i := float64(0); i < float64(b.N); i++ {
- s.Insert(i)
- }
-}
-
-func BenchmarkInsertBiasedSmallEpsilon(b *testing.B) {
- s := NewLowBiased(0.0001)
- b.ResetTimer()
- for i := float64(0); i < float64(b.N); i++ {
- s.Insert(i)
- }
-}
-
-func BenchmarkQuery(b *testing.B) {
- s := NewTargeted(Targets)
- for i := float64(0); i < 1e6; i++ {
- s.Insert(i)
- }
- b.ResetTimer()
- n := float64(b.N)
- for i := float64(0); i < n; i++ {
- s.Query(i / n)
- }
-}
-
-func BenchmarkQuerySmallEpsilon(b *testing.B) {
- s := NewTargeted(TargetsSmallEpsilon)
- for i := float64(0); i < 1e6; i++ {
- s.Insert(i)
- }
- b.ResetTimer()
- n := float64(b.N)
- for i := float64(0); i < n; i++ {
- s.Query(i / n)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/beorn7/perks/quantile/example_test.go b/Godeps/_workspace/src/github.com/beorn7/perks/quantile/example_test.go
deleted file mode 100644
index ab3293aaf2a..00000000000
--- a/Godeps/_workspace/src/github.com/beorn7/perks/quantile/example_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// +build go1.1
-
-package quantile_test
-
-import (
- "bufio"
- "fmt"
- "log"
- "os"
- "strconv"
- "time"
-
- "github.com/beorn7/perks/quantile"
-)
-
-func Example_simple() {
- ch := make(chan float64)
- go sendFloats(ch)
-
- // Compute the 50th, 90th, and 99th percentile.
- q := quantile.NewTargeted(map[float64]float64{
- 0.50: 0.005,
- 0.90: 0.001,
- 0.99: 0.0001,
- })
- for v := range ch {
- q.Insert(v)
- }
-
- fmt.Println("perc50:", q.Query(0.50))
- fmt.Println("perc90:", q.Query(0.90))
- fmt.Println("perc99:", q.Query(0.99))
- fmt.Println("count:", q.Count())
- // Output:
- // perc50: 5
- // perc90: 16
- // perc99: 223
- // count: 2388
-}
-
-func Example_mergeMultipleStreams() {
- // Scenario:
- // We have multiple database shards. On each shard, there is a process
- // collecting query response times from the database logs and inserting
- // them into a Stream (created via NewTargeted(0.90)), much like the
- // Simple example. These processes expose a network interface for us to
- // ask them to serialize and send us the results of their
- // Stream.Samples so we may Merge and Query them.
- //
- // NOTES:
- // * These sample sets are small, allowing us to get them
- // across the network much faster than sending the entire list of data
- // points.
- //
- // * For this to work correctly, we must supply the same quantiles
- // a priori the process collecting the samples supplied to NewTargeted,
- // even if we do not plan to query them all here.
- ch := make(chan quantile.Samples)
- getDBQuerySamples(ch)
- q := quantile.NewTargeted(map[float64]float64{0.90: 0.001})
- for samples := range ch {
- q.Merge(samples)
- }
- fmt.Println("perc90:", q.Query(0.90))
-}
-
-func Example_window() {
- // Scenario: We want the 90th, 95th, and 99th percentiles for each
- // minute.
-
- ch := make(chan float64)
- go sendStreamValues(ch)
-
- tick := time.NewTicker(1 * time.Minute)
- q := quantile.NewTargeted(map[float64]float64{
- 0.90: 0.001,
- 0.95: 0.0005,
- 0.99: 0.0001,
- })
- for {
- select {
- case t := <-tick.C:
- flushToDB(t, q.Samples())
- q.Reset()
- case v := <-ch:
- q.Insert(v)
- }
- }
-}
-
-func sendStreamValues(ch chan float64) {
- // Use your imagination
-}
-
-func flushToDB(t time.Time, samples quantile.Samples) {
- // Use your imagination
-}
-
-// This is a stub for the above example. In reality this would hit the remote
-// servers via http or something like it.
-func getDBQuerySamples(ch chan quantile.Samples) {}
-
-func sendFloats(ch chan<- float64) {
- f, err := os.Open("exampledata.txt")
- if err != nil {
- log.Fatal(err)
- }
- sc := bufio.NewScanner(f)
- for sc.Scan() {
- b := sc.Bytes()
- v, err := strconv.ParseFloat(string(b), 64)
- if err != nil {
- log.Fatal(err)
- }
- ch <- v
- }
- if sc.Err() != nil {
- log.Fatal(sc.Err())
- }
- close(ch)
-}
diff --git a/Godeps/_workspace/src/github.com/beorn7/perks/quantile/stream_test.go b/Godeps/_workspace/src/github.com/beorn7/perks/quantile/stream_test.go
deleted file mode 100644
index 4dba05449cb..00000000000
--- a/Godeps/_workspace/src/github.com/beorn7/perks/quantile/stream_test.go
+++ /dev/null
@@ -1,188 +0,0 @@
-package quantile
-
-import (
- "math"
- "math/rand"
- "sort"
- "testing"
-)
-
-var (
- Targets = map[float64]float64{
- 0.01: 0.001,
- 0.10: 0.01,
- 0.50: 0.05,
- 0.90: 0.01,
- 0.99: 0.001,
- }
- TargetsSmallEpsilon = map[float64]float64{
- 0.01: 0.0001,
- 0.10: 0.001,
- 0.50: 0.005,
- 0.90: 0.001,
- 0.99: 0.0001,
- }
- LowQuantiles = []float64{0.01, 0.1, 0.5}
- HighQuantiles = []float64{0.99, 0.9, 0.5}
-)
-
-const RelativeEpsilon = 0.01
-
-func verifyPercsWithAbsoluteEpsilon(t *testing.T, a []float64, s *Stream) {
- sort.Float64s(a)
- for quantile, epsilon := range Targets {
- n := float64(len(a))
- k := int(quantile * n)
- lower := int((quantile - epsilon) * n)
- if lower < 1 {
- lower = 1
- }
- upper := int(math.Ceil((quantile + epsilon) * n))
- if upper > len(a) {
- upper = len(a)
- }
- w, min, max := a[k-1], a[lower-1], a[upper-1]
- if g := s.Query(quantile); g < min || g > max {
- t.Errorf("q=%f: want %v [%f,%f], got %v", quantile, w, min, max, g)
- }
- }
-}
-
-func verifyLowPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) {
- sort.Float64s(a)
- for _, qu := range LowQuantiles {
- n := float64(len(a))
- k := int(qu * n)
-
- lowerRank := int((1 - RelativeEpsilon) * qu * n)
- upperRank := int(math.Ceil((1 + RelativeEpsilon) * qu * n))
- w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1]
- if g := s.Query(qu); g < min || g > max {
- t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g)
- }
- }
-}
-
-func verifyHighPercsWithRelativeEpsilon(t *testing.T, a []float64, s *Stream) {
- sort.Float64s(a)
- for _, qu := range HighQuantiles {
- n := float64(len(a))
- k := int(qu * n)
-
- lowerRank := int((1 - (1+RelativeEpsilon)*(1-qu)) * n)
- upperRank := int(math.Ceil((1 - (1-RelativeEpsilon)*(1-qu)) * n))
- w, min, max := a[k-1], a[lowerRank-1], a[upperRank-1]
- if g := s.Query(qu); g < min || g > max {
- t.Errorf("q=%f: want %v [%f,%f], got %v", qu, w, min, max, g)
- }
- }
-}
-
-func populateStream(s *Stream) []float64 {
- a := make([]float64, 0, 1e5+100)
- for i := 0; i < cap(a); i++ {
- v := rand.NormFloat64()
- // Add 5% asymmetric outliers.
- if i%20 == 0 {
- v = v*v + 1
- }
- s.Insert(v)
- a = append(a, v)
- }
- return a
-}
-
-func TestTargetedQuery(t *testing.T) {
- rand.Seed(42)
- s := NewTargeted(Targets)
- a := populateStream(s)
- verifyPercsWithAbsoluteEpsilon(t, a, s)
-}
-
-func TestLowBiasedQuery(t *testing.T) {
- rand.Seed(42)
- s := NewLowBiased(RelativeEpsilon)
- a := populateStream(s)
- verifyLowPercsWithRelativeEpsilon(t, a, s)
-}
-
-func TestHighBiasedQuery(t *testing.T) {
- rand.Seed(42)
- s := NewHighBiased(RelativeEpsilon)
- a := populateStream(s)
- verifyHighPercsWithRelativeEpsilon(t, a, s)
-}
-
-// BrokenTestTargetedMerge is broken, see Merge doc comment.
-func BrokenTestTargetedMerge(t *testing.T) {
- rand.Seed(42)
- s1 := NewTargeted(Targets)
- s2 := NewTargeted(Targets)
- a := populateStream(s1)
- a = append(a, populateStream(s2)...)
- s1.Merge(s2.Samples())
- verifyPercsWithAbsoluteEpsilon(t, a, s1)
-}
-
-// BrokenTestLowBiasedMerge is broken, see Merge doc comment.
-func BrokenTestLowBiasedMerge(t *testing.T) {
- rand.Seed(42)
- s1 := NewLowBiased(RelativeEpsilon)
- s2 := NewLowBiased(RelativeEpsilon)
- a := populateStream(s1)
- a = append(a, populateStream(s2)...)
- s1.Merge(s2.Samples())
- verifyLowPercsWithRelativeEpsilon(t, a, s2)
-}
-
-// BrokenTestHighBiasedMerge is broken, see Merge doc comment.
-func BrokenTestHighBiasedMerge(t *testing.T) {
- rand.Seed(42)
- s1 := NewHighBiased(RelativeEpsilon)
- s2 := NewHighBiased(RelativeEpsilon)
- a := populateStream(s1)
- a = append(a, populateStream(s2)...)
- s1.Merge(s2.Samples())
- verifyHighPercsWithRelativeEpsilon(t, a, s2)
-}
-
-func TestUncompressed(t *testing.T) {
- q := NewTargeted(Targets)
- for i := 100; i > 0; i-- {
- q.Insert(float64(i))
- }
- if g := q.Count(); g != 100 {
- t.Errorf("want count 100, got %d", g)
- }
- // Before compression, Query should have 100% accuracy.
- for quantile := range Targets {
- w := quantile * 100
- if g := q.Query(quantile); g != w {
- t.Errorf("want %f, got %f", w, g)
- }
- }
-}
-
-func TestUncompressedSamples(t *testing.T) {
- q := NewTargeted(map[float64]float64{0.99: 0.001})
- for i := 1; i <= 100; i++ {
- q.Insert(float64(i))
- }
- if g := q.Samples().Len(); g != 100 {
- t.Errorf("want count 100, got %d", g)
- }
-}
-
-func TestUncompressedOne(t *testing.T) {
- q := NewTargeted(map[float64]float64{0.99: 0.01})
- q.Insert(3.14)
- if g := q.Query(0.90); g != 3.14 {
- t.Error("want PI, got", g)
- }
-}
-
-func TestDefaults(t *testing.T) {
- if g := NewTargeted(map[float64]float64{0.99: 0.001}).Query(0.99); g != 0 {
- t.Errorf("want 0, got %f", g)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/codegangsta/negroni/logger_test.go b/Godeps/_workspace/src/github.com/codegangsta/negroni/logger_test.go
deleted file mode 100644
index 880337d1a9b..00000000000
--- a/Godeps/_workspace/src/github.com/codegangsta/negroni/logger_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package negroni
-
-import (
- "bytes"
- "log"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func Test_Logger(t *testing.T) {
- buff := bytes.NewBufferString("")
- recorder := httptest.NewRecorder()
-
- l := NewLogger()
- l.Logger = log.New(buff, "[negroni] ", 0)
-
- n := New()
- // replace log for testing
- n.Use(l)
- n.UseHandler(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
- rw.WriteHeader(http.StatusNotFound)
- }))
-
- req, err := http.NewRequest("GET", "http://localhost:3000/foobar", nil)
- if err != nil {
- t.Error(err)
- }
-
- n.ServeHTTP(recorder, req)
- expect(t, recorder.Code, http.StatusNotFound)
- refute(t, len(buff.String()), 0)
-}
diff --git a/Godeps/_workspace/src/github.com/codegangsta/negroni/negroni_test.go b/Godeps/_workspace/src/github.com/codegangsta/negroni/negroni_test.go
deleted file mode 100644
index 9fac0085617..00000000000
--- a/Godeps/_workspace/src/github.com/codegangsta/negroni/negroni_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package negroni
-
-import (
- "net/http"
- "net/http/httptest"
- "reflect"
- "testing"
-)
-
-/* Test Helpers */
-func expect(t *testing.T, a interface{}, b interface{}) {
- if a != b {
- t.Errorf("Expected %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
- }
-}
-
-func refute(t *testing.T, a interface{}, b interface{}) {
- if a == b {
- t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
- }
-}
-
-func TestNegroniRun(t *testing.T) {
- // just test that Run doesn't bomb
- go New().Run(":3000")
-}
-
-func TestNegroniServeHTTP(t *testing.T) {
- result := ""
- response := httptest.NewRecorder()
-
- n := New()
- n.Use(HandlerFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
- result += "foo"
- next(rw, r)
- result += "ban"
- }))
- n.Use(HandlerFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
- result += "bar"
- next(rw, r)
- result += "baz"
- }))
- n.Use(HandlerFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
- result += "bat"
- rw.WriteHeader(http.StatusBadRequest)
- }))
-
- n.ServeHTTP(response, (*http.Request)(nil))
-
- expect(t, result, "foobarbatbazban")
- expect(t, response.Code, http.StatusBadRequest)
-}
-
-// Ensures that a Negroni middleware chain
-// can correctly return all of its handlers.
-func TestHandlers(t *testing.T) {
- response := httptest.NewRecorder()
- n := New()
- handlers := n.Handlers()
- expect(t, 0, len(handlers))
-
- n.Use(HandlerFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
- rw.WriteHeader(http.StatusOK)
- }))
-
- // Expects the length of handlers to be exactly 1
- // after adding exactly one handler to the middleware chain
- handlers = n.Handlers()
- expect(t, 1, len(handlers))
-
- // Ensures that the first handler that is in sequence behaves
- // exactly the same as the one that was registered earlier
- handlers[0].ServeHTTP(response, (*http.Request)(nil), nil)
- expect(t, response.Code, http.StatusOK)
-}
diff --git a/Godeps/_workspace/src/github.com/codegangsta/negroni/recovery_test.go b/Godeps/_workspace/src/github.com/codegangsta/negroni/recovery_test.go
deleted file mode 100644
index 3fa264acba9..00000000000
--- a/Godeps/_workspace/src/github.com/codegangsta/negroni/recovery_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package negroni
-
-import (
- "bytes"
- "log"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestRecovery(t *testing.T) {
- buff := bytes.NewBufferString("")
- recorder := httptest.NewRecorder()
-
- rec := NewRecovery()
- rec.Logger = log.New(buff, "[negroni] ", 0)
-
- n := New()
- // replace log for testing
- n.Use(rec)
- n.UseHandler(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
- panic("here is a panic!")
- }))
- n.ServeHTTP(recorder, (*http.Request)(nil))
- expect(t, recorder.Code, http.StatusInternalServerError)
- refute(t, recorder.Body.Len(), 0)
- refute(t, len(buff.String()), 0)
-}
diff --git a/Godeps/_workspace/src/github.com/codegangsta/negroni/response_writer_test.go b/Godeps/_workspace/src/github.com/codegangsta/negroni/response_writer_test.go
deleted file mode 100644
index ed1ee70a6a2..00000000000
--- a/Godeps/_workspace/src/github.com/codegangsta/negroni/response_writer_test.go
+++ /dev/null
@@ -1,150 +0,0 @@
-package negroni
-
-import (
- "bufio"
- "net"
- "net/http"
- "net/http/httptest"
- "testing"
- "time"
-)
-
-type closeNotifyingRecorder struct {
- *httptest.ResponseRecorder
- closed chan bool
-}
-
-func newCloseNotifyingRecorder() *closeNotifyingRecorder {
- return &closeNotifyingRecorder{
- httptest.NewRecorder(),
- make(chan bool, 1),
- }
-}
-
-func (c *closeNotifyingRecorder) close() {
- c.closed <- true
-}
-
-func (c *closeNotifyingRecorder) CloseNotify() <-chan bool {
- return c.closed
-}
-
-type hijackableResponse struct {
- Hijacked bool
-}
-
-func newHijackableResponse() *hijackableResponse {
- return &hijackableResponse{}
-}
-
-func (h *hijackableResponse) Header() http.Header { return nil }
-func (h *hijackableResponse) Write(buf []byte) (int, error) { return 0, nil }
-func (h *hijackableResponse) WriteHeader(code int) {}
-func (h *hijackableResponse) Flush() {}
-func (h *hijackableResponse) Hijack() (net.Conn, *bufio.ReadWriter, error) {
- h.Hijacked = true
- return nil, nil, nil
-}
-
-func TestResponseWriterWritingString(t *testing.T) {
- rec := httptest.NewRecorder()
- rw := NewResponseWriter(rec)
-
- rw.Write([]byte("Hello world"))
-
- expect(t, rec.Code, rw.Status())
- expect(t, rec.Body.String(), "Hello world")
- expect(t, rw.Status(), http.StatusOK)
- expect(t, rw.Size(), 11)
- expect(t, rw.Written(), true)
-}
-
-func TestResponseWriterWritingStrings(t *testing.T) {
- rec := httptest.NewRecorder()
- rw := NewResponseWriter(rec)
-
- rw.Write([]byte("Hello world"))
- rw.Write([]byte("foo bar bat baz"))
-
- expect(t, rec.Code, rw.Status())
- expect(t, rec.Body.String(), "Hello worldfoo bar bat baz")
- expect(t, rw.Status(), http.StatusOK)
- expect(t, rw.Size(), 26)
-}
-
-func TestResponseWriterWritingHeader(t *testing.T) {
- rec := httptest.NewRecorder()
- rw := NewResponseWriter(rec)
-
- rw.WriteHeader(http.StatusNotFound)
-
- expect(t, rec.Code, rw.Status())
- expect(t, rec.Body.String(), "")
- expect(t, rw.Status(), http.StatusNotFound)
- expect(t, rw.Size(), 0)
-}
-
-func TestResponseWriterBefore(t *testing.T) {
- rec := httptest.NewRecorder()
- rw := NewResponseWriter(rec)
- result := ""
-
- rw.Before(func(ResponseWriter) {
- result += "foo"
- })
- rw.Before(func(ResponseWriter) {
- result += "bar"
- })
-
- rw.WriteHeader(http.StatusNotFound)
-
- expect(t, rec.Code, rw.Status())
- expect(t, rec.Body.String(), "")
- expect(t, rw.Status(), http.StatusNotFound)
- expect(t, rw.Size(), 0)
- expect(t, result, "barfoo")
-}
-
-func TestResponseWriterHijack(t *testing.T) {
- hijackable := newHijackableResponse()
- rw := NewResponseWriter(hijackable)
- hijacker, ok := rw.(http.Hijacker)
- expect(t, ok, true)
- _, _, err := hijacker.Hijack()
- if err != nil {
- t.Error(err)
- }
- expect(t, hijackable.Hijacked, true)
-}
-
-func TestResponseWriteHijackNotOK(t *testing.T) {
- hijackable := new(http.ResponseWriter)
- rw := NewResponseWriter(*hijackable)
- hijacker, ok := rw.(http.Hijacker)
- expect(t, ok, true)
- _, _, err := hijacker.Hijack()
-
- refute(t, err, nil)
-}
-
-func TestResponseWriterCloseNotify(t *testing.T) {
- rec := newCloseNotifyingRecorder()
- rw := NewResponseWriter(rec)
- closed := false
- notifier := rw.(http.CloseNotifier).CloseNotify()
- rec.close()
- select {
- case <-notifier:
- closed = true
- case <-time.After(time.Second):
- }
- expect(t, closed, true)
-}
-
-func TestResponseWriterFlusher(t *testing.T) {
- rec := httptest.NewRecorder()
- rw := NewResponseWriter(rec)
-
- _, ok := rw.(http.Flusher)
- expect(t, ok, true)
-}
diff --git a/Godeps/_workspace/src/github.com/codegangsta/negroni/static_test.go b/Godeps/_workspace/src/github.com/codegangsta/negroni/static_test.go
deleted file mode 100644
index 637cfcd68e0..00000000000
--- a/Godeps/_workspace/src/github.com/codegangsta/negroni/static_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package negroni
-
-import (
- "bytes"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestStatic(t *testing.T) {
- response := httptest.NewRecorder()
- response.Body = new(bytes.Buffer)
-
- n := New()
- n.Use(NewStatic(http.Dir(".")))
-
- req, err := http.NewRequest("GET", "http://localhost:3000/negroni.go", nil)
- if err != nil {
- t.Error(err)
- }
- n.ServeHTTP(response, req)
- expect(t, response.Code, http.StatusOK)
- expect(t, response.Header().Get("Expires"), "")
- if response.Body.Len() == 0 {
- t.Errorf("Got empty body for GET request")
- }
-}
-
-func TestStaticHead(t *testing.T) {
- response := httptest.NewRecorder()
- response.Body = new(bytes.Buffer)
-
- n := New()
- n.Use(NewStatic(http.Dir(".")))
- n.UseHandler(http.NotFoundHandler())
-
- req, err := http.NewRequest("HEAD", "http://localhost:3000/negroni.go", nil)
- if err != nil {
- t.Error(err)
- }
-
- n.ServeHTTP(response, req)
- expect(t, response.Code, http.StatusOK)
- if response.Body.Len() != 0 {
- t.Errorf("Got non-empty body for HEAD request")
- }
-}
-
-func TestStaticAsPost(t *testing.T) {
- response := httptest.NewRecorder()
-
- n := New()
- n.Use(NewStatic(http.Dir(".")))
- n.UseHandler(http.NotFoundHandler())
-
- req, err := http.NewRequest("POST", "http://localhost:3000/negroni.go", nil)
- if err != nil {
- t.Error(err)
- }
-
- n.ServeHTTP(response, req)
- expect(t, response.Code, http.StatusNotFound)
-}
-
-func TestStaticBadDir(t *testing.T) {
- response := httptest.NewRecorder()
-
- n := Classic()
- n.UseHandler(http.NotFoundHandler())
-
- req, err := http.NewRequest("GET", "http://localhost:3000/negroni.go", nil)
- if err != nil {
- t.Error(err)
- }
-
- n.ServeHTTP(response, req)
- refute(t, response.Code, http.StatusOK)
-}
-
-func TestStaticOptionsServeIndex(t *testing.T) {
- response := httptest.NewRecorder()
-
- n := New()
- s := NewStatic(http.Dir("."))
- s.IndexFile = "negroni.go"
- n.Use(s)
-
- req, err := http.NewRequest("GET", "http://localhost:3000/", nil)
- if err != nil {
- t.Error(err)
- }
-
- n.ServeHTTP(response, req)
- expect(t, response.Code, http.StatusOK)
-}
-
-func TestStaticOptionsPrefix(t *testing.T) {
- response := httptest.NewRecorder()
-
- n := New()
- s := NewStatic(http.Dir("."))
- s.Prefix = "/public"
- n.Use(s)
-
- // Check file content behaviour
- req, err := http.NewRequest("GET", "http://localhost:3000/public/negroni.go", nil)
- if err != nil {
- t.Error(err)
- }
-
- n.ServeHTTP(response, req)
- expect(t, response.Code, http.StatusOK)
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/add_child_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/add_child_test.go
deleted file mode 100644
index 26223ff1c85..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/add_child_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package etcd
-
-import "testing"
-
-func TestAddChild(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("fooDir", true)
- c.Delete("nonexistentDir", true)
- }()
-
- c.CreateDir("fooDir", 5)
-
- _, err := c.AddChild("fooDir", "v0", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = c.AddChild("fooDir", "v1", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.Get("fooDir", true, false)
- // The child with v0 should proceed the child with v1 because it's added
- // earlier, so it should have a lower key.
- if !(len(resp.Node.Nodes) == 2 && (resp.Node.Nodes[0].Value == "v0" && resp.Node.Nodes[1].Value == "v1")) {
- t.Fatalf("AddChild 1 failed. There should be two chlidren whose values are v0 and v1, respectively."+
- " The response was: %#v", resp)
- }
-
- // Creating a child under a nonexistent directory should succeed.
- // The directory should be created.
- resp, err = c.AddChild("nonexistentDir", "foo", 5)
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestAddChildDir(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("fooDir", true)
- c.Delete("nonexistentDir", true)
- }()
-
- c.CreateDir("fooDir", 5)
-
- _, err := c.AddChildDir("fooDir", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = c.AddChildDir("fooDir", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := c.Get("fooDir", true, false)
- // The child with v0 should proceed the child with v1 because it's added
- // earlier, so it should have a lower key.
- if !(len(resp.Node.Nodes) == 2 && (len(resp.Node.Nodes[0].Nodes) == 0 && len(resp.Node.Nodes[1].Nodes) == 0)) {
- t.Fatalf("AddChildDir 1 failed. There should be two chlidren whose values are v0 and v1, respectively."+
- " The response was: %#v", resp)
- }
-
- // Creating a child under a nonexistent directory should succeed.
- // The directory should be created.
- resp, err = c.AddChildDir("nonexistentDir", 5)
- if err != nil {
- t.Fatal(err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/client_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/client_test.go
deleted file mode 100644
index 4720d8d693e..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/client_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package etcd
-
-import (
- "encoding/json"
- "fmt"
- "net"
- "net/url"
- "os"
- "testing"
-)
-
-// To pass this test, we need to create a cluster of 3 machines
-// The server should be listening on localhost:4001, 4002, 4003
-func TestSync(t *testing.T) {
- fmt.Println("Make sure there are three nodes at 0.0.0.0:4001-4003")
-
- // Explicit trailing slash to ensure this doesn't reproduce:
- // https://github.com/coreos/go-etcd/issues/82
- c := NewClient([]string{"http://127.0.0.1:4001/"})
-
- success := c.SyncCluster()
- if !success {
- t.Fatal("cannot sync machines")
- }
-
- for _, m := range c.GetCluster() {
- u, err := url.Parse(m)
- if err != nil {
- t.Fatal(err)
- }
- if u.Scheme != "http" {
- t.Fatal("scheme must be http")
- }
-
- host, _, err := net.SplitHostPort(u.Host)
- if err != nil {
- t.Fatal(err)
- }
- if host != "localhost" {
- t.Fatal("Host must be localhost")
- }
- }
-
- badMachines := []string{"abc", "edef"}
-
- success = c.SetCluster(badMachines)
-
- if success {
- t.Fatal("should not sync on bad machines")
- }
-
- goodMachines := []string{"127.0.0.1:4002"}
-
- success = c.SetCluster(goodMachines)
-
- if !success {
- t.Fatal("cannot sync machines")
- } else {
- fmt.Println(c.cluster.Machines)
- }
-
-}
-
-func TestPersistence(t *testing.T) {
- c := NewClient(nil)
- c.SyncCluster()
-
- fo, err := os.Create("config.json")
- if err != nil {
- t.Fatal(err)
- }
- defer func() {
- if err := fo.Close(); err != nil {
- panic(err)
- }
- }()
-
- c.SetPersistence(fo)
- err = c.saveConfig()
- if err != nil {
- t.Fatal(err)
- }
-
- c2, err := NewClientFromFile("config.json")
- if err != nil {
- t.Fatal(err)
- }
-
- // Verify that the two clients have the same config
- b1, _ := json.Marshal(c)
- b2, _ := json.Marshal(c2)
-
- if string(b1) != string(b2) {
- t.Fatalf("The two configs should be equal!")
- }
-}
-
-func TestClientRetry(t *testing.T) {
- c := NewClient([]string{"http://strange", "http://127.0.0.1:4001"})
- // use first endpoint as the picked url
- c.cluster.picked = 0
- if _, err := c.Set("foo", "bar", 5); err != nil {
- t.Fatal(err)
- }
- if _, err := c.Delete("foo", true); err != nil {
- t.Fatal(err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/compare_and_delete_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/compare_and_delete_test.go
deleted file mode 100644
index 223e50f2916..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/compare_and_delete_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package etcd
-
-import (
- "testing"
-)
-
-func TestCompareAndDelete(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- }()
-
- c.Set("foo", "bar", 5)
-
- // This should succeed an correct prevValue
- resp, err := c.CompareAndDelete("foo", "bar", 0)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.PrevNode.Value == "bar" && resp.PrevNode.Key == "/foo" && resp.PrevNode.TTL == 5) {
- t.Fatalf("CompareAndDelete 1 prevNode failed: %#v", resp)
- }
-
- resp, _ = c.Set("foo", "bar", 5)
- // This should fail because it gives an incorrect prevValue
- _, err = c.CompareAndDelete("foo", "xxx", 0)
- if err == nil {
- t.Fatalf("CompareAndDelete 2 should have failed. The response is: %#v", resp)
- }
-
- // This should succeed because it gives an correct prevIndex
- resp, err = c.CompareAndDelete("foo", "", resp.Node.ModifiedIndex)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.PrevNode.Value == "bar" && resp.PrevNode.Key == "/foo" && resp.PrevNode.TTL == 5) {
- t.Fatalf("CompareAndSwap 3 prevNode failed: %#v", resp)
- }
-
- c.Set("foo", "bar", 5)
- // This should fail because it gives an incorrect prevIndex
- resp, err = c.CompareAndDelete("foo", "", 29817514)
- if err == nil {
- t.Fatalf("CompareAndDelete 4 should have failed. The response is: %#v", resp)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/compare_and_swap_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/compare_and_swap_test.go
deleted file mode 100644
index 14a1b00f5a7..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/compare_and_swap_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package etcd
-
-import (
- "testing"
-)
-
-func TestCompareAndSwap(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- }()
-
- c.Set("foo", "bar", 5)
-
- // This should succeed
- resp, err := c.CompareAndSwap("foo", "bar2", 5, "bar", 0)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Value == "bar2" && resp.Node.Key == "/foo" && resp.Node.TTL == 5) {
- t.Fatalf("CompareAndSwap 1 failed: %#v", resp)
- }
-
- if !(resp.PrevNode.Value == "bar" && resp.PrevNode.Key == "/foo" && resp.PrevNode.TTL == 5) {
- t.Fatalf("CompareAndSwap 1 prevNode failed: %#v", resp)
- }
-
- // This should fail because it gives an incorrect prevValue
- resp, err = c.CompareAndSwap("foo", "bar3", 5, "xxx", 0)
- if err == nil {
- t.Fatalf("CompareAndSwap 2 should have failed. The response is: %#v", resp)
- }
-
- resp, err = c.Set("foo", "bar", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- // This should succeed
- resp, err = c.CompareAndSwap("foo", "bar2", 5, "", resp.Node.ModifiedIndex)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Value == "bar2" && resp.Node.Key == "/foo" && resp.Node.TTL == 5) {
- t.Fatalf("CompareAndSwap 3 failed: %#v", resp)
- }
-
- if !(resp.PrevNode.Value == "bar" && resp.PrevNode.Key == "/foo" && resp.PrevNode.TTL == 5) {
- t.Fatalf("CompareAndSwap 3 prevNode failed: %#v", resp)
- }
-
- // This should fail because it gives an incorrect prevIndex
- resp, err = c.CompareAndSwap("foo", "bar3", 5, "", 29817514)
- if err == nil {
- t.Fatalf("CompareAndSwap 4 should have failed. The response is: %#v", resp)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/debug_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/debug_test.go
deleted file mode 100644
index 97f6d1110bc..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/debug_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package etcd
-
-import (
- "testing"
-)
-
-type Foo struct{}
-type Bar struct {
- one string
- two int
-}
-
-// Tests that logs don't panic with arbitrary interfaces
-func TestDebug(t *testing.T) {
- f := &Foo{}
- b := &Bar{"asfd", 3}
- for _, test := range []interface{}{
- 1234,
- "asdf",
- f,
- b,
- } {
- logger.Debug(test)
- logger.Debugf("something, %s", test)
- logger.Warning(test)
- logger.Warningf("something, %s", test)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/delete_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/delete_test.go
deleted file mode 100644
index 5904971556d..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/delete_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package etcd
-
-import (
- "testing"
-)
-
-func TestDelete(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- }()
-
- c.Set("foo", "bar", 5)
- resp, err := c.Delete("foo", false)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Node.Value == "") {
- t.Fatalf("Delete failed with %s", resp.Node.Value)
- }
-
- if !(resp.PrevNode.Value == "bar") {
- t.Fatalf("Delete PrevNode failed with %s", resp.Node.Value)
- }
-
- resp, err = c.Delete("foo", false)
- if err == nil {
- t.Fatalf("Delete should have failed because the key foo did not exist. "+
- "The response was: %v", resp)
- }
-}
-
-func TestDeleteAll(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- c.Delete("fooDir", true)
- }()
-
- c.SetDir("foo", 5)
- // test delete an empty dir
- resp, err := c.DeleteDir("foo")
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Node.Value == "") {
- t.Fatalf("DeleteAll 1 failed: %#v", resp)
- }
-
- if !(resp.PrevNode.Dir == true && resp.PrevNode.Value == "") {
- t.Fatalf("DeleteAll 1 PrevNode failed: %#v", resp)
- }
-
- c.CreateDir("fooDir", 5)
- c.Set("fooDir/foo", "bar", 5)
- _, err = c.DeleteDir("fooDir")
- if err == nil {
- t.Fatal("should not able to delete a non-empty dir with deletedir")
- }
-
- resp, err = c.Delete("fooDir", true)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Node.Value == "") {
- t.Fatalf("DeleteAll 2 failed: %#v", resp)
- }
-
- if !(resp.PrevNode.Dir == true && resp.PrevNode.Value == "") {
- t.Fatalf("DeleteAll 2 PrevNode failed: %#v", resp)
- }
-
- resp, err = c.Delete("foo", true)
- if err == nil {
- t.Fatalf("DeleteAll should have failed because the key foo did not exist. "+
- "The response was: %v", resp)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/get_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/get_test.go
deleted file mode 100644
index 279c4e26f8b..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/get_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-package etcd
-
-import (
- "reflect"
- "testing"
-)
-
-// cleanNode scrubs Expiration, ModifiedIndex and CreatedIndex of a node.
-func cleanNode(n *Node) {
- n.Expiration = nil
- n.ModifiedIndex = 0
- n.CreatedIndex = 0
-}
-
-// cleanResult scrubs a result object two levels deep of Expiration,
-// ModifiedIndex and CreatedIndex.
-func cleanResult(result *Response) {
- // TODO(philips): make this recursive.
- cleanNode(result.Node)
- for i, _ := range result.Node.Nodes {
- cleanNode(result.Node.Nodes[i])
- for j, _ := range result.Node.Nodes[i].Nodes {
- cleanNode(result.Node.Nodes[i].Nodes[j])
- }
- }
-}
-
-func TestGet(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- }()
-
- c.Set("foo", "bar", 5)
-
- result, err := c.Get("foo", false, false)
-
- if err != nil {
- t.Fatal(err)
- }
-
- if result.Node.Key != "/foo" || result.Node.Value != "bar" {
- t.Fatalf("Get failed with %s %s %v", result.Node.Key, result.Node.Value, result.Node.TTL)
- }
-
- result, err = c.Get("goo", false, false)
- if err == nil {
- t.Fatalf("should not be able to get non-exist key")
- }
-}
-
-func TestGetAll(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("fooDir", true)
- }()
-
- c.CreateDir("fooDir", 5)
- c.Set("fooDir/k0", "v0", 5)
- c.Set("fooDir/k1", "v1", 5)
-
- // Return kv-pairs in sorted order
- result, err := c.Get("fooDir", true, false)
-
- if err != nil {
- t.Fatal(err)
- }
-
- expected := Nodes{
- &Node{
- Key: "/fooDir/k0",
- Value: "v0",
- TTL: 5,
- },
- &Node{
- Key: "/fooDir/k1",
- Value: "v1",
- TTL: 5,
- },
- }
-
- cleanResult(result)
-
- if !reflect.DeepEqual(result.Node.Nodes, expected) {
- t.Fatalf("(actual) %v != (expected) %v", result.Node.Nodes, expected)
- }
-
- // Test the `recursive` option
- c.CreateDir("fooDir/childDir", 5)
- c.Set("fooDir/childDir/k2", "v2", 5)
-
- // Return kv-pairs in sorted order
- result, err = c.Get("fooDir", true, true)
-
- cleanResult(result)
-
- if err != nil {
- t.Fatal(err)
- }
-
- expected = Nodes{
- &Node{
- Key: "/fooDir/childDir",
- Dir: true,
- Nodes: Nodes{
- &Node{
- Key: "/fooDir/childDir/k2",
- Value: "v2",
- TTL: 5,
- },
- },
- TTL: 5,
- },
- &Node{
- Key: "/fooDir/k0",
- Value: "v0",
- TTL: 5,
- },
- &Node{
- Key: "/fooDir/k1",
- Value: "v1",
- TTL: 5,
- },
- }
-
- cleanResult(result)
-
- if !reflect.DeepEqual(result.Node.Nodes, expected) {
- t.Fatalf("(actual) %v != (expected) %v", result.Node.Nodes, expected)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/member_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/member_test.go
deleted file mode 100644
index 53ebdd4bfde..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/member_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package etcd
-
-import (
- "encoding/json"
- "reflect"
- "testing"
-)
-
-func TestMemberCollectionUnmarshal(t *testing.T) {
- tests := []struct {
- body []byte
- want memberCollection
- }{
- {
- body: []byte(`{"members":[]}`),
- want: memberCollection([]Member{}),
- },
- {
- body: []byte(`{"members":[{"id":"2745e2525fce8fe","peerURLs":["http://127.0.0.1:7003"],"name":"node3","clientURLs":["http://127.0.0.1:4003"]},{"id":"42134f434382925","peerURLs":["http://127.0.0.1:2380","http://127.0.0.1:7001"],"name":"node1","clientURLs":["http://127.0.0.1:2379","http://127.0.0.1:4001"]},{"id":"94088180e21eb87b","peerURLs":["http://127.0.0.1:7002"],"name":"node2","clientURLs":["http://127.0.0.1:4002"]}]}`),
- want: memberCollection(
- []Member{
- {
- ID: "2745e2525fce8fe",
- Name: "node3",
- PeerURLs: []string{
- "http://127.0.0.1:7003",
- },
- ClientURLs: []string{
- "http://127.0.0.1:4003",
- },
- },
- {
- ID: "42134f434382925",
- Name: "node1",
- PeerURLs: []string{
- "http://127.0.0.1:2380",
- "http://127.0.0.1:7001",
- },
- ClientURLs: []string{
- "http://127.0.0.1:2379",
- "http://127.0.0.1:4001",
- },
- },
- {
- ID: "94088180e21eb87b",
- Name: "node2",
- PeerURLs: []string{
- "http://127.0.0.1:7002",
- },
- ClientURLs: []string{
- "http://127.0.0.1:4002",
- },
- },
- },
- ),
- },
- }
-
- for i, tt := range tests {
- var got memberCollection
- err := json.Unmarshal(tt.body, &got)
- if err != nil {
- t.Errorf("#%d: unexpected error: %v", i, err)
- continue
- }
-
- if !reflect.DeepEqual(tt.want, got) {
- t.Errorf("#%d: incorrect output: want=%#v, got=%#v", i, tt.want, got)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/requests_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/requests_test.go
deleted file mode 100644
index 7a2bd190a10..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/requests_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package etcd
-
-import "testing"
-
-func TestKeyToPath(t *testing.T) {
- tests := []struct {
- key string
- wpath string
- }{
- {"", "keys/"},
- {"foo", "keys/foo"},
- {"foo/bar", "keys/foo/bar"},
- {"%z", "keys/%25z"},
- {"/", "keys/"},
- }
- for i, tt := range tests {
- path := keyToPath(tt.key)
- if path != tt.wpath {
- t.Errorf("#%d: path = %s, want %s", i, path, tt.wpath)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response_test.go
deleted file mode 100644
index 23e0c56eb33..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package etcd
-
-import (
- "net/http"
- "reflect"
- "strings"
- "testing"
-
- "github.com/ugorji/go/codec"
-)
-
-func createTestNode(size int) *Node {
- return &Node{
- Key: strings.Repeat("a", 30),
- Value: strings.Repeat("a", size),
- TTL: 123456789,
- ModifiedIndex: 123456,
- CreatedIndex: 123456,
- }
-}
-
-func createTestNodeWithChildren(children, size int) *Node {
- node := createTestNode(size)
- for i := 0; i < children; i++ {
- node.Nodes = append(node.Nodes, createTestNode(size))
- }
- return node
-}
-
-func createTestResponse(children, size int) *Response {
- return &Response{
- Action: "aaaaa",
- Node: createTestNodeWithChildren(children, size),
- PrevNode: nil,
- EtcdIndex: 123456,
- RaftIndex: 123456,
- RaftTerm: 123456,
- }
-}
-
-func benchmarkResponseUnmarshalling(b *testing.B, children, size int) {
- response := createTestResponse(children, size)
-
- rr := RawResponse{http.StatusOK, make([]byte, 0), http.Header{}}
- codec.NewEncoderBytes(&rr.Body, new(codec.JsonHandle)).Encode(response)
-
- b.ResetTimer()
- newResponse := new(Response)
- var err error
- for i := 0; i < b.N; i++ {
- if newResponse, err = rr.Unmarshal(); err != nil {
- b.Errorf("Error: %v", err)
- }
-
- }
- if !reflect.DeepEqual(response.Node, newResponse.Node) {
- b.Errorf("Unexpected difference in a parsed response: \n%+v\n%+v", response, newResponse)
- }
-}
-
-func BenchmarkSmallResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 30, 20)
-}
-
-func BenchmarkManySmallResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 3000, 20)
-}
-
-func BenchmarkMediumResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 300, 200)
-}
-
-func BenchmarkLargeResponseUnmarshal(b *testing.B) {
- benchmarkResponseUnmarshalling(b, 3000, 2000)
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/set_curl_chan_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/set_curl_chan_test.go
deleted file mode 100644
index 87c86b83082..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/set_curl_chan_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package etcd
-
-import (
- "fmt"
- "testing"
-)
-
-func TestSetCurlChan(t *testing.T) {
- c := NewClient(nil)
- c.OpenCURL()
-
- defer func() {
- c.Delete("foo", true)
- }()
-
- _, err := c.Set("foo", "bar", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- expected := fmt.Sprintf("curl -X PUT %s/v2/keys/foo -d value=bar -d ttl=5",
- c.cluster.pick())
- actual := c.RecvCURL()
- if expected != actual {
- t.Fatalf(`Command "%s" is not equal to expected value "%s"`,
- actual, expected)
- }
-
- c.SetConsistency(STRONG_CONSISTENCY)
- _, err = c.Get("foo", false, false)
- if err != nil {
- t.Fatal(err)
- }
-
- expected = fmt.Sprintf("curl -X GET %s/v2/keys/foo?quorum=true&recursive=false&sorted=false",
- c.cluster.pick())
- actual = c.RecvCURL()
- if expected != actual {
- t.Fatalf(`Command "%s" is not equal to expected value "%s"`,
- actual, expected)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/set_update_create_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/set_update_create_test.go
deleted file mode 100644
index ced0f06e7be..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/set_update_create_test.go
+++ /dev/null
@@ -1,241 +0,0 @@
-package etcd
-
-import (
- "testing"
-)
-
-func TestSet(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- }()
-
- resp, err := c.Set("foo", "bar", 5)
- if err != nil {
- t.Fatal(err)
- }
- if resp.Node.Key != "/foo" || resp.Node.Value != "bar" || resp.Node.TTL != 5 {
- t.Fatalf("Set 1 failed: %#v", resp)
- }
- if resp.PrevNode != nil {
- t.Fatalf("Set 1 PrevNode failed: %#v", resp)
- }
-
- resp, err = c.Set("foo", "bar2", 5)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Key == "/foo" && resp.Node.Value == "bar2" && resp.Node.TTL == 5) {
- t.Fatalf("Set 2 failed: %#v", resp)
- }
- if resp.PrevNode.Key != "/foo" || resp.PrevNode.Value != "bar" || resp.Node.TTL != 5 {
- t.Fatalf("Set 2 PrevNode failed: %#v", resp)
- }
-}
-
-func TestUpdate(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- c.Delete("nonexistent", true)
- }()
-
- resp, err := c.Set("foo", "bar", 5)
-
- if err != nil {
- t.Fatal(err)
- }
-
- // This should succeed.
- resp, err = c.Update("foo", "wakawaka", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Action == "update" && resp.Node.Key == "/foo" && resp.Node.TTL == 5) {
- t.Fatalf("Update 1 failed: %#v", resp)
- }
- if !(resp.PrevNode.Key == "/foo" && resp.PrevNode.Value == "bar" && resp.Node.TTL == 5) {
- t.Fatalf("Update 1 prevValue failed: %#v", resp)
- }
-
- // This should fail because the key does not exist.
- resp, err = c.Update("nonexistent", "whatever", 5)
- if err == nil {
- t.Fatalf("The key %v did not exist, so the update should have failed."+
- "The response was: %#v", resp.Node.Key, resp)
- }
-}
-
-func TestCreate(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("newKey", true)
- }()
-
- newKey := "/newKey"
- newValue := "/newValue"
-
- // This should succeed
- resp, err := c.Create(newKey, newValue, 5)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Action == "create" && resp.Node.Key == newKey &&
- resp.Node.Value == newValue && resp.Node.TTL == 5) {
- t.Fatalf("Create 1 failed: %#v", resp)
- }
- if resp.PrevNode != nil {
- t.Fatalf("Create 1 PrevNode failed: %#v", resp)
- }
-
- // This should fail, because the key is already there
- resp, err = c.Create(newKey, newValue, 5)
- if err == nil {
- t.Fatalf("The key %v did exist, so the creation should have failed."+
- "The response was: %#v", resp.Node.Key, resp)
- }
-}
-
-func TestCreateInOrder(t *testing.T) {
- c := NewClient(nil)
- dir := "/queue"
- defer func() {
- c.DeleteDir(dir)
- }()
-
- var firstKey, secondKey string
-
- resp, err := c.CreateInOrder(dir, "1", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Action == "create" && resp.Node.Value == "1" && resp.Node.TTL == 5) {
- t.Fatalf("Create 1 failed: %#v", resp)
- }
-
- firstKey = resp.Node.Key
-
- resp, err = c.CreateInOrder(dir, "2", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Action == "create" && resp.Node.Value == "2" && resp.Node.TTL == 5) {
- t.Fatalf("Create 2 failed: %#v", resp)
- }
-
- secondKey = resp.Node.Key
-
- if firstKey >= secondKey {
- t.Fatalf("Expected first key to be greater than second key, but %s is not greater than %s",
- firstKey, secondKey)
- }
-}
-
-func TestSetDir(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("foo", true)
- c.Delete("fooDir", true)
- }()
-
- resp, err := c.CreateDir("fooDir", 5)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Key == "/fooDir" && resp.Node.Value == "" && resp.Node.TTL == 5) {
- t.Fatalf("SetDir 1 failed: %#v", resp)
- }
- if resp.PrevNode != nil {
- t.Fatalf("SetDir 1 PrevNode failed: %#v", resp)
- }
-
- // This should fail because /fooDir already points to a directory
- resp, err = c.CreateDir("/fooDir", 5)
- if err == nil {
- t.Fatalf("fooDir already points to a directory, so SetDir should have failed."+
- "The response was: %#v", resp)
- }
-
- _, err = c.Set("foo", "bar", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- // This should succeed
- // It should replace the key
- resp, err = c.SetDir("foo", 5)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Key == "/foo" && resp.Node.Value == "" && resp.Node.TTL == 5) {
- t.Fatalf("SetDir 2 failed: %#v", resp)
- }
- if !(resp.PrevNode.Key == "/foo" && resp.PrevNode.Value == "bar" && resp.PrevNode.TTL == 5) {
- t.Fatalf("SetDir 2 failed: %#v", resp)
- }
-}
-
-func TestUpdateDir(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("fooDir", true)
- }()
-
- resp, err := c.CreateDir("fooDir", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- // This should succeed.
- resp, err = c.UpdateDir("fooDir", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Action == "update" && resp.Node.Key == "/fooDir" &&
- resp.Node.Value == "" && resp.Node.TTL == 5) {
- t.Fatalf("UpdateDir 1 failed: %#v", resp)
- }
- if !(resp.PrevNode.Key == "/fooDir" && resp.PrevNode.Dir == true && resp.PrevNode.TTL == 5) {
- t.Fatalf("UpdateDir 1 PrevNode failed: %#v", resp)
- }
-
- // This should fail because the key does not exist.
- resp, err = c.UpdateDir("nonexistentDir", 5)
- if err == nil {
- t.Fatalf("The key %v did not exist, so the update should have failed."+
- "The response was: %#v", resp.Node.Key, resp)
- }
-}
-
-func TestCreateDir(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("fooDir", true)
- }()
-
- // This should succeed
- resp, err := c.CreateDir("fooDir", 5)
- if err != nil {
- t.Fatal(err)
- }
-
- if !(resp.Action == "create" && resp.Node.Key == "/fooDir" &&
- resp.Node.Value == "" && resp.Node.TTL == 5) {
- t.Fatalf("CreateDir 1 failed: %#v", resp)
- }
- if resp.PrevNode != nil {
- t.Fatalf("CreateDir 1 PrevNode failed: %#v", resp)
- }
-
- // This should fail, because the key is already there
- resp, err = c.CreateDir("fooDir", 5)
- if err == nil {
- t.Fatalf("The key %v did exist, so the creation should have failed."+
- "The response was: %#v", resp.Node.Key, resp)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/watch_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/watch_test.go
deleted file mode 100644
index 43e1dfeb81f..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/watch_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package etcd
-
-import (
- "fmt"
- "runtime"
- "testing"
- "time"
-)
-
-func TestWatch(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("watch_foo", true)
- }()
-
- go setHelper("watch_foo", "bar", c)
-
- resp, err := c.Watch("watch_foo", 0, false, nil, nil)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Key == "/watch_foo" && resp.Node.Value == "bar") {
- t.Fatalf("Watch 1 failed: %#v", resp)
- }
-
- go setHelper("watch_foo", "bar", c)
-
- resp, err = c.Watch("watch_foo", resp.Node.ModifiedIndex+1, false, nil, nil)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Key == "/watch_foo" && resp.Node.Value == "bar") {
- t.Fatalf("Watch 2 failed: %#v", resp)
- }
-
- routineNum := runtime.NumGoroutine()
-
- ch := make(chan *Response, 10)
- stop := make(chan bool, 1)
-
- go setLoop("watch_foo", "bar", c)
-
- go receiver(ch, stop)
-
- _, err = c.Watch("watch_foo", 0, false, ch, stop)
- if err != ErrWatchStoppedByUser {
- t.Fatalf("Watch returned a non-user stop error")
- }
-
- if newRoutineNum := runtime.NumGoroutine(); newRoutineNum != routineNum {
- t.Fatalf("Routine numbers differ after watch stop: %v, %v", routineNum, newRoutineNum)
- }
-}
-
-func TestWatchAll(t *testing.T) {
- c := NewClient(nil)
- defer func() {
- c.Delete("watch_foo", true)
- }()
-
- go setHelper("watch_foo/foo", "bar", c)
-
- resp, err := c.Watch("watch_foo", 0, true, nil, nil)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Key == "/watch_foo/foo" && resp.Node.Value == "bar") {
- t.Fatalf("WatchAll 1 failed: %#v", resp)
- }
-
- go setHelper("watch_foo/foo", "bar", c)
-
- resp, err = c.Watch("watch_foo", resp.Node.ModifiedIndex+1, true, nil, nil)
- if err != nil {
- t.Fatal(err)
- }
- if !(resp.Node.Key == "/watch_foo/foo" && resp.Node.Value == "bar") {
- t.Fatalf("WatchAll 2 failed: %#v", resp)
- }
-
- ch := make(chan *Response, 10)
- stop := make(chan bool, 1)
-
- routineNum := runtime.NumGoroutine()
-
- go setLoop("watch_foo/foo", "bar", c)
-
- go receiver(ch, stop)
-
- _, err = c.Watch("watch_foo", 0, true, ch, stop)
- if err != ErrWatchStoppedByUser {
- t.Fatalf("Watch returned a non-user stop error")
- }
-
- if newRoutineNum := runtime.NumGoroutine(); newRoutineNum != routineNum {
- t.Fatalf("Routine numbers differ after watch stop: %v, %v", routineNum, newRoutineNum)
- }
-}
-
-func setHelper(key, value string, c *Client) {
- time.Sleep(time.Second)
- c.Set(key, value, 100)
-}
-
-func setLoop(key, value string, c *Client) {
- time.Sleep(time.Second)
- for i := 0; i < 10; i++ {
- newValue := fmt.Sprintf("%s_%v", value, i)
- c.Set(key, newValue, 100)
- time.Sleep(time.Second / 10)
- }
-}
-
-func receiver(c chan *Response, stop chan bool) {
- for i := 0; i < 10; i++ {
- <-c
- }
- stop <- true
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/http/http_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/http/http_test.go
deleted file mode 100644
index 8ec76a246d0..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/http/http_test.go
+++ /dev/null
@@ -1,380 +0,0 @@
-package http
-
-import (
- "net/http"
- "net/url"
- "reflect"
- "strings"
- "testing"
- "time"
-)
-
-func TestCacheControlMaxAgeSuccess(t *testing.T) {
- tests := []struct {
- hdr string
- wantAge time.Duration
- wantOK bool
- }{
- {"max-age=12", 12 * time.Second, true},
- {"max-age=-12", 0, false},
- {"max-age=0", 0, false},
- {"public, max-age=12", 12 * time.Second, true},
- {"public, max-age=40192, must-revalidate", 40192 * time.Second, true},
- {"public, not-max-age=12, must-revalidate", time.Duration(0), false},
- }
-
- for i, tt := range tests {
- maxAge, ok, err := cacheControlMaxAge(tt.hdr)
- if err != nil {
- t.Errorf("case %d: err=%v", i, err)
- }
- if tt.wantAge != maxAge {
- t.Errorf("case %d: want=%d got=%d", i, tt.wantAge, maxAge)
- }
- if tt.wantOK != ok {
- t.Errorf("case %d: incorrect ok value: want=%t got=%t", i, tt.wantOK, ok)
- }
- }
-}
-
-func TestCacheControlMaxAgeFail(t *testing.T) {
- tests := []string{
- "max-age=aasdf",
- "max-age=",
- "max-age",
- }
-
- for i, tt := range tests {
- _, ok, err := cacheControlMaxAge(tt)
- if ok {
- t.Errorf("case %d: want ok=false, got true", i)
- }
- if err == nil {
- t.Errorf("case %d: want non-nil err", i)
- }
- }
-}
-
-func TestMergeQuery(t *testing.T) {
- tests := []struct {
- u string
- q url.Values
- w string
- }{
- // No values
- {
- u: "http://example.com",
- q: nil,
- w: "http://example.com",
- },
- // No additional values
- {
- u: "http://example.com?foo=bar",
- q: nil,
- w: "http://example.com?foo=bar",
- },
- // Simple addition
- {
- u: "http://example.com",
- q: url.Values{
- "foo": []string{"bar"},
- },
- w: "http://example.com?foo=bar",
- },
- // Addition with existing values
- {
- u: "http://example.com?dog=boo",
- q: url.Values{
- "foo": []string{"bar"},
- },
- w: "http://example.com?dog=boo&foo=bar",
- },
- // Merge
- {
- u: "http://example.com?dog=boo",
- q: url.Values{
- "dog": []string{"elroy"},
- },
- w: "http://example.com?dog=boo&dog=elroy",
- },
- // Add and merge
- {
- u: "http://example.com?dog=boo",
- q: url.Values{
- "dog": []string{"elroy"},
- "foo": []string{"bar"},
- },
- w: "http://example.com?dog=boo&dog=elroy&foo=bar",
- },
- // Multivalue merge
- {
- u: "http://example.com?dog=boo",
- q: url.Values{
- "dog": []string{"elroy", "penny"},
- },
- w: "http://example.com?dog=boo&dog=elroy&dog=penny",
- },
- }
-
- for i, tt := range tests {
- ur, err := url.Parse(tt.u)
- if err != nil {
- t.Errorf("case %d: failed parsing test url: %v, error: %v", i, tt.u, err)
- }
-
- got := MergeQuery(*ur, tt.q)
- want, err := url.Parse(tt.w)
- if err != nil {
- t.Errorf("case %d: failed parsing want url: %v, error: %v", i, tt.w, err)
- }
-
- if !reflect.DeepEqual(*want, got) {
- t.Errorf("case %d: want: %v, got: %v", i, *want, got)
- }
- }
-}
-
-func TestExpiresPass(t *testing.T) {
- tests := []struct {
- date string
- exp string
- wantTTL time.Duration
- wantOK bool
- }{
- // Expires and Date properly set
- {
- date: "Thu, 01 Dec 1983 22:00:00 GMT",
- exp: "Fri, 02 Dec 1983 01:00:00 GMT",
- wantTTL: 10800 * time.Second,
- wantOK: true,
- },
- // empty headers
- {
- date: "",
- exp: "",
- wantOK: false,
- },
- // lack of Expirs short-ciruits Date parsing
- {
- date: "foo",
- exp: "",
- wantOK: false,
- },
- // lack of Date short-ciruits Expires parsing
- {
- date: "",
- exp: "foo",
- wantOK: false,
- },
- // no Date
- {
- exp: "Thu, 01 Dec 1983 22:00:00 GMT",
- wantTTL: 0,
- wantOK: false,
- },
- // no Expires
- {
- date: "Thu, 01 Dec 1983 22:00:00 GMT",
- wantTTL: 0,
- wantOK: false,
- },
- // Expires < Date
- {
- date: "Fri, 02 Dec 1983 01:00:00 GMT",
- exp: "Thu, 01 Dec 1983 22:00:00 GMT",
- wantTTL: 0,
- wantOK: false,
- },
- }
-
- for i, tt := range tests {
- ttl, ok, err := expires(tt.date, tt.exp)
- if err != nil {
- t.Errorf("case %d: err=%v", i, err)
- }
- if tt.wantTTL != ttl {
- t.Errorf("case %d: want=%d got=%d", i, tt.wantTTL, ttl)
- }
- if tt.wantOK != ok {
- t.Errorf("case %d: incorrect ok value: want=%t got=%t", i, tt.wantOK, ok)
- }
- }
-}
-
-func TestExpiresFail(t *testing.T) {
- tests := []struct {
- date string
- exp string
- }{
- // malformed Date header
- {
- date: "foo",
- exp: "Fri, 02 Dec 1983 01:00:00 GMT",
- },
- // malformed exp header
- {
- date: "Fri, 02 Dec 1983 01:00:00 GMT",
- exp: "bar",
- },
- }
-
- for i, tt := range tests {
- _, _, err := expires(tt.date, tt.exp)
- if err == nil {
- t.Errorf("case %d: expected non-nil error", i)
- }
- }
-}
-
-func TestCacheablePass(t *testing.T) {
- tests := []struct {
- headers http.Header
- wantTTL time.Duration
- wantOK bool
- }{
- // valid Cache-Control
- {
- headers: http.Header{
- "Cache-Control": []string{"max-age=100"},
- },
- wantTTL: 100 * time.Second,
- wantOK: true,
- },
- // valid Date/Expires
- {
- headers: http.Header{
- "Date": []string{"Thu, 01 Dec 1983 22:00:00 GMT"},
- "Expires": []string{"Fri, 02 Dec 1983 01:00:00 GMT"},
- },
- wantTTL: 10800 * time.Second,
- wantOK: true,
- },
- // Cache-Control supersedes Date/Expires
- {
- headers: http.Header{
- "Cache-Control": []string{"max-age=100"},
- "Date": []string{"Thu, 01 Dec 1983 22:00:00 GMT"},
- "Expires": []string{"Fri, 02 Dec 1983 01:00:00 GMT"},
- },
- wantTTL: 100 * time.Second,
- wantOK: true,
- },
- // no caching headers
- {
- headers: http.Header{},
- wantOK: false,
- },
- }
-
- for i, tt := range tests {
- ttl, ok, err := Cacheable(tt.headers)
- if err != nil {
- t.Errorf("case %d: err=%v", i, err)
- continue
- }
- if tt.wantTTL != ttl {
- t.Errorf("case %d: want=%d got=%d", i, tt.wantTTL, ttl)
- }
- if tt.wantOK != ok {
- t.Errorf("case %d: incorrect ok value: want=%t got=%t", i, tt.wantOK, ok)
- }
- }
-}
-
-func TestCacheableFail(t *testing.T) {
- tests := []http.Header{
- // invalid Cache-Control short-circuits
- http.Header{
- "Cache-Control": []string{"max-age"},
- "Date": []string{"Thu, 01 Dec 1983 22:00:00 GMT"},
- "Expires": []string{"Fri, 02 Dec 1983 01:00:00 GMT"},
- },
- // no Cache-Control, invalid Expires
- http.Header{
- "Date": []string{"Thu, 01 Dec 1983 22:00:00 GMT"},
- "Expires": []string{"boo"},
- },
- }
-
- for i, tt := range tests {
- _, _, err := Cacheable(tt)
- if err == nil {
- t.Errorf("case %d: want non-nil err", i)
- }
- }
-}
-
-func TestNewResourceLocation(t *testing.T) {
- tests := []struct {
- ru *url.URL
- id string
- want string
- }{
- {
- ru: &url.URL{
- Scheme: "http",
- Host: "example.com",
- },
- id: "foo",
- want: "http://example.com/foo",
- },
- // https
- {
- ru: &url.URL{
- Scheme: "https",
- Host: "example.com",
- },
- id: "foo",
- want: "https://example.com/foo",
- },
- // with path
- {
- ru: &url.URL{
- Scheme: "http",
- Host: "example.com",
- Path: "one/two/three",
- },
- id: "foo",
- want: "http://example.com/one/two/three/foo",
- },
- // with fragment
- {
- ru: &url.URL{
- Scheme: "http",
- Host: "example.com",
- Fragment: "frag",
- },
- id: "foo",
- want: "http://example.com/foo",
- },
- // with query
- {
- ru: &url.URL{
- Scheme: "http",
- Host: "example.com",
- RawQuery: "dog=elroy",
- },
- id: "foo",
- want: "http://example.com/foo",
- },
- }
-
- for i, tt := range tests {
- got := NewResourceLocation(tt.ru, tt.id)
- if tt.want != got {
- t.Errorf("case %d: want=%s, got=%s", i, tt.want, got)
- }
- }
-}
-
-func TestCopyRequest(t *testing.T) {
- r1, err := http.NewRequest("GET", "http://example.com", strings.NewReader("foo"))
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- r2 := CopyRequest(r1)
- if !reflect.DeepEqual(r1, r2) {
- t.Fatalf("Result of CopyRequest incorrect: %#v != %#v", r1, r2)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/http/url_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/http/url_test.go
deleted file mode 100644
index 2ab250523f7..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/http/url_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package http
-
-import (
- "net/url"
- "testing"
-)
-
-func TestParseNonEmptyURL(t *testing.T) {
- tests := []struct {
- u string
- ok bool
- }{
- {"", false},
- {"http://", false},
- {"example.com", false},
- {"example", false},
- {"http://example", true},
- {"http://example:1234", true},
- {"http://example.com", true},
- {"http://example.com:1234", true},
- }
-
- for i, tt := range tests {
- u, err := ParseNonEmptyURL(tt.u)
- if err != nil {
- t.Logf("err: %v", err)
- if tt.ok {
- t.Errorf("case %d: unexpected error: %v", i, err)
- } else {
- continue
- }
- }
-
- if !tt.ok {
- t.Errorf("case %d: expected error but got none", i)
- continue
- }
-
- uu, err := url.Parse(tt.u)
- if err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- continue
- }
-
- if uu.String() != u.String() {
- t.Errorf("case %d: incorrect url value, want: %q, got: %q", i, uu.String(), u.String())
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/claims_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/claims_test.go
deleted file mode 100644
index 55e245c07df..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/claims_test.go
+++ /dev/null
@@ -1,240 +0,0 @@
-package jose
-
-import (
- "testing"
- "time"
-)
-
-func TestString(t *testing.T) {
- tests := []struct {
- cl Claims
- key string
- ok bool
- err bool
- val string
- }{
- // ok, no err, claim exists
- {
- cl: Claims{
- "foo": "bar",
- },
- key: "foo",
- val: "bar",
- ok: true,
- err: false,
- },
- // no claims
- {
- cl: Claims{},
- key: "foo",
- val: "",
- ok: false,
- err: false,
- },
- // missing claim
- {
- cl: Claims{
- "foo": "bar",
- },
- key: "xxx",
- val: "",
- ok: false,
- err: false,
- },
- // unparsable: type
- {
- cl: Claims{
- "foo": struct{}{},
- },
- key: "foo",
- val: "",
- ok: false,
- err: true,
- },
- // unparsable: nil value
- {
- cl: Claims{
- "foo": nil,
- },
- key: "foo",
- val: "",
- ok: false,
- err: true,
- },
- }
-
- for i, tt := range tests {
- val, ok, err := tt.cl.StringClaim(tt.key)
-
- if tt.err && err == nil {
- t.Errorf("case %d: want err=non-nil, got err=nil", i)
- } else if !tt.err && err != nil {
- t.Errorf("case %d: want err=nil, got err=%v", i, err)
- }
-
- if tt.ok != ok {
- t.Errorf("case %d: want ok=%v, got ok=%v", i, tt.ok, ok)
- }
-
- if tt.val != val {
- t.Errorf("case %d: want val=%v, got val=%v", i, tt.val, val)
- }
- }
-}
-
-func TestInt64(t *testing.T) {
- tests := []struct {
- cl Claims
- key string
- ok bool
- err bool
- val int64
- }{
- // ok, no err, claim exists
- {
- cl: Claims{
- "foo": int64(100),
- },
- key: "foo",
- val: int64(100),
- ok: true,
- err: false,
- },
- // no claims
- {
- cl: Claims{},
- key: "foo",
- val: 0,
- ok: false,
- err: false,
- },
- // missing claim
- {
- cl: Claims{
- "foo": "bar",
- },
- key: "xxx",
- val: 0,
- ok: false,
- err: false,
- },
- // unparsable: type
- {
- cl: Claims{
- "foo": struct{}{},
- },
- key: "foo",
- val: 0,
- ok: false,
- err: true,
- },
- // unparsable: nil value
- {
- cl: Claims{
- "foo": nil,
- },
- key: "foo",
- val: 0,
- ok: false,
- err: true,
- },
- }
-
- for i, tt := range tests {
- val, ok, err := tt.cl.Int64Claim(tt.key)
-
- if tt.err && err == nil {
- t.Errorf("case %d: want err=non-nil, got err=nil", i)
- } else if !tt.err && err != nil {
- t.Errorf("case %d: want err=nil, got err=%v", i, err)
- }
-
- if tt.ok != ok {
- t.Errorf("case %d: want ok=%v, got ok=%v", i, tt.ok, ok)
- }
-
- if tt.val != val {
- t.Errorf("case %d: want val=%v, got val=%v", i, tt.val, val)
- }
- }
-}
-
-func TestTime(t *testing.T) {
- now := time.Now().UTC()
- unixNow := now.Unix()
-
- tests := []struct {
- cl Claims
- key string
- ok bool
- err bool
- val time.Time
- }{
- // ok, no err, claim exists
- {
- cl: Claims{
- "foo": unixNow,
- },
- key: "foo",
- val: time.Unix(now.Unix(), 0).UTC(),
- ok: true,
- err: false,
- },
- // no claims
- {
- cl: Claims{},
- key: "foo",
- val: time.Time{},
- ok: false,
- err: false,
- },
- // missing claim
- {
- cl: Claims{
- "foo": "bar",
- },
- key: "xxx",
- val: time.Time{},
- ok: false,
- err: false,
- },
- // unparsable: type
- {
- cl: Claims{
- "foo": struct{}{},
- },
- key: "foo",
- val: time.Time{},
- ok: false,
- err: true,
- },
- // unparsable: nil value
- {
- cl: Claims{
- "foo": nil,
- },
- key: "foo",
- val: time.Time{},
- ok: false,
- err: true,
- },
- }
-
- for i, tt := range tests {
- val, ok, err := tt.cl.TimeClaim(tt.key)
-
- if tt.err && err == nil {
- t.Errorf("case %d: want err=non-nil, got err=nil", i)
- } else if !tt.err && err != nil {
- t.Errorf("case %d: want err=nil, got err=%v", i, err)
- }
-
- if tt.ok != ok {
- t.Errorf("case %d: want ok=%v, got ok=%v", i, tt.ok, ok)
- }
-
- if tt.val != val {
- t.Errorf("case %d: want val=%v, got val=%v", i, tt.val, val)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jwk_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jwk_test.go
deleted file mode 100644
index 63351c45187..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jwk_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package jose
-
-import (
- "testing"
-)
-
-func TestDecodeBase64URLPaddingOptional(t *testing.T) {
- tests := []struct {
- encoded string
- decoded string
- err bool
- }{
- {
- // With padding
- encoded: "VGVjdG9uaWM=",
- decoded: "Tectonic",
- },
- {
- // Without padding
- encoded: "VGVjdG9uaWM",
- decoded: "Tectonic",
- },
- {
- // Even More padding
- encoded: "VGVjdG9uaQ==",
- decoded: "Tectoni",
- },
- {
- // And take it away!
- encoded: "VGVjdG9uaQ",
- decoded: "Tectoni",
- },
- {
- // Too much padding.
- encoded: "VGVjdG9uaWNh=",
- decoded: "",
- err: true,
- },
- {
- // Too much padding.
- encoded: "VGVjdG9uaWNh=",
- decoded: "",
- err: true,
- },
- }
-
- for i, tt := range tests {
- got, err := decodeBase64URLPaddingOptional(tt.encoded)
- if tt.err {
- if err == nil {
- t.Errorf("case %d: expected non-nil err", i)
- }
- continue
- }
-
- if err != nil {
- t.Errorf("case %d: want nil err, got: %v", i, err)
- }
-
- if string(got) != tt.decoded {
- t.Errorf("case %d: want=%q, got=%q", i, tt.decoded, got)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jws_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jws_test.go
deleted file mode 100644
index 78c8126106b..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jws_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package jose
-
-import (
- "strings"
- "testing"
-)
-
-type testCase struct{ t string }
-
-var validInput []testCase
-
-var invalidInput []testCase
-
-func init() {
- validInput = []testCase{
- {
- "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
- },
- }
-
- invalidInput = []testCase{
- // empty
- {
- "",
- },
- // undecodeable
- {
- "aaa.bbb.ccc",
- },
- // missing parts
- {
- "aaa",
- },
- // missing parts
- {
- "aaa.bbb",
- },
- // too many parts
- {
- "aaa.bbb.ccc.ddd",
- },
- // invalid header
- // EncodeHeader(map[string]string{"foo": "bar"})
- {
- "eyJmb28iOiJiYXIifQ.bbb.ccc",
- },
- }
-}
-
-func TestParseJWS(t *testing.T) {
- for i, tt := range validInput {
- jws, err := ParseJWS(tt.t)
- if err != nil {
- t.Errorf("test: %d. expected: valid, actual: invalid", i)
- }
-
- expectedHeader := strings.Split(tt.t, ".")[0]
- if jws.RawHeader != expectedHeader {
- t.Errorf("test: %d. expected: %s, actual: %s", i, expectedHeader, jws.RawHeader)
- }
-
- expectedPayload := strings.Split(tt.t, ".")[1]
- if jws.RawPayload != expectedPayload {
- t.Errorf("test: %d. expected: %s, actual: %s", i, expectedPayload, jws.RawPayload)
- }
- }
-
- for i, tt := range invalidInput {
- _, err := ParseJWS(tt.t)
- if err == nil {
- t.Errorf("test: %d. expected: invalid, actual: valid", i)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jwt_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jwt_test.go
deleted file mode 100644
index 3a1cd9ae156..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/jwt_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package jose
-
-import (
- "reflect"
- "testing"
-)
-
-func TestParseJWT(t *testing.T) {
- tests := []struct {
- r string
- h JOSEHeader
- c Claims
- }{
- {
- // Example from JWT spec:
- // http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#ExampleJWT
- "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
- JOSEHeader{
- HeaderMediaType: "JWT",
- HeaderKeyAlgorithm: "HS256",
- },
- Claims{
- "iss": "joe",
- // NOTE: test numbers must be floats for equality checks to work since values are converted form interface{} to float64 by default.
- "exp": 1300819380.0,
- "http://example.com/is_root": true,
- },
- },
- }
-
- for i, tt := range tests {
- jwt, err := ParseJWT(tt.r)
- if err != nil {
- t.Errorf("raw token should parse. test: %d. expected: valid, actual: invalid. err=%v", i, err)
- }
-
- if !reflect.DeepEqual(tt.h, jwt.Header) {
- t.Errorf("JOSE headers should match. test: %d. expected: %v, actual: %v", i, tt.h, jwt.Header)
- }
-
- claims, err := jwt.Claims()
- if err != nil {
- t.Errorf("test: %d. expected: valid claim parsing. err=%v", i, err)
- }
- if !reflect.DeepEqual(tt.c, claims) {
- t.Errorf("claims should match. test: %d. expected: %v, actual: %v", i, tt.c, claims)
- }
-
- enc := jwt.Encode()
- if enc != tt.r {
- t.Errorf("encoded jwt should match raw jwt. test: %d. expected: %v, actual: %v", i, tt.r, enc)
- }
- }
-}
-
-func TestNewJWTHeaderTyp(t *testing.T) {
- jwt, err := NewJWT(JOSEHeader{}, Claims{})
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- want := "JWT"
- got := jwt.Header[HeaderMediaType]
- if want != got {
- t.Fatalf("Header %q incorrect: want=%s got=%s", HeaderMediaType, want, got)
- }
-
-}
-
-func TestNewJWTHeaderKeyID(t *testing.T) {
- jwt, err := NewJWT(JOSEHeader{HeaderKeyID: "foo"}, Claims{})
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- want := "foo"
- got, ok := jwt.KeyID()
- if !ok {
- t.Fatalf("KeyID not set")
- } else if want != got {
- t.Fatalf("KeyID incorrect: want=%s got=%s", want, got)
- }
-}
-
-func TestNewJWTHeaderKeyIDNotSet(t *testing.T) {
- jwt, err := NewJWT(JOSEHeader{}, Claims{})
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- if _, ok := jwt.KeyID(); ok {
- t.Fatalf("KeyID set, but should not be")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/sig_hmac_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/sig_hmac_test.go
deleted file mode 100644
index 76c6722fd42..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/jose/sig_hmac_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package jose
-
-import (
- "bytes"
- "encoding/base64"
- "testing"
-)
-
-var hmacTestCases = []struct {
- data string
- sig string
- jwk JWK
- valid bool
- desc string
-}{
- {
- "test",
- "Aymga2LNFrM-tnkr6MYLFY2Jou46h2_Omogeu0iMCRQ=",
- JWK{
- ID: "fake-key",
- Alg: "HS256",
- Secret: []byte("secret"),
- },
- true,
- "valid case",
- },
- {
- "test",
- "Aymga2LNFrM-tnkr6MYLFY2Jou46h2_Omogeu0iMCRQ=",
- JWK{
- ID: "different-key",
- Alg: "HS256",
- Secret: []byte("secret"),
- },
- true,
- "invalid: different key, should not match",
- },
- {
- "test sig and non-matching data",
- "Aymga2LNFrM-tnkr6MYLFY2Jou46h2_Omogeu0iMCRQ=",
- JWK{
- ID: "fake-key",
- Alg: "HS256",
- Secret: []byte("secret"),
- },
- false,
- "invalid: sig and data should not match",
- },
-}
-
-func TestVerify(t *testing.T) {
- for _, tt := range hmacTestCases {
- v, err := NewVerifierHMAC(tt.jwk)
- if err != nil {
- t.Errorf("should construct hmac verifier. test: %s. err=%v", tt.desc, err)
- }
-
- decSig, _ := base64.URLEncoding.DecodeString(tt.sig)
- err = v.Verify(decSig, []byte(tt.data))
- if err == nil && !tt.valid {
- t.Errorf("verify failure. test: %s. expected: invalid, actual: valid.", tt.desc)
- }
- if err != nil && tt.valid {
- t.Errorf("verify failure. test: %s. expected: valid, actual: invalid. err=%v", tt.desc, err)
- }
- }
-}
-
-func TestSign(t *testing.T) {
- for _, tt := range hmacTestCases {
- s := NewSignerHMAC("test", tt.jwk.Secret)
- sig, err := s.Sign([]byte(tt.data))
- if err != nil {
- t.Errorf("sign failure. test: %s. err=%v", tt.desc, err)
- }
-
- expSig, _ := base64.URLEncoding.DecodeString(tt.sig)
- if tt.valid && !bytes.Equal(sig, expSig) {
- t.Errorf("sign failure. test: %s. expected: %s, actual: %s.", tt.desc, tt.sig, base64.URLEncoding.EncodeToString(sig))
- }
- if !tt.valid && bytes.Equal(sig, expSig) {
- t.Errorf("sign failure. test: %s. expected: invalid signature.", tt.desc)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/key_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/key/key_test.go
deleted file mode 100644
index d4985151369..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/key_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package key
-
-import (
- "crypto/rsa"
- "math/big"
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/go-oidc/jose"
-)
-
-func TestPrivateRSAKeyJWK(t *testing.T) {
- n := big.NewInt(int64(17))
- if n == nil {
- panic("NewInt returned nil")
- }
-
- k := &PrivateKey{
- KeyID: "foo",
- PrivateKey: &rsa.PrivateKey{
- PublicKey: rsa.PublicKey{N: n, E: 65537},
- },
- }
-
- want := jose.JWK{
- ID: "foo",
- Type: "RSA",
- Alg: "RS256",
- Use: "sig",
- Modulus: n,
- Exponent: 65537,
- }
-
- got := k.JWK()
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("JWK mismatch: want=%#v got=%#v", want, got)
- }
-}
-
-func TestPublicKeySetKey(t *testing.T) {
- n := big.NewInt(int64(17))
- if n == nil {
- panic("NewInt returned nil")
- }
-
- k := jose.JWK{
- ID: "foo",
- Type: "RSA",
- Alg: "RS256",
- Use: "sig",
- Modulus: n,
- Exponent: 65537,
- }
- now := time.Now().UTC()
- ks := NewPublicKeySet([]jose.JWK{k}, now)
-
- want := &PublicKey{jwk: k}
- got := ks.Key("foo")
- if !reflect.DeepEqual(want, got) {
- t.Errorf("Unexpected response from PublicKeySet.Key: want=%#v got=%#v", want, got)
- }
-
- got = ks.Key("bar")
- if got != nil {
- t.Errorf("Expected nil response from PublicKeySet.Key, got %#v", got)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/manager_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/key/manager_test.go
deleted file mode 100644
index f3c753e7cc0..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/manager_test.go
+++ /dev/null
@@ -1,225 +0,0 @@
-package key
-
-import (
- "crypto/rsa"
- "math/big"
- "reflect"
- "strconv"
- "testing"
- "time"
-
- "github.com/jonboulle/clockwork"
-
- "github.com/coreos/go-oidc/jose"
-)
-
-var (
- jwk1 jose.JWK
- jwk2 jose.JWK
- jwk3 jose.JWK
-)
-
-func init() {
- jwk1 = jose.JWK{
- ID: "1",
- Type: "RSA",
- Alg: "RS256",
- Use: "sig",
- Modulus: big.NewInt(1),
- Exponent: 65537,
- }
-
- jwk2 = jose.JWK{
- ID: "2",
- Type: "RSA",
- Alg: "RS256",
- Use: "sig",
- Modulus: big.NewInt(2),
- Exponent: 65537,
- }
-
- jwk3 = jose.JWK{
- ID: "3",
- Type: "RSA",
- Alg: "RS256",
- Use: "sig",
- Modulus: big.NewInt(3),
- Exponent: 65537,
- }
-}
-
-func generatePrivateKeyStatic(t *testing.T, idAndN int) *PrivateKey {
- n := big.NewInt(int64(idAndN))
- if n == nil {
- t.Fatalf("Call to NewInt(%d) failed", idAndN)
- }
-
- pk := &rsa.PrivateKey{
- PublicKey: rsa.PublicKey{N: n, E: 65537},
- }
-
- return &PrivateKey{
- KeyID: strconv.Itoa(idAndN),
- PrivateKey: pk,
- }
-}
-
-func TestPrivateKeyManagerJWKsRotate(t *testing.T) {
- k1 := generatePrivateKeyStatic(t, 1)
- k2 := generatePrivateKeyStatic(t, 2)
- k3 := generatePrivateKeyStatic(t, 3)
- km := NewPrivateKeyManager()
- err := km.Set(&PrivateKeySet{
- keys: []*PrivateKey{k1, k2, k3},
- ActiveKeyID: k1.KeyID,
- expiresAt: time.Now().Add(time.Minute),
- })
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- want := []jose.JWK{jwk1, jwk2, jwk3}
- got, err := km.JWKs()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("JWK mismatch: want=%#v got=%#v", want, got)
- }
-}
-
-func TestPrivateKeyManagerSigner(t *testing.T) {
- k := generatePrivateKeyStatic(t, 13)
-
- km := NewPrivateKeyManager()
- err := km.Set(&PrivateKeySet{
- keys: []*PrivateKey{k},
- ActiveKeyID: k.KeyID,
- expiresAt: time.Now().Add(time.Minute),
- })
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- signer, err := km.Signer()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- wantID := "13"
- gotID := signer.ID()
- if wantID != gotID {
- t.Fatalf("Signer has incorrect ID: want=%s got=%s", wantID, gotID)
- }
-}
-
-func TestPrivateKeyManagerHealthyFail(t *testing.T) {
- keyFixture := generatePrivateKeyStatic(t, 1)
- tests := []*privateKeyManager{
- // keySet nil
- &privateKeyManager{
- keySet: nil,
- clock: clockwork.NewRealClock(),
- },
- // zero keys
- &privateKeyManager{
- keySet: &PrivateKeySet{
- keys: []*PrivateKey{},
- expiresAt: time.Now().Add(time.Minute),
- },
- clock: clockwork.NewRealClock(),
- },
- // key set expired
- &privateKeyManager{
- keySet: &PrivateKeySet{
- keys: []*PrivateKey{keyFixture},
- expiresAt: time.Now().Add(-1 * time.Minute),
- },
- clock: clockwork.NewRealClock(),
- },
- }
-
- for i, tt := range tests {
- if err := tt.Healthy(); err == nil {
- t.Errorf("case %d: nil error", i)
- }
- }
-}
-
-func TestPrivateKeyManagerHealthyFailsOtherMethods(t *testing.T) {
- km := NewPrivateKeyManager()
- if _, err := km.JWKs(); err == nil {
- t.Fatalf("Expected non-nil error")
- }
- if _, err := km.Signer(); err == nil {
- t.Fatalf("Expected non-nil error")
- }
-}
-
-func TestPrivateKeyManagerExpiresAt(t *testing.T) {
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
-
- k := generatePrivateKeyStatic(t, 17)
- km := &privateKeyManager{
- clock: fc,
- }
-
- want := fc.Now().UTC()
- got := km.ExpiresAt()
- if want != got {
- t.Fatalf("Incorrect expiration time: want=%v got=%v", want, got)
- }
-
- err := km.Set(&PrivateKeySet{
- keys: []*PrivateKey{k},
- ActiveKeyID: k.KeyID,
- expiresAt: now.Add(2 * time.Minute),
- })
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- want = fc.Now().UTC().Add(2 * time.Minute)
- got = km.ExpiresAt()
- if want != got {
- t.Fatalf("Incorrect expiration time: want=%v got=%v", want, got)
- }
-}
-
-func TestPublicKeys(t *testing.T) {
- km := NewPrivateKeyManager()
- k1 := generatePrivateKeyStatic(t, 1)
- k2 := generatePrivateKeyStatic(t, 2)
- k3 := generatePrivateKeyStatic(t, 3)
-
- tests := [][]*PrivateKey{
- []*PrivateKey{k1},
- []*PrivateKey{k1, k2},
- []*PrivateKey{k1, k2, k3},
- }
-
- for i, tt := range tests {
- ks := &PrivateKeySet{
- keys: tt,
- expiresAt: time.Now().Add(time.Hour),
- }
- km.Set(ks)
-
- jwks, err := km.JWKs()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- pks := NewPublicKeySet(jwks, time.Now().Add(time.Hour))
- want := pks.Keys()
- got, err := km.PublicKeys()
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- if !reflect.DeepEqual(want, got) {
- t.Errorf("case %d: Invalid public keys: want=%v got=%v", i, want, got)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/rotate_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/key/rotate_test.go
deleted file mode 100644
index 394a84f0291..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/rotate_test.go
+++ /dev/null
@@ -1,311 +0,0 @@
-package key
-
-import (
- "reflect"
- "testing"
- "time"
-
- "github.com/jonboulle/clockwork"
-)
-
-func generatePrivateKeySerialFunc(t *testing.T) GeneratePrivateKeyFunc {
- var n int
- return func() (*PrivateKey, error) {
- n++
- return generatePrivateKeyStatic(t, n), nil
- }
-}
-
-func TestRotate(t *testing.T) {
- now := time.Now()
- k1 := generatePrivateKeyStatic(t, 1)
- k2 := generatePrivateKeyStatic(t, 2)
- k3 := generatePrivateKeyStatic(t, 3)
-
- tests := []struct {
- start *PrivateKeySet
- key *PrivateKey
- keep int
- exp time.Time
- want *PrivateKeySet
- }{
- // start with nil keys
- {
- start: nil,
- key: k1,
- keep: 2,
- exp: now.Add(time.Second),
- want: &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now.Add(time.Second),
- },
- },
- // start with zero keys
- {
- start: &PrivateKeySet{},
- key: k1,
- keep: 2,
- exp: now.Add(time.Second),
- want: &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now.Add(time.Second),
- },
- },
- // add second key
- {
- start: &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now,
- },
- key: k2,
- keep: 2,
- exp: now.Add(time.Second),
- want: &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(time.Second),
- },
- },
- // rotate in third key
- {
- start: &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now,
- },
- key: k3,
- keep: 2,
- exp: now.Add(time.Second),
- want: &PrivateKeySet{
- keys: []*PrivateKey{k3, k2},
- ActiveKeyID: k3.KeyID,
- expiresAt: now.Add(time.Second),
- },
- },
- }
-
- for i, tt := range tests {
- repo := NewPrivateKeySetRepo()
- if tt.start != nil {
- err := repo.Set(tt.start)
- if err != nil {
- log.Fatalf("case %d: unexpected error: %v", i, err)
- }
- }
-
- rotatePrivateKeys(repo, tt.key, tt.keep, tt.exp)
- got, err := repo.Get()
- if err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- continue
- }
- if !reflect.DeepEqual(tt.want, got) {
- t.Errorf("case %d: unexpected result: want=%#v got=%#v", i, tt.want, got)
- }
- }
-}
-
-func TestPrivateKeyRotatorRun(t *testing.T) {
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
-
- k1 := generatePrivateKeyStatic(t, 1)
- k2 := generatePrivateKeyStatic(t, 2)
- k3 := generatePrivateKeyStatic(t, 3)
- k4 := generatePrivateKeyStatic(t, 4)
-
- kRepo := NewPrivateKeySetRepo()
- krot := NewPrivateKeyRotator(kRepo, 4*time.Second)
- krot.clock = fc
- krot.generateKey = generatePrivateKeySerialFunc(t)
-
- steps := []*PrivateKeySet{
- &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now.Add(4 * time.Second),
- },
- &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(6 * time.Second),
- },
- &PrivateKeySet{
- keys: []*PrivateKey{k3, k2},
- ActiveKeyID: k3.KeyID,
- expiresAt: now.Add(8 * time.Second),
- },
- &PrivateKeySet{
- keys: []*PrivateKey{k4, k3},
- ActiveKeyID: k4.KeyID,
- expiresAt: now.Add(10 * time.Second),
- },
- }
-
- stop := krot.Run()
- defer close(stop)
-
- for i, st := range steps {
- // wait for the rotater to get sleepy
- fc.BlockUntil(1)
-
- got, err := kRepo.Get()
- if err != nil {
- t.Fatalf("step %d: unexpected error: %v", i, err)
- }
- if !reflect.DeepEqual(st, got) {
- t.Fatalf("step %d: unexpected state: want=%#v got=%#v", i, st, got)
- }
- fc.Advance(2 * time.Second)
- }
-}
-
-func TestPrivateKeyRotatorExpiresAt(t *testing.T) {
- fc := clockwork.NewFakeClock()
- krot := &PrivateKeyRotator{
- clock: fc,
- ttl: time.Minute,
- }
- got := krot.expiresAt()
- want := fc.Now().UTC().Add(time.Minute)
- if !reflect.DeepEqual(want, got) {
- t.Errorf("Incorrect expiration time: want=%v got=%v", want, got)
- }
-}
-
-func TestNextRotation(t *testing.T) {
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
-
- tests := []struct {
- expiresAt time.Time
- ttl time.Duration
- numKeys int
- expected time.Duration
- }{
- {
- // closest to prod
- expiresAt: now.Add(time.Hour * 24),
- ttl: time.Hour * 24,
- numKeys: 2,
- expected: time.Hour * 12,
- },
- {
- expiresAt: now.Add(time.Hour * 2),
- ttl: time.Hour * 4,
- numKeys: 2,
- expected: 0,
- },
- {
- // No keys.
- expiresAt: now.Add(time.Hour * 2),
- ttl: time.Hour * 4,
- numKeys: 0,
- expected: 0,
- },
- {
- // Nil keyset.
- expiresAt: now.Add(time.Hour * 2),
- ttl: time.Hour * 4,
- numKeys: -1,
- expected: 0,
- },
- {
- // KeySet expired.
- expiresAt: now.Add(time.Hour * -2),
- ttl: time.Hour * 4,
- numKeys: 2,
- expected: 0,
- },
- {
- // Expiry past now + TTL
- expiresAt: now.Add(time.Hour * 5),
- ttl: time.Hour * 4,
- numKeys: 2,
- expected: 3 * time.Hour,
- },
- }
-
- for i, tt := range tests {
- kRepo := NewPrivateKeySetRepo()
- krot := NewPrivateKeyRotator(kRepo, tt.ttl)
- krot.clock = fc
- pks := &PrivateKeySet{
- expiresAt: tt.expiresAt,
- }
- if tt.numKeys != -1 {
- for n := 0; n < tt.numKeys; n++ {
- pks.keys = append(pks.keys, generatePrivateKeyStatic(t, n))
- }
- err := kRepo.Set(pks)
- if err != nil {
- log.Fatalf("case %d: unexpected error: %v", i, err)
- }
-
- }
- actual, err := krot.nextRotation()
- if err != nil {
- t.Errorf("case %d: error calling shouldRotate(): %v", i, err)
- }
- if actual != tt.expected {
- t.Errorf("case %d: actual == %v, want %v", i, actual, tt.expected)
- }
- }
-}
-
-func TestHealthy(t *testing.T) {
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
-
- tests := []struct {
- expiresAt time.Time
- numKeys int
- expected error
- }{
- {
- expiresAt: now.Add(time.Hour),
- numKeys: 2,
- expected: nil,
- },
- {
- expiresAt: now.Add(time.Hour),
- numKeys: -1,
- expected: ErrorNoKeys,
- },
- {
- expiresAt: now.Add(time.Hour),
- numKeys: 0,
- expected: ErrorNoKeys,
- },
- {
- expiresAt: now.Add(-time.Hour),
- numKeys: 2,
- expected: ErrorPrivateKeysExpired,
- },
- }
-
- for i, tt := range tests {
- kRepo := NewPrivateKeySetRepo()
- krot := NewPrivateKeyRotator(kRepo, time.Hour)
- krot.clock = fc
- pks := &PrivateKeySet{
- expiresAt: tt.expiresAt,
- }
- if tt.numKeys != -1 {
- for n := 0; n < tt.numKeys; n++ {
- pks.keys = append(pks.keys, generatePrivateKeyStatic(t, n))
- }
- err := kRepo.Set(pks)
- if err != nil {
- log.Fatalf("case %d: unexpected error: %v", i, err)
- }
-
- }
- if err := krot.Healthy(); err != tt.expected {
- t.Errorf("case %d: got==%q, want==%q", i, err, tt.expected)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/sync_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/key/sync_test.go
deleted file mode 100644
index ec8ef7369e5..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/key/sync_test.go
+++ /dev/null
@@ -1,205 +0,0 @@
-package key
-
-import (
- "errors"
- "reflect"
- "testing"
- "time"
-
- "github.com/jonboulle/clockwork"
-)
-
-type staticReadableKeySetRepo struct {
- ks KeySet
- err error
-}
-
-func (r *staticReadableKeySetRepo) Get() (KeySet, error) {
- return r.ks, r.err
-}
-
-func TestKeySyncerSync(t *testing.T) {
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
-
- k1 := generatePrivateKeyStatic(t, 1)
- k2 := generatePrivateKeyStatic(t, 2)
- k3 := generatePrivateKeyStatic(t, 3)
-
- steps := []struct {
- fromKS KeySet
- fromErr error
- advance time.Duration
- want *PrivateKeySet
- }{
- // on startup, first sync should trigger within a second
- {
- fromKS: &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now.Add(10 * time.Second),
- },
- advance: time.Second,
- want: &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now.Add(10 * time.Second),
- },
- },
- // advance halfway into TTL, triggering sync
- {
- fromKS: &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(15 * time.Second),
- },
- advance: 5 * time.Second,
- want: &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(15 * time.Second),
- },
- },
-
- // advance halfway into TTL, triggering sync that fails
- {
- fromErr: errors.New("fail!"),
- advance: 10 * time.Second,
- want: &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(15 * time.Second),
- },
- },
-
- // sync retries quickly, and succeeds with fixed data
- {
- fromKS: &PrivateKeySet{
- keys: []*PrivateKey{k3, k2, k1},
- ActiveKeyID: k3.KeyID,
- expiresAt: now.Add(25 * time.Second),
- },
- advance: 3 * time.Second,
- want: &PrivateKeySet{
- keys: []*PrivateKey{k3, k2, k1},
- ActiveKeyID: k3.KeyID,
- expiresAt: now.Add(25 * time.Second),
- },
- },
- }
-
- from := &staticReadableKeySetRepo{}
- to := NewPrivateKeySetRepo()
-
- syncer := NewKeySetSyncer(from, to)
- syncer.clock = fc
- stop := syncer.Run()
- defer close(stop)
-
- for i, st := range steps {
- from.ks = st.fromKS
- from.err = st.fromErr
-
- fc.Advance(st.advance)
- fc.BlockUntil(1)
-
- ks, err := to.Get()
- if err != nil {
- t.Fatalf("step %d: unable to get keys: %v", i, err)
- }
- if !reflect.DeepEqual(st.want, ks) {
- t.Fatalf("step %d: incorrect state: want=%#v got=%#v", i, st.want, ks)
- }
- }
-}
-
-func TestSync(t *testing.T) {
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
-
- k1 := generatePrivateKeyStatic(t, 1)
- k2 := generatePrivateKeyStatic(t, 2)
- k3 := generatePrivateKeyStatic(t, 3)
-
- tests := []struct {
- keySet *PrivateKeySet
- want time.Duration
- }{
- {
- keySet: &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now.Add(time.Minute),
- },
- want: time.Minute,
- },
- {
- keySet: &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(time.Minute),
- },
- want: time.Minute,
- },
- {
- keySet: &PrivateKeySet{
- keys: []*PrivateKey{k3, k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(time.Minute),
- },
- want: time.Minute,
- },
- {
- keySet: &PrivateKeySet{
- keys: []*PrivateKey{k2, k1},
- ActiveKeyID: k2.KeyID,
- expiresAt: now.Add(time.Hour),
- },
- want: time.Hour,
- },
- {
- keySet: &PrivateKeySet{
- keys: []*PrivateKey{k1},
- ActiveKeyID: k1.KeyID,
- expiresAt: now.Add(-time.Hour),
- },
- want: 0,
- },
- }
-
- for i, tt := range tests {
- from := NewPrivateKeySetRepo()
- to := NewPrivateKeySetRepo()
-
- err := from.Set(tt.keySet)
- if err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- continue
- }
- exp, err := sync(from, to, fc)
- if err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- continue
- }
-
- if tt.want != exp {
- t.Errorf("case %d: want=%v got=%v", i, tt.want, exp)
- }
- }
-}
-
-func TestSyncFail(t *testing.T) {
- tests := []error{
- nil,
- errors.New("fail!"),
- }
-
- for i, tt := range tests {
- from := &staticReadableKeySetRepo{ks: nil, err: tt}
- to := NewPrivateKeySetRepo()
-
- if _, err := sync(from, to, clockwork.NewFakeClock()); err == nil {
- t.Errorf("case %d: expected non-nil error", i)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oauth2/error_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oauth2/error_test.go
deleted file mode 100644
index 41174893b53..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oauth2/error_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package oauth2
-
-import (
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestUnmarshalError(t *testing.T) {
- tests := []struct {
- b []byte
- e *Error
- o bool
- }{
- {
- b: []byte("{ \"error\": \"invalid_client\", \"state\": \"foo\" }"),
- e: &Error{Type: ErrorInvalidClient, State: "foo"},
- o: true,
- },
- {
- b: []byte("{ \"error\": \"invalid_grant\", \"state\": \"bar\" }"),
- e: &Error{Type: ErrorInvalidGrant, State: "bar"},
- o: true,
- },
- {
- b: []byte("{ \"error\": \"invalid_request\", \"state\": \"\" }"),
- e: &Error{Type: ErrorInvalidRequest, State: ""},
- o: true,
- },
- {
- b: []byte("{ \"error\": \"server_error\", \"state\": \"elroy\" }"),
- e: &Error{Type: ErrorServerError, State: "elroy"},
- o: true,
- },
- {
- b: []byte("{ \"error\": \"unsupported_grant_type\", \"state\": \"\" }"),
- e: &Error{Type: ErrorUnsupportedGrantType, State: ""},
- o: true,
- },
- {
- b: []byte("{ \"error\": \"unsupported_response_type\", \"state\": \"\" }"),
- e: &Error{Type: ErrorUnsupportedResponseType, State: ""},
- o: true,
- },
- // Should fail json unmarshal
- {
- b: nil,
- e: nil,
- o: false,
- },
- {
- b: []byte("random string"),
- e: nil,
- o: false,
- },
- }
-
- for i, tt := range tests {
- err := unmarshalError(tt.b)
- oerr, ok := err.(*Error)
-
- if ok != tt.o {
- t.Errorf("%v != %v, %v", ok, tt.o, oerr)
- t.Errorf("case %d: want=%+v, got=%+v", i, tt.e, oerr)
- }
-
- if ok && !reflect.DeepEqual(tt.e, oerr) {
- t.Errorf("case %d: want=%+v, got=%+v", i, tt.e, oerr)
- }
-
- if !ok && tt.e != nil {
- want := fmt.Sprintf("unrecognized error: %s", string(tt.b))
- got := tt.e.Error()
- if want != got {
- t.Errorf("case %d: want=%+v, got=%+v", i, want, got)
- }
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oauth2/oauth2_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oauth2/oauth2_test.go
deleted file mode 100644
index 9e5fd9a3606..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oauth2/oauth2_test.go
+++ /dev/null
@@ -1,262 +0,0 @@
-package oauth2
-
-import (
- "errors"
- "net/url"
- "reflect"
- "strings"
- "testing"
-
- phttp "github.com/coreos/go-oidc/http"
-)
-
-func TestParseAuthCodeRequest(t *testing.T) {
- tests := []struct {
- query url.Values
- wantACR AuthCodeRequest
- wantErr error
- }{
- // no redirect_uri
- {
- query: url.Values{
- "response_type": []string{"code"},
- "scope": []string{"foo bar baz"},
- "client_id": []string{"XXX"},
- "state": []string{"pants"},
- },
- wantACR: AuthCodeRequest{
- ResponseType: "code",
- ClientID: "XXX",
- Scope: []string{"foo", "bar", "baz"},
- State: "pants",
- RedirectURL: nil,
- },
- },
-
- // with redirect_uri
- {
- query: url.Values{
- "response_type": []string{"code"},
- "redirect_uri": []string{"https://127.0.0.1:5555/callback?foo=bar"},
- "scope": []string{"foo bar baz"},
- "client_id": []string{"XXX"},
- "state": []string{"pants"},
- },
- wantACR: AuthCodeRequest{
- ResponseType: "code",
- ClientID: "XXX",
- Scope: []string{"foo", "bar", "baz"},
- State: "pants",
- RedirectURL: &url.URL{
- Scheme: "https",
- Host: "127.0.0.1:5555",
- Path: "/callback",
- RawQuery: "foo=bar",
- },
- },
- },
-
- // unsupported response_type doesn't trigger error
- {
- query: url.Values{
- "response_type": []string{"token"},
- "redirect_uri": []string{"https://127.0.0.1:5555/callback?foo=bar"},
- "scope": []string{"foo bar baz"},
- "client_id": []string{"XXX"},
- "state": []string{"pants"},
- },
- wantACR: AuthCodeRequest{
- ResponseType: "token",
- ClientID: "XXX",
- Scope: []string{"foo", "bar", "baz"},
- State: "pants",
- RedirectURL: &url.URL{
- Scheme: "https",
- Host: "127.0.0.1:5555",
- Path: "/callback",
- RawQuery: "foo=bar",
- },
- },
- },
-
- // unparseable redirect_uri
- {
- query: url.Values{
- "response_type": []string{"code"},
- "redirect_uri": []string{":"},
- "scope": []string{"foo bar baz"},
- "client_id": []string{"XXX"},
- "state": []string{"pants"},
- },
- wantACR: AuthCodeRequest{
- ResponseType: "code",
- ClientID: "XXX",
- Scope: []string{"foo", "bar", "baz"},
- State: "pants",
- },
- wantErr: NewError(ErrorInvalidRequest),
- },
-
- // no client_id, redirect_uri not parsed
- {
- query: url.Values{
- "response_type": []string{"code"},
- "redirect_uri": []string{"https://127.0.0.1:5555/callback?foo=bar"},
- "scope": []string{"foo bar baz"},
- "client_id": []string{},
- "state": []string{"pants"},
- },
- wantACR: AuthCodeRequest{
- ResponseType: "code",
- ClientID: "",
- Scope: []string{"foo", "bar", "baz"},
- State: "pants",
- RedirectURL: nil,
- },
- wantErr: NewError(ErrorInvalidRequest),
- },
- }
-
- for i, tt := range tests {
- got, err := ParseAuthCodeRequest(tt.query)
- if !reflect.DeepEqual(tt.wantErr, err) {
- t.Errorf("case %d: incorrect error value: want=%q got=%q", i, tt.wantErr, err)
- }
-
- if !reflect.DeepEqual(tt.wantACR, got) {
- t.Errorf("case %d: incorrect AuthCodeRequest value: want=%#v got=%#v", i, tt.wantACR, got)
- }
- }
-}
-
-func TestClientCredsToken(t *testing.T) {
- hc := &phttp.RequestRecorder{Error: errors.New("error")}
- cfg := Config{
- Credentials: ClientCredentials{ID: "cid", Secret: "csecret"},
- Scope: []string{"foo-scope", "bar-scope"},
- TokenURL: "http://example.com/token",
- AuthMethod: AuthMethodClientSecretBasic,
- RedirectURL: "http://example.com/redirect",
- AuthURL: "http://example.com/auth",
- }
-
- c, err := NewClient(hc, cfg)
- if err != nil {
- t.Errorf("unexpected error %v", err)
- }
-
- scope := []string{"openid"}
- c.ClientCredsToken(scope)
- if hc.Request == nil {
- t.Error("request is empty")
- }
-
- tu := hc.Request.URL.String()
- if cfg.TokenURL != tu {
- t.Errorf("wrong token url, want=%v, got=%v", cfg.TokenURL, tu)
- }
-
- ct := hc.Request.Header.Get("Content-Type")
- if ct != "application/x-www-form-urlencoded" {
- t.Errorf("wrong content-type, want=application/x-www-form-urlencoded, got=%v", ct)
- }
-
- cid, secret, ok := phttp.BasicAuth(hc.Request)
- if !ok {
- t.Error("unexpected error parsing basic auth")
- }
-
- if cfg.Credentials.ID != cid {
- t.Errorf("wrong client ID, want=%v, got=%v", cfg.Credentials.ID, cid)
- }
-
- if cfg.Credentials.Secret != secret {
- t.Errorf("wrong client secret, want=%v, got=%v", cfg.Credentials.Secret, secret)
- }
-
- err = hc.Request.ParseForm()
- if err != nil {
- t.Error("unexpected error parsing form")
- }
-
- gt := hc.Request.PostForm.Get("grant_type")
- if gt != GrantTypeClientCreds {
- t.Errorf("wrong grant_type, want=client_credentials, got=%v", gt)
- }
-
- sc := strings.Split(hc.Request.PostForm.Get("scope"), " ")
- if !reflect.DeepEqual(scope, sc) {
- t.Errorf("wrong scope, want=%v, got=%v", scope, sc)
- }
-}
-
-func TestNewAuthenticatedRequest(t *testing.T) {
- tests := []struct {
- authMethod string
- url string
- values url.Values
- }{
- {
- authMethod: AuthMethodClientSecretBasic,
- url: "http://example.com/token",
- values: url.Values{},
- },
- {
- authMethod: AuthMethodClientSecretPost,
- url: "http://example.com/token",
- values: url.Values{},
- },
- }
-
- for i, tt := range tests {
- hc := &phttp.HandlerClient{}
- cfg := Config{
- Credentials: ClientCredentials{ID: "cid", Secret: "csecret"},
- Scope: []string{"foo-scope", "bar-scope"},
- TokenURL: "http://example.com/token",
- AuthURL: "http://example.com/auth",
- RedirectURL: "http://example.com/redirect",
- AuthMethod: tt.authMethod,
- }
- c, err := NewClient(hc, cfg)
- req, err := c.newAuthenticatedRequest(tt.url, tt.values)
- if err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- continue
- }
- err = req.ParseForm()
- if err != nil {
- t.Errorf("case %d: want nil err, got %v", i, err)
- }
-
- if tt.authMethod == AuthMethodClientSecretBasic {
- cid, secret, ok := phttp.BasicAuth(req)
- if !ok {
- t.Errorf("case %d: !ok parsing Basic Auth headers", i)
- continue
- }
- if cid != cfg.Credentials.ID {
- t.Errorf("case %d: want CID == %q, got CID == %q", i, cfg.Credentials.ID, cid)
- }
- if secret != cfg.Credentials.Secret {
- t.Errorf("case %d: want secret == %q, got secret == %q", i, cfg.Credentials.Secret, secret)
- }
- } else if tt.authMethod == AuthMethodClientSecretPost {
- if req.PostFormValue("client_secret") != cfg.Credentials.Secret {
- t.Errorf("case %d: want client_secret == %q, got client_secret == %q",
- i, cfg.Credentials.Secret, req.PostFormValue("client_secret"))
- }
- }
-
- for k, v := range tt.values {
- if !reflect.DeepEqual(v, req.PostForm[k]) {
- t.Errorf("case %d: key:%q want==%q, got==%q", i, k, v, req.PostForm[k])
- }
- }
-
- if req.URL.String() != tt.url {
- t.Errorf("case %d: want URL==%q, got URL==%q", i, tt.url, req.URL.String())
- }
-
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/client_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/client_test.go
deleted file mode 100644
index e66688fc2d8..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/client_test.go
+++ /dev/null
@@ -1,367 +0,0 @@
-package oidc
-
-import (
- "net/url"
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/go-oidc/jose"
- "github.com/coreos/go-oidc/key"
- "github.com/coreos/go-oidc/oauth2"
-)
-
-func TestNewClientScopeDefault(t *testing.T) {
- tests := []struct {
- c ClientConfig
- e []string
- }{
- {
- // No scope
- c: ClientConfig{RedirectURL: "http://example.com/redirect"},
- e: DefaultScope,
- },
- {
- // Nil scope
- c: ClientConfig{RedirectURL: "http://example.com/redirect", Scope: nil},
- e: DefaultScope,
- },
- {
- // Empty scope
- c: ClientConfig{RedirectURL: "http://example.com/redirect", Scope: []string{}},
- e: []string{},
- },
- {
- // Custom scope equal to default
- c: ClientConfig{RedirectURL: "http://example.com/redirect", Scope: []string{"openid", "email", "profile"}},
- e: DefaultScope,
- },
- {
- // Custom scope not including defaults
- c: ClientConfig{RedirectURL: "http://example.com/redirect", Scope: []string{"foo", "bar"}},
- e: []string{"foo", "bar"},
- },
- {
- // Custom scopes overlapping with defaults
- c: ClientConfig{RedirectURL: "http://example.com/redirect", Scope: []string{"openid", "foo"}},
- e: []string{"openid", "foo"},
- },
- }
-
- for i, tt := range tests {
- c, err := NewClient(tt.c)
- if err != nil {
- t.Errorf("case %d: unexpected error from NewClient: %v", i, err)
- continue
- }
- if !reflect.DeepEqual(tt.e, c.scope) {
- t.Errorf("case %d: want: %v, got: %v", i, tt.e, c.scope)
- }
- }
-}
-
-func TestHealthy(t *testing.T) {
- now := time.Now().UTC()
-
- tests := []struct {
- c *Client
- h bool
- }{
- // all ok
- {
- c: &Client{
- providerConfig: ProviderConfig{
- Issuer: "http://example.com",
- ExpiresAt: now.Add(time.Hour),
- },
- },
- h: true,
- },
- // zero-value ProviderConfig.ExpiresAt
- {
- c: &Client{
- providerConfig: ProviderConfig{
- Issuer: "http://example.com",
- },
- },
- h: true,
- },
- // expired ProviderConfig
- {
- c: &Client{
- providerConfig: ProviderConfig{
- Issuer: "http://example.com",
- ExpiresAt: now.Add(time.Hour * -1),
- },
- },
- h: false,
- },
- // empty ProviderConfig
- {
- c: &Client{},
- h: false,
- },
- }
-
- for i, tt := range tests {
- err := tt.c.Healthy()
- want := tt.h
- got := (err == nil)
-
- if want != got {
- t.Errorf("case %d: want: healthy=%v, got: healhty=%v, err: %v", i, want, got, err)
- }
- }
-}
-
-func TestClientKeysFuncAll(t *testing.T) {
- priv1, err := key.GeneratePrivateKey()
- if err != nil {
- t.Fatalf("failed to generate private key, error=%v", err)
- }
-
- priv2, err := key.GeneratePrivateKey()
- if err != nil {
- t.Fatalf("failed to generate private key, error=%v", err)
- }
-
- now := time.Now()
- future := now.Add(time.Hour)
- past := now.Add(-1 * time.Hour)
-
- tests := []struct {
- keySet *key.PublicKeySet
- want []key.PublicKey
- }{
- // two keys, non-expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{priv2.JWK(), priv1.JWK()}, future),
- want: []key.PublicKey{*key.NewPublicKey(priv2.JWK()), *key.NewPublicKey(priv1.JWK())},
- },
-
- // no keys, non-expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{}, future),
- want: []key.PublicKey{},
- },
-
- // two keys, expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{priv2.JWK(), priv1.JWK()}, past),
- want: []key.PublicKey{},
- },
-
- // no keys, expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{}, past),
- want: []key.PublicKey{},
- },
- }
-
- for i, tt := range tests {
- var c Client
- c.keySet = *tt.keySet
- keysFunc := c.keysFuncAll()
- got := keysFunc()
- if !reflect.DeepEqual(tt.want, got) {
- t.Errorf("case %d: want=%#v got=%#v", i, tt.want, got)
- }
- }
-}
-
-func TestClientKeysFuncWithID(t *testing.T) {
- priv1, err := key.GeneratePrivateKey()
- if err != nil {
- t.Fatalf("failed to generate private key, error=%v", err)
- }
-
- priv2, err := key.GeneratePrivateKey()
- if err != nil {
- t.Fatalf("failed to generate private key, error=%v", err)
- }
-
- now := time.Now()
- future := now.Add(time.Hour)
- past := now.Add(-1 * time.Hour)
-
- tests := []struct {
- keySet *key.PublicKeySet
- argID string
- want []key.PublicKey
- }{
- // two keys, match, non-expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{priv2.JWK(), priv1.JWK()}, future),
- argID: priv2.ID(),
- want: []key.PublicKey{*key.NewPublicKey(priv2.JWK())},
- },
-
- // two keys, no match, non-expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{priv2.JWK(), priv1.JWK()}, future),
- argID: "XXX",
- want: []key.PublicKey{},
- },
-
- // no keys, no match, non-expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{}, future),
- argID: priv2.ID(),
- want: []key.PublicKey{},
- },
-
- // two keys, match, expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{priv2.JWK(), priv1.JWK()}, past),
- argID: priv2.ID(),
- want: []key.PublicKey{},
- },
-
- // no keys, no match, expired set
- {
- keySet: key.NewPublicKeySet([]jose.JWK{}, past),
- argID: priv2.ID(),
- want: []key.PublicKey{},
- },
- }
-
- for i, tt := range tests {
- var c Client
- c.keySet = *tt.keySet
- keysFunc := c.keysFuncWithID(tt.argID)
- got := keysFunc()
- if !reflect.DeepEqual(tt.want, got) {
- t.Errorf("case %d: want=%#v got=%#v", i, tt.want, got)
- }
- }
-}
-
-func TestClientMetadataValid(t *testing.T) {
- tests := []ClientMetadata{
- // one RedirectURL
- ClientMetadata{
- RedirectURLs: []url.URL{url.URL{Scheme: "http", Host: "example.com"}},
- },
-
- // one RedirectURL w/ nonempty path
- ClientMetadata{
- RedirectURLs: []url.URL{url.URL{Scheme: "http", Host: "example.com", Path: "/foo"}},
- },
-
- // two RedirectURLs
- ClientMetadata{
- RedirectURLs: []url.URL{
- url.URL{Scheme: "http", Host: "foo.example.com"},
- url.URL{Scheme: "http", Host: "bar.example.com"},
- },
- },
- }
-
- for i, tt := range tests {
- if err := tt.Valid(); err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- }
- }
-}
-
-func TestClientMetadataInvalid(t *testing.T) {
- tests := []ClientMetadata{
- // nil RedirectURls slice
- ClientMetadata{
- RedirectURLs: nil,
- },
-
- // empty RedirectURLs slice
- ClientMetadata{
- RedirectURLs: []url.URL{},
- },
-
- // empty url.URL
- ClientMetadata{
- RedirectURLs: []url.URL{url.URL{}},
- },
-
- // empty url.URL following OK item
- ClientMetadata{
- RedirectURLs: []url.URL{url.URL{Scheme: "http", Host: "example.com"}, url.URL{}},
- },
-
- // url.URL with empty Host
- ClientMetadata{
- RedirectURLs: []url.URL{url.URL{Scheme: "http", Host: ""}},
- },
-
- // url.URL with empty Scheme
- ClientMetadata{
- RedirectURLs: []url.URL{url.URL{Scheme: "", Host: "example.com"}},
- },
-
- // url.URL with non-HTTP(S) Scheme
- ClientMetadata{
- RedirectURLs: []url.URL{url.URL{Scheme: "tcp", Host: "127.0.0.1"}},
- },
- }
-
- for i, tt := range tests {
- if err := tt.Valid(); err == nil {
- t.Errorf("case %d: expected non-nil error", i)
- }
- }
-}
-
-func TestChooseAuthMethod(t *testing.T) {
- tests := []struct {
- supported []string
- chosen string
- err bool
- }{
- {
- supported: []string{},
- chosen: oauth2.AuthMethodClientSecretBasic,
- },
- {
- supported: []string{oauth2.AuthMethodClientSecretBasic},
- chosen: oauth2.AuthMethodClientSecretBasic,
- },
- {
- supported: []string{oauth2.AuthMethodClientSecretPost},
- chosen: oauth2.AuthMethodClientSecretPost,
- },
- {
- supported: []string{oauth2.AuthMethodClientSecretPost, oauth2.AuthMethodClientSecretBasic},
- chosen: oauth2.AuthMethodClientSecretPost,
- },
- {
- supported: []string{oauth2.AuthMethodClientSecretBasic, oauth2.AuthMethodClientSecretPost},
- chosen: oauth2.AuthMethodClientSecretBasic,
- },
- {
- supported: []string{oauth2.AuthMethodClientSecretJWT, oauth2.AuthMethodClientSecretPost},
- chosen: oauth2.AuthMethodClientSecretPost,
- },
- {
- supported: []string{oauth2.AuthMethodClientSecretJWT},
- chosen: "",
- err: true,
- },
- }
-
- for i, tt := range tests {
- client := Client{
- providerConfig: ProviderConfig{
- TokenEndpointAuthMethodsSupported: tt.supported,
- },
- }
- got, err := client.chooseAuthMethod()
- if tt.err {
- if err == nil {
- t.Errorf("case %d: expected non-nil err", i)
- }
- continue
- }
-
- if got != tt.chosen {
- t.Errorf("case %d: want=%q, got=%q", i, tt.chosen, got)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/identity_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/identity_test.go
deleted file mode 100644
index d286c669393..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/identity_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package oidc
-
-import (
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/go-oidc/jose"
-)
-
-func TestIdentityFromClaims(t *testing.T) {
- tests := []struct {
- claims jose.Claims
- want Identity
- }{
- {
- claims: jose.Claims{
- "sub": "123850281",
- "name": "Elroy",
- "email": "elroy@example.com",
- "exp": float64(1.416935146e+09),
- },
- want: Identity{
- ID: "123850281",
- Name: "",
- Email: "elroy@example.com",
- ExpiresAt: time.Date(2014, time.November, 25, 17, 05, 46, 0, time.UTC),
- },
- },
- {
- claims: jose.Claims{
- "sub": "123850281",
- "name": "Elroy",
- "exp": float64(1.416935146e+09),
- },
- want: Identity{
- ID: "123850281",
- Name: "",
- Email: "",
- ExpiresAt: time.Date(2014, time.November, 25, 17, 05, 46, 0, time.UTC),
- },
- },
- {
- claims: jose.Claims{
- "sub": "123850281",
- "name": "Elroy",
- "email": "elroy@example.com",
- "exp": int64(1416935146),
- },
- want: Identity{
- ID: "123850281",
- Name: "",
- Email: "elroy@example.com",
- ExpiresAt: time.Date(2014, time.November, 25, 17, 05, 46, 0, time.UTC),
- },
- },
- {
- claims: jose.Claims{
- "sub": "123850281",
- "name": "Elroy",
- "email": "elroy@example.com",
- },
- want: Identity{
- ID: "123850281",
- Name: "",
- Email: "elroy@example.com",
- ExpiresAt: time.Time{},
- },
- },
- }
-
- for i, tt := range tests {
- got, err := IdentityFromClaims(tt.claims)
- if err != nil {
- t.Errorf("case %d: unexpected error: %v", i, err)
- continue
- }
- if !reflect.DeepEqual(tt.want, *got) {
- t.Errorf("case %d: want=%#v got=%#v", i, tt.want, *got)
- }
- }
-}
-
-func TestIdentityFromClaimsFail(t *testing.T) {
- tests := []jose.Claims{
- // sub incorrect type
- jose.Claims{
- "sub": 123,
- "name": "foo",
- "email": "elroy@example.com",
- },
- // email incorrect type
- jose.Claims{
- "sub": "123850281",
- "name": "Elroy",
- "email": false,
- },
- // exp incorrect type
- jose.Claims{
- "sub": "123850281",
- "name": "Elroy",
- "email": "elroy@example.com",
- "exp": "2014-11-25 18:05:46 +0000 UTC",
- },
- }
-
- for i, tt := range tests {
- _, err := IdentityFromClaims(tt)
- if err == nil {
- t.Errorf("case %d: expected non-nil error", i)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/provider_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/provider_test.go
deleted file mode 100644
index 83f139ef0c9..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/provider_test.go
+++ /dev/null
@@ -1,466 +0,0 @@
-package oidc
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "io/ioutil"
- "net/http"
- "reflect"
- "testing"
- "time"
-
- "github.com/jonboulle/clockwork"
-
- phttp "github.com/coreos/go-oidc/http"
- "github.com/coreos/go-oidc/oauth2"
-)
-
-type fakeProviderConfigGetterSetter struct {
- cfg *ProviderConfig
- getCount int
- setCount int
-}
-
-func (g *fakeProviderConfigGetterSetter) Get() (ProviderConfig, error) {
- g.getCount++
- return *g.cfg, nil
-}
-
-func (g *fakeProviderConfigGetterSetter) Set(cfg ProviderConfig) error {
- g.cfg = &cfg
- g.setCount++
- return nil
-}
-
-type fakeProviderConfigHandler struct {
- cfg ProviderConfig
- maxAge time.Duration
-}
-
-func (s *fakeProviderConfigHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- b, _ := json.Marshal(s.cfg)
- if s.maxAge.Seconds() >= 0 {
- w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%d", int(s.maxAge.Seconds())))
- }
- w.Header().Set("Content-Type", "application/json")
- w.Write(b)
-}
-
-func TestHTTPProviderConfigGetter(t *testing.T) {
- svr := &fakeProviderConfigHandler{}
- hc := &phttp.HandlerClient{Handler: svr}
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
-
- tests := []struct {
- dsc string
- age time.Duration
- cfg ProviderConfig
- ok bool
- }{
- // everything is good
- {
- dsc: "https://example.com",
- age: time.Minute,
- cfg: ProviderConfig{
- Issuer: "https://example.com",
- ExpiresAt: now.Add(time.Minute),
- },
- ok: true,
- },
- // iss and disco url differ by scheme only (how google works)
- {
- dsc: "https://example.com",
- age: time.Minute,
- cfg: ProviderConfig{
- Issuer: "example.com",
- ExpiresAt: now.Add(time.Minute),
- },
- ok: true,
- },
- // issuer and discovery URL mismatch
- {
- dsc: "https://foo.com",
- age: time.Minute,
- cfg: ProviderConfig{
- Issuer: "https://example.com",
- ExpiresAt: now.Add(time.Minute),
- },
- ok: false,
- },
- // missing cache header results in zero ExpiresAt
- {
- dsc: "https://example.com",
- age: -1,
- cfg: ProviderConfig{
- Issuer: "https://example.com",
- },
- ok: true,
- },
- }
-
- for i, tt := range tests {
- svr.cfg = tt.cfg
- svr.maxAge = tt.age
- getter := NewHTTPProviderConfigGetter(hc, tt.dsc)
- getter.clock = fc
-
- got, err := getter.Get()
- if err != nil {
- if tt.ok {
- t.Fatalf("test %d: unexpected error: %v", i, err)
- }
- continue
- }
-
- if !tt.ok {
- t.Fatalf("test %d: expected error", i)
- continue
- }
-
- if !reflect.DeepEqual(tt.cfg, got) {
- t.Fatalf("test %d: want: %#v, got: %#v", i, tt.cfg, got)
- }
- }
-}
-
-func TestProviderConfigSyncerRun(t *testing.T) {
- c1 := &ProviderConfig{
- Issuer: "http://first.example.com",
- }
- c2 := &ProviderConfig{
- Issuer: "http://second.example.com",
- }
-
- tests := []struct {
- first *ProviderConfig
- advance time.Duration
- second *ProviderConfig
- firstExp time.Duration
- secondExp time.Duration
- count int
- }{
- // exp is 10m, should have same config after 1s
- {
- first: c1,
- firstExp: time.Duration(10 * time.Minute),
- advance: time.Minute,
- second: c1,
- secondExp: time.Duration(10 * time.Minute),
- count: 1,
- },
- // exp is 10m, should have new config after 10/2 = 5m
- {
- first: c1,
- firstExp: time.Duration(10 * time.Minute),
- advance: time.Duration(5 * time.Minute),
- second: c2,
- secondExp: time.Duration(10 * time.Minute),
- count: 2,
- },
- // exp is 20m, should have new config after 20/2 = 10m
- {
- first: c1,
- firstExp: time.Duration(20 * time.Minute),
- advance: time.Duration(10 * time.Minute),
- second: c2,
- secondExp: time.Duration(30 * time.Minute),
- count: 2,
- },
- }
-
- assertCfg := func(i int, to *fakeProviderConfigGetterSetter, want ProviderConfig) {
- got, err := to.Get()
- if err != nil {
- t.Fatalf("test %d: unable to get config: %v", i, err)
- }
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("test %d: incorrect state:\nwant=%#v\ngot=%#v", i, want, got)
- }
- }
-
- for i, tt := range tests {
- from := &fakeProviderConfigGetterSetter{}
- to := &fakeProviderConfigGetterSetter{}
-
- fc := clockwork.NewFakeClock()
- now := fc.Now().UTC()
- syncer := NewProviderConfigSyncer(from, to)
- syncer.clock = fc
-
- tt.first.ExpiresAt = now.Add(tt.firstExp)
- tt.second.ExpiresAt = now.Add(tt.secondExp)
- if err := from.Set(*tt.first); err != nil {
- t.Fatalf("test %d: unexpected error: %v", i, err)
- }
-
- stop := syncer.Run()
- defer close(stop)
- fc.BlockUntil(1)
-
- // first sync
- assertCfg(i, to, *tt.first)
-
- if err := from.Set(*tt.second); err != nil {
- t.Fatalf("test %d: unexpected error: %v", i, err)
- }
-
- fc.Advance(tt.advance)
- fc.BlockUntil(1)
-
- // second sync
- assertCfg(i, to, *tt.second)
-
- if tt.count != from.getCount {
- t.Fatalf("test %d: want: %v, got: %v", i, tt.count, from.getCount)
- }
- }
-}
-
-type staticProviderConfigGetter struct {
- cfg ProviderConfig
- err error
-}
-
-func (g *staticProviderConfigGetter) Get() (ProviderConfig, error) {
- return g.cfg, g.err
-}
-
-type staticProviderConfigSetter struct {
- cfg *ProviderConfig
- err error
-}
-
-func (s *staticProviderConfigSetter) Set(cfg ProviderConfig) error {
- s.cfg = &cfg
- return s.err
-}
-
-func TestProviderConfigSyncerSyncFailure(t *testing.T) {
- fc := clockwork.NewFakeClock()
-
- tests := []struct {
- from *staticProviderConfigGetter
- to *staticProviderConfigSetter
-
- // want indicates what ProviderConfig should be passed to Set.
- // If nil, the Set should not be called.
- want *ProviderConfig
- }{
- // generic Get failure
- {
- from: &staticProviderConfigGetter{err: errors.New("fail")},
- to: &staticProviderConfigSetter{},
- want: nil,
- },
- // generic Set failure
- {
- from: &staticProviderConfigGetter{cfg: ProviderConfig{ExpiresAt: fc.Now().Add(time.Minute)}},
- to: &staticProviderConfigSetter{err: errors.New("fail")},
- want: &ProviderConfig{ExpiresAt: fc.Now().Add(time.Minute)},
- },
- }
-
- for i, tt := range tests {
- pcs := &ProviderConfigSyncer{
- from: tt.from,
- to: tt.to,
- clock: fc,
- }
- _, err := pcs.sync()
- if err == nil {
- t.Errorf("case %d: expected non-nil error", i)
- }
- if !reflect.DeepEqual(tt.want, tt.to.cfg) {
- t.Errorf("case %d: Set mismatch: want=%#v got=%#v", i, tt.want, tt.to.cfg)
- }
- }
-}
-
-func TestNextSyncAfter(t *testing.T) {
- fc := clockwork.NewFakeClock()
-
- tests := []struct {
- exp time.Time
- want time.Duration
- }{
- {
- exp: fc.Now().Add(time.Hour),
- want: 30 * time.Minute,
- },
- // override large values with the maximum
- {
- exp: fc.Now().Add(168 * time.Hour), // one week
- want: 24 * time.Hour,
- },
- // override "now" values with the minimum
- {
- exp: fc.Now(),
- want: time.Minute,
- },
- // override negative values with the minimum
- {
- exp: fc.Now().Add(-1 * time.Minute),
- want: time.Minute,
- },
- // zero-value Time results in maximum sync interval
- {
- exp: time.Time{},
- want: 24 * time.Hour,
- },
- }
-
- for i, tt := range tests {
- got := nextSyncAfter(tt.exp, fc)
- if tt.want != got {
- t.Errorf("case %d: want=%v got=%v", i, tt.want, got)
- }
- }
-}
-
-func TestProviderConfigEmpty(t *testing.T) {
- cfg := ProviderConfig{}
- if !cfg.Empty() {
- t.Fatalf("Empty provider config reports non-empty")
- }
- cfg = ProviderConfig{Issuer: "http://example.com"}
- if cfg.Empty() {
- t.Fatalf("Non-empty provider config reports empty")
- }
-}
-
-func TestPCSStepAfter(t *testing.T) {
- pass := func() (time.Duration, error) { return 7 * time.Second, nil }
- fail := func() (time.Duration, error) { return 0, errors.New("fail") }
-
- tests := []struct {
- stepper pcsStepper
- stepFunc pcsStepFunc
- want pcsStepper
- }{
- // good step results in retry at TTL
- {
- stepper: &pcsStepNext{},
- stepFunc: pass,
- want: &pcsStepNext{aft: 7 * time.Second},
- },
-
- // good step after failed step results results in retry at TTL
- {
- stepper: &pcsStepRetry{aft: 2 * time.Second},
- stepFunc: pass,
- want: &pcsStepNext{aft: 7 * time.Second},
- },
-
- // failed step results in a retry in 1s
- {
- stepper: &pcsStepNext{},
- stepFunc: fail,
- want: &pcsStepRetry{aft: time.Second},
- },
-
- // failed retry backs off by a factor of 2
- {
- stepper: &pcsStepRetry{aft: time.Second},
- stepFunc: fail,
- want: &pcsStepRetry{aft: 2 * time.Second},
- },
-
- // failed retry backs off by a factor of 2, up to 1m
- {
- stepper: &pcsStepRetry{aft: 32 * time.Second},
- stepFunc: fail,
- want: &pcsStepRetry{aft: 60 * time.Second},
- },
- }
-
- for i, tt := range tests {
- got := tt.stepper.step(tt.stepFunc)
- if !reflect.DeepEqual(tt.want, got) {
- t.Errorf("case %d: want=%#v got=%#v", i, tt.want, got)
- }
- }
-}
-
-func TestProviderConfigSupportsGrantType(t *testing.T) {
- tests := []struct {
- types []string
- typ string
- want bool
- }{
- // explicitly supported
- {
- types: []string{"foo_type"},
- typ: "foo_type",
- want: true,
- },
-
- // explicitly unsupported
- {
- types: []string{"bar_type"},
- typ: "foo_type",
- want: false,
- },
-
- // default type explicitly unsupported
- {
- types: []string{oauth2.GrantTypeImplicit},
- typ: oauth2.GrantTypeAuthCode,
- want: false,
- },
-
- // type not found in default set
- {
- types: []string{},
- typ: "foo_type",
- want: false,
- },
-
- // type found in default set
- {
- types: []string{},
- typ: oauth2.GrantTypeAuthCode,
- want: true,
- },
- }
-
- for i, tt := range tests {
- cfg := ProviderConfig{
- GrantTypesSupported: tt.types,
- }
- got := cfg.SupportsGrantType(tt.typ)
- if tt.want != got {
- t.Errorf("case %d: assert %v supports %v: want=%t got=%t", i, tt.types, tt.typ, tt.want, got)
- }
- }
-}
-
-func TestWaitForProviderConfigImmediateSuccess(t *testing.T) {
- cfg := ProviderConfig{Issuer: "http://example.com"}
- b, err := json.Marshal(cfg)
- if err != nil {
- t.Fatalf("Failed marshaling provider config")
- }
-
- resp := http.Response{Body: ioutil.NopCloser(bytes.NewBuffer(b))}
- hc := &phttp.RequestRecorder{Response: &resp}
- fc := clockwork.NewFakeClock()
-
- reschan := make(chan ProviderConfig)
- go func() {
- reschan <- waitForProviderConfig(hc, cfg.Issuer, fc)
- }()
-
- var got ProviderConfig
- select {
- case got = <-reschan:
- case <-time.After(time.Second):
- t.Fatalf("Did not receive result within 1s")
- }
-
- if !reflect.DeepEqual(cfg, got) {
- t.Fatalf("Received incorrect provider config: want=%#v got=%#v", cfg, got)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/transport_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/transport_test.go
deleted file mode 100644
index 9d5c7eeee10..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/transport_test.go
+++ /dev/null
@@ -1,167 +0,0 @@
-package oidc
-
-import (
- "errors"
- "net/http"
- "reflect"
- "testing"
-
- phttp "github.com/coreos/go-oidc/http"
- "github.com/coreos/go-oidc/jose"
-)
-
-type staticTokenRefresher struct {
- verify func(jose.JWT) error
- refresh func() (jose.JWT, error)
-}
-
-func (s *staticTokenRefresher) Verify(jwt jose.JWT) error {
- return s.verify(jwt)
-}
-
-func (s *staticTokenRefresher) Refresh() (jose.JWT, error) {
- return s.refresh()
-}
-
-func TestAuthenticatedTransportVerifiedJWT(t *testing.T) {
- tests := []struct {
- refresher TokenRefresher
- startJWT jose.JWT
- wantJWT jose.JWT
- wantError error
- }{
- // verification succeeds, so refresh is not called
- {
- refresher: &staticTokenRefresher{
- verify: func(jose.JWT) error { return nil },
- refresh: func() (jose.JWT, error) { return jose.JWT{RawPayload: "2"}, nil },
- },
- startJWT: jose.JWT{RawPayload: "1"},
- wantJWT: jose.JWT{RawPayload: "1"},
- },
-
- // verification fails, refresh succeeds so cached JWT changes
- {
- refresher: &staticTokenRefresher{
- verify: func(jose.JWT) error { return errors.New("fail!") },
- refresh: func() (jose.JWT, error) { return jose.JWT{RawPayload: "2"}, nil },
- },
- startJWT: jose.JWT{RawPayload: "1"},
- wantJWT: jose.JWT{RawPayload: "2"},
- },
-
- // verification succeeds, so failing refresh isn't attempted
- {
- refresher: &staticTokenRefresher{
- verify: func(jose.JWT) error { return nil },
- refresh: func() (jose.JWT, error) { return jose.JWT{}, errors.New("fail!") },
- },
- startJWT: jose.JWT{RawPayload: "1"},
- wantJWT: jose.JWT{RawPayload: "1"},
- },
-
- // verification fails, but refresh fails, too
- {
- refresher: &staticTokenRefresher{
- verify: func(jose.JWT) error { return errors.New("fail!") },
- refresh: func() (jose.JWT, error) { return jose.JWT{}, errors.New("fail!") },
- },
- startJWT: jose.JWT{RawPayload: "1"},
- wantJWT: jose.JWT{},
- wantError: errors.New("unable to acquire valid JWT: fail!"),
- },
- }
-
- for i, tt := range tests {
- at := &AuthenticatedTransport{
- TokenRefresher: tt.refresher,
- jwt: tt.startJWT,
- }
-
- gotJWT, err := at.verifiedJWT()
- if !reflect.DeepEqual(tt.wantError, err) {
- t.Errorf("#%d: unexpected error: want=%#v got=%#v", i, tt.wantError, err)
- }
- if !reflect.DeepEqual(tt.wantJWT, gotJWT) {
- t.Errorf("#%d: incorrect JWT returned from verifiedJWT: want=%#v got=%#v", i, tt.wantJWT, gotJWT)
- }
- }
-}
-
-func TestAuthenticatedTransportJWTCaching(t *testing.T) {
- at := &AuthenticatedTransport{
- TokenRefresher: &staticTokenRefresher{
- verify: func(jose.JWT) error { return errors.New("fail!") },
- refresh: func() (jose.JWT, error) { return jose.JWT{RawPayload: "2"}, nil },
- },
- jwt: jose.JWT{RawPayload: "1"},
- }
-
- wantJWT := jose.JWT{RawPayload: "2"}
- gotJWT, err := at.verifiedJWT()
- if err != nil {
- t.Fatalf("got non-nil error: %#v", err)
- }
- if !reflect.DeepEqual(wantJWT, gotJWT) {
- t.Fatalf("incorrect JWT returned from verifiedJWT: want=%#v got=%#v", wantJWT, gotJWT)
- }
-
- at.TokenRefresher = &staticTokenRefresher{
- verify: func(jose.JWT) error { return nil },
- refresh: func() (jose.JWT, error) { return jose.JWT{RawPayload: "3"}, nil },
- }
-
- // the previous JWT should still be cached on the AuthenticatedTransport since
- // it is still valid, even though there's a new token ready to refresh
- gotJWT, err = at.verifiedJWT()
- if err != nil {
- t.Fatalf("got non-nil error: %#v", err)
- }
- if !reflect.DeepEqual(wantJWT, gotJWT) {
- t.Fatalf("incorrect JWT returned from verifiedJWT: want=%#v got=%#v", wantJWT, gotJWT)
- }
-}
-
-func TestAuthenticatedTransportRoundTrip(t *testing.T) {
- rr := &phttp.RequestRecorder{Response: &http.Response{StatusCode: http.StatusOK}}
- at := &AuthenticatedTransport{
- TokenRefresher: &staticTokenRefresher{
- verify: func(jose.JWT) error { return nil },
- },
- RoundTripper: rr,
- jwt: jose.JWT{RawPayload: "1"},
- }
-
- req := http.Request{}
- _, err := at.RoundTrip(&req)
- if err != nil {
- t.Errorf("unexpected error: %v", err)
- }
-
- if !reflect.DeepEqual(req, http.Request{}) {
- t.Errorf("http.Request object was modified")
- }
-
- want := []string{"Bearer .1."}
- got := rr.Request.Header["Authorization"]
- if !reflect.DeepEqual(want, got) {
- t.Errorf("incorrect Authorization header: want=%#v got=%#v", want, got)
- }
-}
-
-func TestAuthenticatedTransportRoundTripRefreshFail(t *testing.T) {
- rr := &phttp.RequestRecorder{Response: &http.Response{StatusCode: http.StatusOK}}
- at := &AuthenticatedTransport{
- TokenRefresher: &staticTokenRefresher{
- verify: func(jose.JWT) error { return errors.New("fail!") },
- refresh: func() (jose.JWT, error) { return jose.JWT{}, errors.New("fail!") },
- },
- RoundTripper: rr,
- jwt: jose.JWT{RawPayload: "1"},
- }
-
- _, err := at.RoundTrip(&http.Request{})
- if err == nil {
- t.Errorf("expected non-nil error")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/util_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/util_test.go
deleted file mode 100644
index b7e0af767d0..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/util_test.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package oidc
-
-import (
- "fmt"
- "net/http"
- "reflect"
- "testing"
- "time"
-
- "github.com/coreos/go-oidc/jose"
-)
-
-func TestCookieTokenExtractorInvalid(t *testing.T) {
- ckName := "tokenCookie"
- tests := []*http.Cookie{
- &http.Cookie{},
- &http.Cookie{Name: ckName},
- &http.Cookie{Name: ckName, Value: ""},
- }
-
- for i, tt := range tests {
- r, _ := http.NewRequest("", "", nil)
- r.AddCookie(tt)
- _, err := CookieTokenExtractor(ckName)(r)
- if err == nil {
- t.Errorf("case %d: want: error for invalid cookie token, got: no error.", i)
- }
- }
-}
-
-func TestCookieTokenExtractorValid(t *testing.T) {
- validToken := "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
- ckName := "tokenCookie"
- tests := []*http.Cookie{
- &http.Cookie{Name: ckName, Value: "some non-empty value"},
- &http.Cookie{Name: ckName, Value: validToken},
- }
-
- for i, tt := range tests {
- r, _ := http.NewRequest("", "", nil)
- r.AddCookie(tt)
- _, err := CookieTokenExtractor(ckName)(r)
- if err != nil {
- t.Errorf("case %d: want: valid cookie with no error, got: %v", i, err)
- }
- }
-}
-
-func TestExtractBearerTokenInvalid(t *testing.T) {
- tests := []string{"", "x", "Bearer", "xxxxxxx", "Bearer "}
-
- for i, tt := range tests {
- r, _ := http.NewRequest("", "", nil)
- r.Header.Add("Authorization", tt)
- _, err := ExtractBearerToken(r)
- if err == nil {
- t.Errorf("case %d: want: invalid Authorization header, got: valid Authorization header.", i)
- }
- }
-}
-
-func TestExtractBearerTokenValid(t *testing.T) {
- validToken := "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
- tests := []string{
- fmt.Sprintf("Bearer %s", validToken),
- }
-
- for i, tt := range tests {
- r, _ := http.NewRequest("", "", nil)
- r.Header.Add("Authorization", tt)
- _, err := ExtractBearerToken(r)
- if err != nil {
- t.Errorf("case %d: want: valid Authorization header, got: invalid Authorization header: %v.", i, err)
- }
- }
-}
-
-func TestNewClaims(t *testing.T) {
- issAt := time.Date(2, time.January, 1, 0, 0, 0, 0, time.UTC)
- expAt := time.Date(2, time.January, 1, 1, 0, 0, 0, time.UTC)
-
- want := jose.Claims{
- "iss": "https://example.com",
- "sub": "user-123",
- "aud": "client-abc",
- "iat": float64(issAt.Unix()),
- "exp": float64(expAt.Unix()),
- }
-
- got := NewClaims("https://example.com", "user-123", "client-abc", issAt, expAt)
-
- if !reflect.DeepEqual(want, got) {
- t.Fatalf("want=%#v got=%#v", want, got)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/verification_test.go b/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/verification_test.go
deleted file mode 100644
index 5fa694791f1..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-oidc/oidc/verification_test.go
+++ /dev/null
@@ -1,297 +0,0 @@
-package oidc
-
-import (
- "testing"
- "time"
-
- "github.com/coreos/go-oidc/jose"
- "github.com/coreos/go-oidc/key"
-)
-
-func TestVerifyClientClaims(t *testing.T) {
- validIss := "https://example.com"
- validClientID := "valid-client"
- now := time.Now()
- tomorrow := now.Add(24 * time.Hour)
- header := jose.JOSEHeader{
- jose.HeaderKeyAlgorithm: "test-alg",
- jose.HeaderKeyID: "1",
- }
-
- tests := []struct {
- claims jose.Claims
- ok bool
- }{
- // valid token
- {
- claims: jose.Claims{
- "iss": validIss,
- "sub": validClientID,
- "aud": validClientID,
- "iat": float64(now.Unix()),
- "exp": float64(tomorrow.Unix()),
- },
- ok: true,
- },
- // missing 'iss' claim
- {
- claims: jose.Claims{
- "sub": validClientID,
- "aud": validClientID,
- "iat": float64(now.Unix()),
- "exp": float64(tomorrow.Unix()),
- },
- ok: false,
- },
- // invalid 'iss' claim
- {
- claims: jose.Claims{
- "iss": "INVALID",
- "sub": validClientID,
- "aud": validClientID,
- "iat": float64(now.Unix()),
- "exp": float64(tomorrow.Unix()),
- },
- ok: false,
- },
- // missing 'sub' claim
- {
- claims: jose.Claims{
- "iss": validIss,
- "aud": validClientID,
- "iat": float64(now.Unix()),
- "exp": float64(tomorrow.Unix()),
- },
- ok: false,
- },
- // invalid 'sub' claim
- {
- claims: jose.Claims{
- "iss": validIss,
- "sub": "INVALID",
- "aud": validClientID,
- "iat": float64(now.Unix()),
- "exp": float64(tomorrow.Unix()),
- },
- ok: false,
- },
- // missing 'aud' claim
- {
- claims: jose.Claims{
- "iss": validIss,
- "sub": validClientID,
- "iat": float64(now.Unix()),
- "exp": float64(tomorrow.Unix()),
- },
- ok: false,
- },
- // invalid 'aud' claim
- {
- claims: jose.Claims{
- "iss": validIss,
- "sub": validClientID,
- "aud": "INVALID",
- "iat": float64(now.Unix()),
- "exp": float64(tomorrow.Unix()),
- },
- ok: false,
- },
- // expired
- {
- claims: jose.Claims{
- "iss": validIss,
- "sub": validClientID,
- "aud": validClientID,
- "iat": float64(now.Unix()),
- "exp": float64(now.Unix()),
- },
- ok: false,
- },
- }
-
- for i, tt := range tests {
- jwt, err := jose.NewJWT(header, tt.claims)
- if err != nil {
- t.Fatalf("case %d: Failed to generate JWT, error=%v", i, err)
- }
-
- got, err := VerifyClientClaims(jwt, validIss)
- if tt.ok {
- if err != nil {
- t.Errorf("case %d: unexpected error, err=%v", i, err)
- }
- if got != validClientID {
- t.Errorf("case %d: incorrect client ID, want=%s, got=%s", i, validClientID, got)
- }
- } else if err == nil {
- t.Errorf("case %d: expected error but err is nil", i)
- }
- }
-}
-
-func TestJWTVerifier(t *testing.T) {
- iss := "http://example.com"
- now := time.Now()
- future12 := now.Add(12 * time.Hour)
- past36 := now.Add(-36 * time.Hour)
- past12 := now.Add(-12 * time.Hour)
-
- priv1, err := key.GeneratePrivateKey()
- if err != nil {
- t.Fatalf("failed to generate private key, error=%v", err)
- }
- pk1 := *key.NewPublicKey(priv1.JWK())
-
- priv2, err := key.GeneratePrivateKey()
- if err != nil {
- t.Fatalf("failed to generate private key, error=%v", err)
- }
- pk2 := *key.NewPublicKey(priv2.JWK())
-
- jwtPK1, err := jose.NewSignedJWT(NewClaims(iss, "XXX", "XXX", past12, future12), priv1.Signer())
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- jwtPK1BadClaims, err := jose.NewSignedJWT(NewClaims(iss, "XXX", "YYY", past12, future12), priv1.Signer())
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- jwtExpired, err := jose.NewSignedJWT(NewClaims(iss, "XXX", "XXX", past36, past12), priv1.Signer())
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- jwtPK2, err := jose.NewSignedJWT(NewClaims(iss, "XXX", "XXX", past12, future12), priv2.Signer())
- if err != nil {
- t.Fatalf("unexpected error: %v", err)
- }
-
- tests := []struct {
- verifier JWTVerifier
- jwt jose.JWT
- wantErr bool
- }{
- // JWT signed with available key
- {
- verifier: JWTVerifier{
- issuer: "example.com",
- clientID: "XXX",
- syncFunc: func() error { return nil },
- keysFunc: func() []key.PublicKey {
- return []key.PublicKey{pk1}
- },
- },
- jwt: *jwtPK1,
- wantErr: false,
- },
-
- // JWT signed with available key, with bad claims
- {
- verifier: JWTVerifier{
- issuer: "example.com",
- clientID: "XXX",
- syncFunc: func() error { return nil },
- keysFunc: func() []key.PublicKey {
- return []key.PublicKey{pk1}
- },
- },
- jwt: *jwtPK1BadClaims,
- wantErr: true,
- },
-
- // expired JWT signed with available key
- {
- verifier: JWTVerifier{
- issuer: "example.com",
- clientID: "XXX",
- syncFunc: func() error { return nil },
- keysFunc: func() []key.PublicKey {
- return []key.PublicKey{pk1}
- },
- },
- jwt: *jwtExpired,
- wantErr: true,
- },
-
- // JWT signed with unrecognized key, verifiable after sync
- {
- verifier: JWTVerifier{
- issuer: "example.com",
- clientID: "XXX",
- syncFunc: func() error { return nil },
- keysFunc: func() func() []key.PublicKey {
- var i int
- return func() []key.PublicKey {
- defer func() { i++ }()
- return [][]key.PublicKey{
- []key.PublicKey{pk1},
- []key.PublicKey{pk2},
- }[i]
- }
- }(),
- },
- jwt: *jwtPK2,
- wantErr: false,
- },
-
- // JWT signed with unrecognized key, not verifiable after sync
- {
- verifier: JWTVerifier{
- issuer: "example.com",
- clientID: "XXX",
- syncFunc: func() error { return nil },
- keysFunc: func() []key.PublicKey {
- return []key.PublicKey{pk1}
- },
- },
- jwt: *jwtPK2,
- wantErr: true,
- },
-
- // verifier gets no keys from keysFunc, still not verifiable after sync
- {
- verifier: JWTVerifier{
- issuer: "example.com",
- clientID: "XXX",
- syncFunc: func() error { return nil },
- keysFunc: func() []key.PublicKey {
- return []key.PublicKey{}
- },
- },
- jwt: *jwtPK1,
- wantErr: true,
- },
-
- // verifier gets no keys from keysFunc, verifiable after sync
- {
- verifier: JWTVerifier{
- issuer: "example.com",
- clientID: "XXX",
- syncFunc: func() error { return nil },
- keysFunc: func() func() []key.PublicKey {
- var i int
- return func() []key.PublicKey {
- defer func() { i++ }()
- return [][]key.PublicKey{
- []key.PublicKey{},
- []key.PublicKey{pk2},
- }[i]
- }
- }(),
- },
- jwt: *jwtPK2,
- wantErr: false,
- },
- }
-
- for i, tt := range tests {
- err := tt.verifier.Verify(tt.jwt)
- if tt.wantErr && (err == nil) {
- t.Errorf("case %d: wanted non-nil error", i)
- } else if !tt.wantErr && (err != nil) {
- t.Errorf("case %d: wanted nil error, got %v", i, err)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-semver/semver/semver_test.go b/Godeps/_workspace/src/github.com/coreos/go-semver/semver/semver_test.go
deleted file mode 100644
index de09cd7dc0c..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-semver/semver/semver_test.go
+++ /dev/null
@@ -1,187 +0,0 @@
-package semver
-
-import (
- "math/rand"
- "testing"
- "time"
-)
-
-type fixture struct {
- greaterVersion string
- lesserVersion string
-}
-
-var fixtures = []fixture{
- fixture{"0.0.0", "0.0.0-foo"},
- fixture{"0.0.1", "0.0.0"},
- fixture{"1.0.0", "0.9.9"},
- fixture{"0.10.0", "0.9.0"},
- fixture{"0.99.0", "0.10.0"},
- fixture{"2.0.0", "1.2.3"},
- fixture{"0.0.0", "0.0.0-foo"},
- fixture{"0.0.1", "0.0.0"},
- fixture{"1.0.0", "0.9.9"},
- fixture{"0.10.0", "0.9.0"},
- fixture{"0.99.0", "0.10.0"},
- fixture{"2.0.0", "1.2.3"},
- fixture{"0.0.0", "0.0.0-foo"},
- fixture{"0.0.1", "0.0.0"},
- fixture{"1.0.0", "0.9.9"},
- fixture{"0.10.0", "0.9.0"},
- fixture{"0.99.0", "0.10.0"},
- fixture{"2.0.0", "1.2.3"},
- fixture{"1.2.3", "1.2.3-asdf"},
- fixture{"1.2.3", "1.2.3-4"},
- fixture{"1.2.3", "1.2.3-4-foo"},
- fixture{"1.2.3-5-foo", "1.2.3-5"},
- fixture{"1.2.3-5", "1.2.3-4"},
- fixture{"1.2.3-5-foo", "1.2.3-5-Foo"},
- fixture{"3.0.0", "2.7.2+asdf"},
- fixture{"3.0.0+foobar", "2.7.2"},
- fixture{"1.2.3-a.10", "1.2.3-a.5"},
- fixture{"1.2.3-a.b", "1.2.3-a.5"},
- fixture{"1.2.3-a.b", "1.2.3-a"},
- fixture{"1.2.3-a.b.c.10.d.5", "1.2.3-a.b.c.5.d.100"},
- fixture{"1.0.0", "1.0.0-rc.1"},
- fixture{"1.0.0-rc.2", "1.0.0-rc.1"},
- fixture{"1.0.0-rc.1", "1.0.0-beta.11"},
- fixture{"1.0.0-beta.11", "1.0.0-beta.2"},
- fixture{"1.0.0-beta.2", "1.0.0-beta"},
- fixture{"1.0.0-beta", "1.0.0-alpha.beta"},
- fixture{"1.0.0-alpha.beta", "1.0.0-alpha.1"},
- fixture{"1.0.0-alpha.1", "1.0.0-alpha"},
-}
-
-func TestCompare(t *testing.T) {
- for _, v := range fixtures {
- gt, err := NewVersion(v.greaterVersion)
- if err != nil {
- t.Error(err)
- }
-
- lt, err := NewVersion(v.lesserVersion)
- if err != nil {
- t.Error(err)
- }
-
- if gt.LessThan(*lt) == true {
- t.Errorf("%s should not be less than %s", gt, lt)
- }
- }
-}
-
-func testString(t *testing.T, orig string, version *Version) {
- if orig != version.String() {
- t.Errorf("%s != %s", orig, version)
- }
-}
-
-func TestString(t *testing.T) {
- for _, v := range fixtures {
- gt, err := NewVersion(v.greaterVersion)
- if err != nil {
- t.Error(err)
- }
- testString(t, v.greaterVersion, gt)
-
- lt, err := NewVersion(v.lesserVersion)
- if err != nil {
- t.Error(err)
- }
- testString(t, v.lesserVersion, lt)
- }
-}
-
-func shuffleStringSlice(src []string) []string {
- dest := make([]string, len(src))
- rand.Seed(time.Now().Unix())
- perm := rand.Perm(len(src))
- for i, v := range perm {
- dest[v] = src[i]
- }
- return dest
-}
-
-func TestSort(t *testing.T) {
- sortedVersions := []string{"1.0.0", "1.0.2", "1.2.0", "3.1.1"}
- unsortedVersions := shuffleStringSlice(sortedVersions)
-
- semvers := []*Version{}
- for _, v := range unsortedVersions {
- sv, err := NewVersion(v)
- if err != nil {
- t.Fatal(err)
- }
- semvers = append(semvers, sv)
- }
-
- Sort(semvers)
-
- for idx, sv := range semvers {
- if sv.String() != sortedVersions[idx] {
- t.Fatalf("incorrect sort at index %v", idx)
- }
- }
-}
-
-func TestBumpMajor(t *testing.T) {
- version, _ := NewVersion("1.0.0")
- version.BumpMajor()
- if version.Major != 2 {
- t.Fatalf("bumping major on 1.0.0 resulted in %v", version)
- }
-
- version, _ = NewVersion("1.5.2")
- version.BumpMajor()
- if version.Minor != 0 && version.Patch != 0 {
- t.Fatalf("bumping major on 1.5.2 resulted in %v", version)
- }
-
- version, _ = NewVersion("1.0.0+build.1-alpha.1")
- version.BumpMajor()
- if version.PreRelease != "" && version.PreRelease != "" {
- t.Fatalf("bumping major on 1.0.0+build.1-alpha.1 resulted in %v", version)
- }
-}
-
-func TestBumpMinor(t *testing.T) {
- version, _ := NewVersion("1.0.0")
- version.BumpMinor()
-
- if version.Major != 1 {
- t.Fatalf("bumping minor on 1.0.0 resulted in %v", version)
- }
-
- if version.Minor != 1 {
- t.Fatalf("bumping major on 1.0.0 resulted in %v", version)
- }
-
- version, _ = NewVersion("1.0.0+build.1-alpha.1")
- version.BumpMinor()
- if version.PreRelease != "" && version.PreRelease != "" {
- t.Fatalf("bumping major on 1.0.0+build.1-alpha.1 resulted in %v", version)
- }
-}
-
-func TestBumpPatch(t *testing.T) {
- version, _ := NewVersion("1.0.0")
- version.BumpPatch()
-
- if version.Major != 1 {
- t.Fatalf("bumping minor on 1.0.0 resulted in %v", version)
- }
-
- if version.Minor != 0 {
- t.Fatalf("bumping major on 1.0.0 resulted in %v", version)
- }
-
- if version.Patch != 1 {
- t.Fatalf("bumping major on 1.0.0 resulted in %v", version)
- }
-
- version, _ = NewVersion("1.0.0+build.1-alpha.1")
- version.BumpPatch()
- if version.PreRelease != "" && version.PreRelease != "" {
- t.Fatalf("bumping major on 1.0.0+build.1-alpha.1 resulted in %v", version)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/dbus_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/dbus_test.go
deleted file mode 100644
index 4cfbe8296c7..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/dbus_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-Copyright 2013 CoreOS Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package dbus
-
-import (
- "testing"
-)
-
-func TestNeedsEscape(t *testing.T) {
- // Anything not 0-9a-zA-Z should always be escaped
- for want, vals := range map[bool][]byte{
- false: []byte{'a', 'b', 'z', 'A', 'Q', '1', '4', '9'},
- true: []byte{'#', '%', '$', '!', '.', '_', '-', '%', '\\'},
- } {
- for i := 1; i < 10; i++ {
- for _, b := range vals {
- got := needsEscape(i, b)
- if got != want {
- t.Errorf("needsEscape(%d, %c) returned %t, want %t", i, b, got, want)
- }
- }
- }
- }
-
- // 0-9 in position 0 should be escaped
- for want, vals := range map[bool][]byte{
- false: []byte{'A', 'a', 'e', 'x', 'Q', 'Z'},
- true: []byte{'0', '4', '5', '9'},
- } {
- for _, b := range vals {
- got := needsEscape(0, b)
- if got != want {
- t.Errorf("needsEscape(0, %c) returned %t, want %t", b, got, want)
- }
- }
- }
-
-}
-
-func TestPathBusEscape(t *testing.T) {
- for in, want := range map[string]string{
- "": "_",
- "foo.service": "foo_2eservice",
- "foobar": "foobar",
- "woof@woof.service": "woof_40woof_2eservice",
- "0123456": "_30123456",
- "account_db.service": "account_5fdb_2eservice",
- "got-dashes": "got_2ddashes",
- } {
- got := PathBusEscape(in)
- if got != want {
- t.Errorf("bad result for PathBusEscape(%s): got %q, want %q", in, got, want)
- }
- }
-
-}
-
-// TestNew ensures that New() works without errors.
-func TestNew(t *testing.T) {
- _, err := New()
-
- if err != nil {
- t.Fatal(err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/methods_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/methods_test.go
deleted file mode 100644
index 8c7ab93eb36..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/methods_test.go
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
-Copyright 2013 CoreOS Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package dbus
-
-import (
- "fmt"
- "math/rand"
- "os"
- "path/filepath"
- "reflect"
- "testing"
-
- "github.com/godbus/dbus"
-)
-
-func setupConn(t *testing.T) *Conn {
- conn, err := New()
- if err != nil {
- t.Fatal(err)
- }
-
- return conn
-}
-
-func findFixture(target string, t *testing.T) string {
- abs, err := filepath.Abs("../fixtures/" + target)
- if err != nil {
- t.Fatal(err)
- }
- return abs
-}
-
-func setupUnit(target string, conn *Conn, t *testing.T) {
- // Blindly stop the unit in case it is running
- conn.StopUnit(target, "replace")
-
- // Blindly remove the symlink in case it exists
- targetRun := filepath.Join("/run/systemd/system/", target)
- os.Remove(targetRun)
-}
-
-func linkUnit(target string, conn *Conn, t *testing.T) {
- abs := findFixture(target, t)
- fixture := []string{abs}
-
- changes, err := conn.LinkUnitFiles(fixture, true, true)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(changes) < 1 {
- t.Fatalf("Expected one change, got %v", changes)
- }
-
- runPath := filepath.Join("/run/systemd/system/", target)
- if changes[0].Filename != runPath {
- t.Fatal("Unexpected target filename")
- }
-}
-
-// Ensure that basic unit starting and stopping works.
-func TestStartStopUnit(t *testing.T) {
- target := "start-stop.service"
- conn := setupConn(t)
-
- setupUnit(target, conn, t)
- linkUnit(target, conn, t)
-
- // 2. Start the unit
- job, err := conn.StartUnit(target, "replace")
- if err != nil {
- t.Fatal(err)
- }
-
- if job != "done" {
- t.Fatal("Job is not done:", job)
- }
-
- units, err := conn.ListUnits()
-
- var unit *UnitStatus
- for _, u := range units {
- if u.Name == target {
- unit = &u
- }
- }
-
- if unit == nil {
- t.Fatalf("Test unit not found in list")
- }
-
- if unit.ActiveState != "active" {
- t.Fatalf("Test unit not active")
- }
-
- // 3. Stop the unit
- job, err = conn.StopUnit(target, "replace")
- if err != nil {
- t.Fatal(err)
- }
-
- units, err = conn.ListUnits()
-
- unit = nil
- for _, u := range units {
- if u.Name == target {
- unit = &u
- }
- }
-
- if unit != nil {
- t.Fatalf("Test unit found in list, should be stopped")
- }
-}
-
-// Enables a unit and then immediately tears it down
-func TestEnableDisableUnit(t *testing.T) {
- target := "enable-disable.service"
- conn := setupConn(t)
-
- setupUnit(target, conn, t)
- abs := findFixture(target, t)
- runPath := filepath.Join("/run/systemd/system/", target)
-
- // 1. Enable the unit
- install, changes, err := conn.EnableUnitFiles([]string{abs}, true, true)
- if err != nil {
- t.Fatal(err)
- }
-
- if install != false {
- t.Fatal("Install was true")
- }
-
- if len(changes) < 1 {
- t.Fatalf("Expected one change, got %v", changes)
- }
-
- if changes[0].Filename != runPath {
- t.Fatal("Unexpected target filename")
- }
-
- // 2. Disable the unit
- dChanges, err := conn.DisableUnitFiles([]string{abs}, true)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(dChanges) != 1 {
- t.Fatalf("Changes should include the path, %v", dChanges)
- }
- if dChanges[0].Filename != runPath {
- t.Fatalf("Change should include correct filename, %+v", dChanges[0])
- }
- if dChanges[0].Destination != "" {
- t.Fatalf("Change destination should be empty, %+v", dChanges[0])
- }
-}
-
-// TestGetUnitProperties reads the `-.mount` which should exist on all systemd
-// systems and ensures that one of its properties is valid.
-func TestGetUnitProperties(t *testing.T) {
- conn := setupConn(t)
-
- unit := "-.mount"
-
- info, err := conn.GetUnitProperties(unit)
- if err != nil {
- t.Fatal(err)
- }
-
- names := info["Wants"].([]string)
-
- if len(names) < 1 {
- t.Fatal("/ is unwanted")
- }
-
- if names[0] != "system.slice" {
- t.Fatal("unexpected wants for /")
- }
-
- prop, err := conn.GetUnitProperty(unit, "Wants")
- if err != nil {
- t.Fatal(err)
- }
-
- if prop.Name != "Wants" {
- t.Fatal("unexpected property name")
- }
-
- val := prop.Value.Value().([]string)
- if !reflect.DeepEqual(val, names) {
- t.Fatal("unexpected property value")
- }
-}
-
-// TestGetUnitPropertiesRejectsInvalidName attempts to get the properties for a
-// unit with an invalid name. This test should be run with --test.timeout set,
-// as a fail will manifest as GetUnitProperties hanging indefinitely.
-func TestGetUnitPropertiesRejectsInvalidName(t *testing.T) {
- conn := setupConn(t)
-
- unit := "//invalid#$^/"
-
- _, err := conn.GetUnitProperties(unit)
- if err == nil {
- t.Fatal("Expected an error, got nil")
- }
-
- _, err = conn.GetUnitProperty(unit, "Wants")
- if err == nil {
- t.Fatal("Expected an error, got nil")
- }
-}
-
-// TestSetUnitProperties changes a cgroup setting on the `tmp.mount`
-// which should exist on all systemd systems and ensures that the
-// property was set.
-func TestSetUnitProperties(t *testing.T) {
- conn := setupConn(t)
-
- unit := "tmp.mount"
-
- if err := conn.SetUnitProperties(unit, true, Property{"CPUShares", dbus.MakeVariant(uint64(1023))}); err != nil {
- t.Fatal(err)
- }
-
- info, err := conn.GetUnitTypeProperties(unit, "Mount")
- if err != nil {
- t.Fatal(err)
- }
-
- value := info["CPUShares"].(uint64)
- if value != 1023 {
- t.Fatal("CPUShares of unit is not 1023:", value)
- }
-}
-
-// Ensure that basic transient unit starting and stopping works.
-func TestStartStopTransientUnit(t *testing.T) {
- conn := setupConn(t)
-
- props := []Property{
- PropExecStart([]string{"/bin/sleep", "400"}, false),
- }
- target := fmt.Sprintf("testing-transient-%d.service", rand.Int())
-
- // Start the unit
- job, err := conn.StartTransientUnit(target, "replace", props...)
- if err != nil {
- t.Fatal(err)
- }
-
- if job != "done" {
- t.Fatal("Job is not done:", job)
- }
-
- units, err := conn.ListUnits()
-
- var unit *UnitStatus
- for _, u := range units {
- if u.Name == target {
- unit = &u
- }
- }
-
- if unit == nil {
- t.Fatalf("Test unit not found in list")
- }
-
- if unit.ActiveState != "active" {
- t.Fatalf("Test unit not active")
- }
-
- // 3. Stop the unit
- job, err = conn.StopUnit(target, "replace")
- if err != nil {
- t.Fatal(err)
- }
-
- units, err = conn.ListUnits()
-
- unit = nil
- for _, u := range units {
- if u.Name == target {
- unit = &u
- }
- }
-
- if unit != nil {
- t.Fatalf("Test unit found in list, should be stopped")
- }
-}
-
-func TestConnJobListener(t *testing.T) {
- target := "start-stop.service"
- conn := setupConn(t)
-
- setupUnit(target, conn, t)
- linkUnit(target, conn, t)
-
- jobSize := len(conn.jobListener.jobs)
-
- _, err := conn.StartUnit(target, "replace")
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = conn.StopUnit(target, "replace")
- if err != nil {
- t.Fatal(err)
- }
-
- currentJobSize := len(conn.jobListener.jobs)
- if jobSize != currentJobSize {
- t.Fatal("JobListener jobs leaked")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/set_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/set_test.go
deleted file mode 100644
index c4435f8800c..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/set_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package dbus
-
-import (
- "testing"
-)
-
-// TestBasicSetActions asserts that Add & Remove behavior is correct
-func TestBasicSetActions(t *testing.T) {
- s := newSet()
-
- if s.Contains("foo") {
- t.Fatal("set should not contain 'foo'")
- }
-
- s.Add("foo")
-
- if !s.Contains("foo") {
- t.Fatal("set should contain 'foo'")
- }
-
- v := s.Values()
- if len(v) != 1 {
- t.Fatal("set.Values did not report correct number of values")
- }
- if v[0] != "foo" {
- t.Fatal("set.Values did not report value")
- }
-
- s.Remove("foo")
-
- if s.Contains("foo") {
- t.Fatal("set should not contain 'foo'")
- }
-
- v = s.Values()
- if len(v) != 0 {
- t.Fatal("set.Values did not report correct number of values")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/subscription_set_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/subscription_set_test.go
deleted file mode 100644
index 4ecd15376d3..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/subscription_set_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package dbus
-
-import (
- "testing"
- "time"
-)
-
-// TestSubscribeUnit exercises the basics of subscription of a particular unit.
-func TestSubscriptionSetUnit(t *testing.T) {
- target := "subscribe-events-set.service"
-
- conn, err := New()
-
- if err != nil {
- t.Fatal(err)
- }
-
- err = conn.Subscribe()
- if err != nil {
- t.Fatal(err)
- }
-
- subSet := conn.NewSubscriptionSet()
- evChan, errChan := subSet.Subscribe()
-
- subSet.Add(target)
- setupUnit(target, conn, t)
- linkUnit(target, conn, t)
-
- job, err := conn.StartUnit(target, "replace")
- if err != nil {
- t.Fatal(err)
- }
-
- if job != "done" {
- t.Fatal("Couldn't start", target)
- }
-
- timeout := make(chan bool, 1)
- go func() {
- time.Sleep(3 * time.Second)
- close(timeout)
- }()
-
- for {
- select {
- case changes := <-evChan:
- tCh, ok := changes[target]
-
- if !ok {
- t.Fatal("Unexpected event:", changes)
- }
-
- if tCh.ActiveState == "active" && tCh.Name == target {
- goto success
- }
- case err = <-errChan:
- t.Fatal(err)
- case <-timeout:
- t.Fatal("Reached timeout")
- }
- }
-
-success:
- return
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/subscription_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/subscription_test.go
deleted file mode 100644
index f2b5dfc28c1..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus/subscription_test.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package dbus
-
-import (
- "testing"
- "time"
-)
-
-// TestSubscribe exercises the basics of subscription
-func TestSubscribe(t *testing.T) {
- conn, err := New()
-
- if err != nil {
- t.Fatal(err)
- }
-
- err = conn.Subscribe()
- if err != nil {
- t.Fatal(err)
- }
-
- err = conn.Unsubscribe()
- if err != nil {
- t.Fatal(err)
- }
-}
-
-// TestSubscribeUnit exercises the basics of subscription of a particular unit.
-func TestSubscribeUnit(t *testing.T) {
- target := "subscribe-events.service"
-
- conn, err := New()
-
- if err != nil {
- t.Fatal(err)
- }
-
- err = conn.Subscribe()
- if err != nil {
- t.Fatal(err)
- }
-
- err = conn.Unsubscribe()
- if err != nil {
- t.Fatal(err)
- }
-
- evChan, errChan := conn.SubscribeUnits(time.Second)
-
- setupUnit(target, conn, t)
- linkUnit(target, conn, t)
-
- job, err := conn.StartUnit(target, "replace")
- if err != nil {
- t.Fatal(err)
- }
-
- if job != "done" {
- t.Fatal("Couldn't start", target)
- }
-
- timeout := make(chan bool, 1)
- go func() {
- time.Sleep(3 * time.Second)
- close(timeout)
- }()
-
- for {
- select {
- case changes := <-evChan:
- tCh, ok := changes[target]
-
- // Just continue until we see our event.
- if !ok {
- continue
- }
-
- if tCh.ActiveState == "active" && tCh.Name == target {
- goto success
- }
- case err = <-errChan:
- t.Fatal(err)
- case <-timeout:
- t.Fatal("Reached timeout")
- }
- }
-
-success:
- return
-}
-
-
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/deserialize_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/deserialize_test.go
deleted file mode 100644
index bb98b82984e..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/deserialize_test.go
+++ /dev/null
@@ -1,301 +0,0 @@
-package unit
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestDeserialize(t *testing.T) {
- tests := []struct {
- input []byte
- output []*UnitOption
- }{
- // multiple options underneath a section
- {
- []byte(`[Unit]
-Description=Foo
-Description=Bar
-Requires=baz.service
-After=baz.service
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Foo"},
- &UnitOption{"Unit", "Description", "Bar"},
- &UnitOption{"Unit", "Requires", "baz.service"},
- &UnitOption{"Unit", "After", "baz.service"},
- },
- },
-
- // multiple sections
- {
- []byte(`[Unit]
-Description=Foo
-
-[Service]
-ExecStart=/usr/bin/sleep infinity
-
-[X-Third-Party]
-Pants=on
-
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Foo"},
- &UnitOption{"Service", "ExecStart", "/usr/bin/sleep infinity"},
- &UnitOption{"X-Third-Party", "Pants", "on"},
- },
- },
-
- // multiple sections with no options
- {
- []byte(`[Unit]
-[Service]
-[X-Third-Party]
-`),
- []*UnitOption{},
- },
-
- // multiple values not special-cased
- {
- []byte(`[Service]
-Environment= "FOO=BAR" "BAZ=QUX"
-`),
- []*UnitOption{
- &UnitOption{"Service", "Environment", "\"FOO=BAR\" \"BAZ=QUX\""},
- },
- },
-
- // line continuations respected
- {
- []byte(`[Unit]
-Description= Unnecessarily wrapped \
- words here
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Unnecessarily wrapped words here"},
- },
- },
-
- // comments ignored
- {
- []byte(`; comment alpha
-# comment bravo
-[Unit]
-; comment charlie
-# comment delta
-#Description=Foo
-Description=Bar
-; comment echo
-# comment foxtrot
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Bar"},
- },
- },
-
- // apparent comment lines inside of line continuations not ignored
- {
- []byte(`[Unit]
-Description=Bar\
-# comment alpha
-
-Description=Bar\
-# comment bravo \
-Baz
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Bar # comment alpha"},
- &UnitOption{"Unit", "Description", "Bar # comment bravo Baz"},
- },
- },
-
- // options outside of sections are ignored
- {
- []byte(`Description=Foo
-[Unit]
-Description=Bar
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Bar"},
- },
- },
-
- // garbage outside of sections are ignored
- {
- []byte(`<<<<<<<<
-[Unit]
-Description=Bar
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Bar"},
- },
- },
-
- // garbage used as unit option
- {
- []byte(`[Unit]
-<<<<<<<<=Bar
-`),
- []*UnitOption{
- &UnitOption{"Unit", "<<<<<<<<", "Bar"},
- },
- },
-
- // option name with spaces are valid
- {
- []byte(`[Unit]
-Some Thing = Bar
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Some Thing", "Bar"},
- },
- },
-
- // lack of trailing newline doesn't cause problem for non-continued file
- {
- []byte(`[Unit]
-Description=Bar`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Bar"},
- },
- },
-
- // unit file with continuation but no following line is ok, too
- {
- []byte(`[Unit]
-Description=Bar \`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Bar"},
- },
- },
-
- // Assert utf8 characters are preserved
- {
- []byte(`[©]
-µ☃=ÇôrèÕ$`),
- []*UnitOption{
- &UnitOption{"©", "µ☃", "ÇôrèÕ$"},
- },
- },
-
- // whitespace removed around option name
- {
- []byte(`[Unit]
- Description =words here
-`),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "words here"},
- },
- },
-
- // whitespace around option value stripped
- {
- []byte(`[Unit]
-Description= words here `),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "words here"},
- },
- },
-
- // whitespace around option value stripped, regardless of continuation
- {
- []byte(`[Unit]
-Description= words here \
- `),
- []*UnitOption{
- &UnitOption{"Unit", "Description", "words here"},
- },
- },
-
- // backslash not considered continuation if followed by text
- {
- []byte(`[Service]
-ExecStart=/bin/bash -c "while true; do echo \"ping\"; sleep 1; done"
-`),
- []*UnitOption{
- &UnitOption{"Service", "ExecStart", `/bin/bash -c "while true; do echo \"ping\"; sleep 1; done"`},
- },
- },
-
- // backslash not considered continuation if followed by whitespace, but still trimmed
- {
- []byte(`[Service]
-ExecStart=/bin/bash echo poof \ `),
- []*UnitOption{
- &UnitOption{"Service", "ExecStart", `/bin/bash echo poof \`},
- },
- },
- }
-
- assert := func(expect, output []*UnitOption) error {
- if len(expect) != len(output) {
- return fmt.Errorf("expected %d items, got %d", len(expect), len(output))
- }
-
- for i, _ := range expect {
- if !reflect.DeepEqual(expect[i], output[i]) {
- return fmt.Errorf("item %d: expected %v, got %v", i, expect[i], output[i])
- }
- }
-
- return nil
- }
-
- for i, tt := range tests {
- output, err := Deserialize(bytes.NewReader(tt.input))
- if err != nil {
- t.Errorf("case %d: unexpected error parsing unit: %v", i, err)
- continue
- }
-
- err = assert(tt.output, output)
- if err != nil {
- t.Errorf("case %d: %v", i, err)
- t.Log("Expected options:")
- logUnitOptionSlice(t, tt.output)
- t.Log("Actual options:")
- logUnitOptionSlice(t, output)
- }
- }
-}
-
-func TestDeserializeFail(t *testing.T) {
- tests := [][]byte{
- // malformed section header
- []byte(`[Unit
-Description=Foo
-`),
-
- // garbage following section header
- []byte(`[Unit] pants
-Description=Foo
-`),
-
- // option without value
- []byte(`[Unit]
-Description
-`),
-
- // garbage inside of section
- []byte(`[Unit]
-<<<<<<
-Description=Foo
-`),
- }
-
- for i, tt := range tests {
- output, err := Deserialize(bytes.NewReader(tt))
- if err == nil {
- t.Errorf("case %d: unexpected non-nil error, received nil", i)
- t.Log("Output:")
- logUnitOptionSlice(t, output)
- }
- }
-}
-
-func logUnitOptionSlice(t *testing.T, opts []*UnitOption) {
- for idx, opt := range opts {
- t.Logf("%d: %v", idx, opt)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/option_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/option_test.go
deleted file mode 100644
index ebdc062f797..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/option_test.go
+++ /dev/null
@@ -1,200 +0,0 @@
-package unit
-
-import (
- "testing"
-)
-
-func TestAllMatch(t *testing.T) {
- tests := []struct {
- u1 []*UnitOption
- u2 []*UnitOption
- match bool
- }{
- // empty lists match
- {
- u1: []*UnitOption{},
- u2: []*UnitOption{},
- match: true,
- },
-
- // simple match of a single option
- {
- u1: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- },
- u2: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- },
- match: true,
- },
-
- // single option mismatched
- {
- u1: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- },
- u2: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "BAR"},
- },
- match: false,
- },
-
- // multiple options match
- {
- u1: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- {Section: "Unit", Name: "BindsTo", Value: "bar.service"},
- {Section: "Service", Name: "ExecStart", Value: "/bin/true"},
- },
- u2: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- {Section: "Unit", Name: "BindsTo", Value: "bar.service"},
- {Section: "Service", Name: "ExecStart", Value: "/bin/true"},
- },
- match: true,
- },
-
- // mismatch length
- {
- u1: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- {Section: "Unit", Name: "BindsTo", Value: "bar.service"},
- },
- u2: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- {Section: "Unit", Name: "BindsTo", Value: "bar.service"},
- {Section: "Service", Name: "ExecStart", Value: "/bin/true"},
- },
- match: false,
- },
-
- // multiple options misordered
- {
- u1: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- {Section: "Service", Name: "ExecStart", Value: "/bin/true"},
- },
- u2: []*UnitOption{
- {Section: "Service", Name: "ExecStart", Value: "/bin/true"},
- {Section: "Unit", Name: "Description", Value: "FOO"},
- },
- match: false,
- },
-
- // interleaved sections mismatch
- {
- u1: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- {Section: "Unit", Name: "BindsTo", Value: "bar.service"},
- {Section: "Service", Name: "ExecStart", Value: "/bin/true"},
- {Section: "Service", Name: "ExecStop", Value: "/bin/true"},
- },
- u2: []*UnitOption{
- {Section: "Unit", Name: "Description", Value: "FOO"},
- {Section: "Service", Name: "ExecStart", Value: "/bin/true"},
- {Section: "Unit", Name: "BindsTo", Value: "bar.service"},
- {Section: "Service", Name: "ExecStop", Value: "/bin/true"},
- },
- match: false,
- },
- }
-
- for i, tt := range tests {
- match := AllMatch(tt.u1, tt.u2)
- if match != tt.match {
- t.Errorf("case %d: failed comparing u1 to u2 - expected match=%t, got %t", i, tt.match, match)
- }
-
- match = AllMatch(tt.u2, tt.u1)
- if match != tt.match {
- t.Errorf("case %d: failed comparing u2 to u1 - expected match=%t, got %t", i, tt.match, match)
- }
- }
-}
-
-func TestMatch(t *testing.T) {
- tests := []struct {
- o1 *UnitOption
- o2 *UnitOption
- match bool
- }{
- // empty options match
- {
- o1: &UnitOption{},
- o2: &UnitOption{},
- match: true,
- },
-
- // all fields match
- {
- o1: &UnitOption{
- Section: "Unit",
- Name: "Description",
- Value: "FOO",
- },
- o2: &UnitOption{
- Section: "Unit",
- Name: "Description",
- Value: "FOO",
- },
- match: true,
- },
-
- // Section mismatch
- {
- o1: &UnitOption{
- Section: "Unit",
- Name: "Description",
- Value: "FOO",
- },
- o2: &UnitOption{
- Section: "X-Other",
- Name: "Description",
- Value: "FOO",
- },
- match: false,
- },
-
- // Name mismatch
- {
- o1: &UnitOption{
- Section: "Unit",
- Name: "Description",
- Value: "FOO",
- },
- o2: &UnitOption{
- Section: "Unit",
- Name: "BindsTo",
- Value: "FOO",
- },
- match: false,
- },
-
- // Value mismatch
- {
- o1: &UnitOption{
- Section: "Unit",
- Name: "Description",
- Value: "FOO",
- },
- o2: &UnitOption{
- Section: "Unit",
- Name: "Description",
- Value: "BAR",
- },
- match: false,
- },
- }
-
- for i, tt := range tests {
- match := tt.o1.Match(tt.o2)
- if match != tt.match {
- t.Errorf("case %d: failed comparing o1 to o2 - expected match=%t, got %t", i, tt.match, match)
- }
-
- match = tt.o2.Match(tt.o1)
- if match != tt.match {
- t.Errorf("case %d: failed comparing o2 to o1 - expected match=%t, got %t", i, tt.match, match)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/serialize_test.go b/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/serialize_test.go
deleted file mode 100644
index e5ec0f13b7a..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/go-systemd/unit/serialize_test.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package unit
-
-import (
- "io/ioutil"
- "testing"
-)
-
-func TestSerialize(t *testing.T) {
- tests := []struct {
- input []*UnitOption
- output string
- }{
- // no options results in empty file
- {
- []*UnitOption{},
- ``,
- },
-
- // options with same section share the header
- {
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Foo"},
- &UnitOption{"Unit", "BindsTo", "bar.service"},
- },
- `[Unit]
-Description=Foo
-BindsTo=bar.service
-`,
- },
-
- // options with same name are not combined
- {
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Foo"},
- &UnitOption{"Unit", "Description", "Bar"},
- },
- `[Unit]
-Description=Foo
-Description=Bar
-`,
- },
-
- // multiple options printed under different section headers
- {
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Foo"},
- &UnitOption{"Service", "ExecStart", "/usr/bin/sleep infinity"},
- },
- `[Unit]
-Description=Foo
-
-[Service]
-ExecStart=/usr/bin/sleep infinity
-`,
- },
-
- // no optimization for unsorted options
- {
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Foo"},
- &UnitOption{"Service", "ExecStart", "/usr/bin/sleep infinity"},
- &UnitOption{"Unit", "BindsTo", "bar.service"},
- },
- `[Unit]
-Description=Foo
-
-[Service]
-ExecStart=/usr/bin/sleep infinity
-
-[Unit]
-BindsTo=bar.service
-`,
- },
-
- // utf8 characters are not a problem
- {
- []*UnitOption{
- &UnitOption{"©", "µ☃", "ÇôrèÕ$"},
- },
- `[©]
-µ☃=ÇôrèÕ$
-`,
- },
-
- // no verification is done on section names
- {
- []*UnitOption{
- &UnitOption{"Un\nit", "Description", "Foo"},
- },
- `[Un
-it]
-Description=Foo
-`,
- },
-
- // no verification is done on option names
- {
- []*UnitOption{
- &UnitOption{"Unit", "Desc\nription", "Foo"},
- },
- `[Unit]
-Desc
-ription=Foo
-`,
- },
-
- // no verification is done on option values
- {
- []*UnitOption{
- &UnitOption{"Unit", "Description", "Fo\no"},
- },
- `[Unit]
-Description=Fo
-o
-`,
- },
- }
-
- for i, tt := range tests {
- outReader := Serialize(tt.input)
- outBytes, err := ioutil.ReadAll(outReader)
- if err != nil {
- t.Errorf("case %d: encountered error while reading output: %v", i, err)
- continue
- }
-
- output := string(outBytes)
- if tt.output != output {
- t.Errorf("case %d: incorrect output")
- t.Logf("Expected:\n%s", tt.output)
- t.Logf("Actual:\n%s", output)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/pkg/health/health_test.go b/Godeps/_workspace/src/github.com/coreos/pkg/health/health_test.go
deleted file mode 100644
index 99428eb7387..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/pkg/health/health_test.go
+++ /dev/null
@@ -1,198 +0,0 @@
-package health
-
-import (
- "encoding/json"
- "errors"
- "net/http"
- "net/http/httptest"
- "testing"
-
- "github.com/coreos/pkg/httputil"
-)
-
-type boolChecker bool
-
-func (b boolChecker) Healthy() error {
- if b {
- return nil
- }
- return errors.New("Unhealthy")
-}
-
-func errString(err error) string {
- if err == nil {
- return ""
- }
- return err.Error()
-}
-
-func TestCheck(t *testing.T) {
- for i, test := range []struct {
- checks []Checkable
- expected string
- }{
- {[]Checkable{}, ""},
-
- {[]Checkable{boolChecker(true)}, ""},
-
- {[]Checkable{boolChecker(true), boolChecker(true)}, ""},
-
- {[]Checkable{boolChecker(true), boolChecker(false)}, "Unhealthy"},
-
- {[]Checkable{boolChecker(true), boolChecker(false), boolChecker(false)}, "multiple health check failure: [Unhealthy Unhealthy]"},
- } {
- err := Check(test.checks)
-
- if errString(err) != test.expected {
- t.Errorf("case %d: want %v, got %v", i, test.expected, errString(err))
- }
- }
-}
-
-func TestHandlerFunc(t *testing.T) {
- for i, test := range []struct {
- checker Checker
- method string
- expectedStatus string
- expectedCode int
- expectedMessage string
- }{
- {
- Checker{
- Checks: []Checkable{
- boolChecker(true),
- },
- },
- "GET",
- "ok",
- http.StatusOK,
- "",
- },
-
- // Wrong method.
- {
- Checker{
- Checks: []Checkable{
- boolChecker(true),
- },
- },
- "POST",
- "",
- http.StatusMethodNotAllowed,
- "GET only acceptable method",
- },
-
- // Health check fails.
- {
- Checker{
- Checks: []Checkable{
- boolChecker(false),
- },
- },
- "GET",
- "error",
- http.StatusInternalServerError,
- "Unhealthy",
- },
-
- // Health check fails, with overridden ErrorHandler.
- {
- Checker{
- Checks: []Checkable{
- boolChecker(false),
- },
- UnhealthyHandler: func(w http.ResponseWriter, r *http.Request, err error) {
- httputil.WriteJSONResponse(w,
- http.StatusInternalServerError, StatusResponse{
- Status: "error",
- Details: &StatusResponseDetails{
- Code: http.StatusInternalServerError,
- Message: "Override!",
- },
- })
- },
- },
- "GET",
- "error",
- http.StatusInternalServerError,
- "Override!",
- },
-
- // Health check succeeds, with overridden SuccessHandler.
- {
- Checker{
- Checks: []Checkable{
- boolChecker(true),
- },
- HealthyHandler: func(w http.ResponseWriter, r *http.Request) {
- httputil.WriteJSONResponse(w,
- http.StatusOK, StatusResponse{
- Status: "okey-dokey",
- })
- },
- },
- "GET",
- "okey-dokey",
- http.StatusOK,
- "",
- },
- } {
- w := httptest.NewRecorder()
- r := &http.Request{}
- r.Method = test.method
- test.checker.ServeHTTP(w, r)
- if w.Code != test.expectedCode {
- t.Errorf("case %d: w.code == %v, want %v", i, w.Code, test.expectedCode)
- }
-
- if test.expectedStatus == "" {
- // This is to handle the wrong-method case, when the
- // body of the response is empty.
- continue
- }
-
- statusMap := make(map[string]interface{})
- err := json.Unmarshal(w.Body.Bytes(), &statusMap)
- if err != nil {
- t.Fatalf("case %d: failed to Unmarshal response body: %v", i, err)
- }
-
- status, ok := statusMap["status"].(string)
- if !ok {
- t.Errorf("case %d: status not present or not a string in json: %q", i, w.Body.Bytes())
- }
- if status != test.expectedStatus {
- t.Errorf("case %d: status == %v, want %v", i, status, test.expectedStatus)
- }
-
- detailMap, ok := statusMap["details"].(map[string]interface{})
- if test.expectedMessage != "" {
- if !ok {
- t.Fatalf("case %d: could not find/unmarshal detailMap", i)
- }
- message, ok := detailMap["message"].(string)
- if !ok {
- t.Fatalf("case %d: message not present or not a string in json: %q",
- i, w.Body.Bytes())
- }
- if message != test.expectedMessage {
- t.Errorf("case %d: message == %v, want %v", i, message, test.expectedMessage)
- }
-
- code, ok := detailMap["code"].(float64)
- if !ok {
- t.Fatalf("case %d: code not present or not an int in json: %q",
- i, w.Body.Bytes())
- }
- if int(code) != test.expectedCode {
- t.Errorf("case %d: code == %v, want %v", i, code, test.expectedCode)
- }
-
- } else {
- if ok {
- t.Errorf("case %d: unwanted detailMap present: %q", i, detailMap)
- }
- }
-
- }
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/pkg/httputil/json_test.go b/Godeps/_workspace/src/github.com/coreos/pkg/httputil/json_test.go
deleted file mode 100644
index 92108927b3b..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/pkg/httputil/json_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package httputil
-
-import (
- "net/http/httptest"
- "testing"
-)
-
-func TestWriteJSONResponse(t *testing.T) {
- for i, test := range []struct {
- code int
- resp interface{}
- expectedJSON string
- expectErr bool
- }{
- {
- 200,
- struct {
- A string
- B string
- }{A: "foo", B: "bar"},
- `{"A":"foo","B":"bar"}`,
- false,
- },
- {
- 500,
- // Something that json.Marshal cannot serialize.
- make(chan int),
- "",
- true,
- },
- } {
- w := httptest.NewRecorder()
- err := WriteJSONResponse(w, test.code, test.resp)
-
- if w.Code != test.code {
- t.Errorf("case %d: w.code == %v, want %v", i, w.Code, test.code)
- }
-
- if (err != nil) != test.expectErr {
- t.Errorf("case %d: (err != nil) == %v, want %v. err: %v", i, err != nil, test.expectErr, err)
- }
-
- if string(w.Body.Bytes()) != test.expectedJSON {
- t.Errorf("case %d: w.Body.Bytes()) == %q, want %q", i,
- string(w.Body.Bytes()), test.expectedJSON)
- }
-
- if !test.expectErr {
- contentType := w.Header()["Content-Type"][0]
- if contentType != JSONContentType {
- t.Errorf("case %d: contentType == %v, want %v", i, contentType, JSONContentType)
- }
- }
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/coreos/pkg/timeutil/backoff_test.go b/Godeps/_workspace/src/github.com/coreos/pkg/timeutil/backoff_test.go
deleted file mode 100644
index d8392bc54ce..00000000000
--- a/Godeps/_workspace/src/github.com/coreos/pkg/timeutil/backoff_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package timeutil
-
-import (
- "testing"
- "time"
-)
-
-func TestExpBackoff(t *testing.T) {
- tests := []struct {
- prev time.Duration
- max time.Duration
- want time.Duration
- }{
- {
- prev: time.Duration(0),
- max: time.Minute,
- want: time.Second,
- },
- {
- prev: time.Second,
- max: time.Minute,
- want: 2 * time.Second,
- },
- {
- prev: 16 * time.Second,
- max: time.Minute,
- want: 32 * time.Second,
- },
- {
- prev: 32 * time.Second,
- max: time.Minute,
- want: time.Minute,
- },
- {
- prev: time.Minute,
- max: time.Minute,
- want: time.Minute,
- },
- {
- prev: 2 * time.Minute,
- max: time.Minute,
- want: time.Minute,
- },
- }
-
- for i, tt := range tests {
- got := ExpBackoff(tt.prev, tt.max)
- if tt.want != got {
- t.Errorf("case %d: want=%v got=%v", i, tt.want, got)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/common_test.go b/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/common_test.go
deleted file mode 100644
index 39b7525b3d1..00000000000
--- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/common_test.go
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew_test
-
-import (
- "fmt"
- "reflect"
- "testing"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-// custom type to test Stinger interface on non-pointer receiver.
-type stringer string
-
-// String implements the Stringer interface for testing invocation of custom
-// stringers on types with non-pointer receivers.
-func (s stringer) String() string {
- return "stringer " + string(s)
-}
-
-// custom type to test Stinger interface on pointer receiver.
-type pstringer string
-
-// String implements the Stringer interface for testing invocation of custom
-// stringers on types with only pointer receivers.
-func (s *pstringer) String() string {
- return "stringer " + string(*s)
-}
-
-// xref1 and xref2 are cross referencing structs for testing circular reference
-// detection.
-type xref1 struct {
- ps2 *xref2
-}
-type xref2 struct {
- ps1 *xref1
-}
-
-// indirCir1, indirCir2, and indirCir3 are used to generate an indirect circular
-// reference for testing detection.
-type indirCir1 struct {
- ps2 *indirCir2
-}
-type indirCir2 struct {
- ps3 *indirCir3
-}
-type indirCir3 struct {
- ps1 *indirCir1
-}
-
-// embed is used to test embedded structures.
-type embed struct {
- a string
-}
-
-// embedwrap is used to test embedded structures.
-type embedwrap struct {
- *embed
- e *embed
-}
-
-// panicer is used to intentionally cause a panic for testing spew properly
-// handles them
-type panicer int
-
-func (p panicer) String() string {
- panic("test panic")
-}
-
-// customError is used to test custom error interface invocation.
-type customError int
-
-func (e customError) Error() string {
- return fmt.Sprintf("error: %d", int(e))
-}
-
-// stringizeWants converts a slice of wanted test output into a format suitable
-// for a test error message.
-func stringizeWants(wants []string) string {
- s := ""
- for i, want := range wants {
- if i > 0 {
- s += fmt.Sprintf("want%d: %s", i+1, want)
- } else {
- s += "want: " + want
- }
- }
- return s
-}
-
-// testFailed returns whether or not a test failed by checking if the result
-// of the test is in the slice of wanted strings.
-func testFailed(result string, wants []string) bool {
- for _, want := range wants {
- if result == want {
- return false
- }
- }
- return true
-}
-
-type sortableStruct struct {
- x int
-}
-
-func (ss sortableStruct) String() string {
- return fmt.Sprintf("ss.%d", ss.x)
-}
-
-type unsortableStruct struct {
- x int
-}
-
-type sortTestCase struct {
- input []reflect.Value
- expected []reflect.Value
-}
-
-func helpTestSortValues(tests []sortTestCase, cs *spew.ConfigState, t *testing.T) {
- getInterfaces := func(values []reflect.Value) []interface{} {
- interfaces := []interface{}{}
- for _, v := range values {
- interfaces = append(interfaces, v.Interface())
- }
- return interfaces
- }
-
- for _, test := range tests {
- spew.SortValues(test.input, cs)
- // reflect.DeepEqual cannot really make sense of reflect.Value,
- // probably because of all the pointer tricks. For instance,
- // v(2.0) != v(2.0) on a 32-bits system. Turn them into interface{}
- // instead.
- input := getInterfaces(test.input)
- expected := getInterfaces(test.expected)
- if !reflect.DeepEqual(input, expected) {
- t.Errorf("Sort mismatch:\n %v != %v", input, expected)
- }
- }
-}
-
-// TestSortValues ensures the sort functionality for relect.Value based sorting
-// works as intended.
-func TestSortValues(t *testing.T) {
- v := reflect.ValueOf
-
- a := v("a")
- b := v("b")
- c := v("c")
- embedA := v(embed{"a"})
- embedB := v(embed{"b"})
- embedC := v(embed{"c"})
- tests := []sortTestCase{
- // No values.
- {
- []reflect.Value{},
- []reflect.Value{},
- },
- // Bools.
- {
- []reflect.Value{v(false), v(true), v(false)},
- []reflect.Value{v(false), v(false), v(true)},
- },
- // Ints.
- {
- []reflect.Value{v(2), v(1), v(3)},
- []reflect.Value{v(1), v(2), v(3)},
- },
- // Uints.
- {
- []reflect.Value{v(uint8(2)), v(uint8(1)), v(uint8(3))},
- []reflect.Value{v(uint8(1)), v(uint8(2)), v(uint8(3))},
- },
- // Floats.
- {
- []reflect.Value{v(2.0), v(1.0), v(3.0)},
- []reflect.Value{v(1.0), v(2.0), v(3.0)},
- },
- // Strings.
- {
- []reflect.Value{b, a, c},
- []reflect.Value{a, b, c},
- },
- // Array
- {
- []reflect.Value{v([3]int{3, 2, 1}), v([3]int{1, 3, 2}), v([3]int{1, 2, 3})},
- []reflect.Value{v([3]int{1, 2, 3}), v([3]int{1, 3, 2}), v([3]int{3, 2, 1})},
- },
- // Uintptrs.
- {
- []reflect.Value{v(uintptr(2)), v(uintptr(1)), v(uintptr(3))},
- []reflect.Value{v(uintptr(1)), v(uintptr(2)), v(uintptr(3))},
- },
- // SortableStructs.
- {
- // Note: not sorted - DisableMethods is set.
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- },
- // UnsortableStructs.
- {
- // Note: not sorted - SpewKeys is false.
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- },
- // Invalid.
- {
- []reflect.Value{embedB, embedA, embedC},
- []reflect.Value{embedB, embedA, embedC},
- },
- }
- cs := spew.ConfigState{DisableMethods: true, SpewKeys: false}
- helpTestSortValues(tests, &cs, t)
-}
-
-// TestSortValuesWithMethods ensures the sort functionality for relect.Value
-// based sorting works as intended when using string methods.
-func TestSortValuesWithMethods(t *testing.T) {
- v := reflect.ValueOf
-
- a := v("a")
- b := v("b")
- c := v("c")
- tests := []sortTestCase{
- // Ints.
- {
- []reflect.Value{v(2), v(1), v(3)},
- []reflect.Value{v(1), v(2), v(3)},
- },
- // Strings.
- {
- []reflect.Value{b, a, c},
- []reflect.Value{a, b, c},
- },
- // SortableStructs.
- {
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- []reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},
- },
- // UnsortableStructs.
- {
- // Note: not sorted - SpewKeys is false.
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- },
- }
- cs := spew.ConfigState{DisableMethods: false, SpewKeys: false}
- helpTestSortValues(tests, &cs, t)
-}
-
-// TestSortValuesWithSpew ensures the sort functionality for relect.Value
-// based sorting works as intended when using spew to stringify keys.
-func TestSortValuesWithSpew(t *testing.T) {
- v := reflect.ValueOf
-
- a := v("a")
- b := v("b")
- c := v("c")
- tests := []sortTestCase{
- // Ints.
- {
- []reflect.Value{v(2), v(1), v(3)},
- []reflect.Value{v(1), v(2), v(3)},
- },
- // Strings.
- {
- []reflect.Value{b, a, c},
- []reflect.Value{a, b, c},
- },
- // SortableStructs.
- {
- []reflect.Value{v(sortableStruct{2}), v(sortableStruct{1}), v(sortableStruct{3})},
- []reflect.Value{v(sortableStruct{1}), v(sortableStruct{2}), v(sortableStruct{3})},
- },
- // UnsortableStructs.
- {
- []reflect.Value{v(unsortableStruct{2}), v(unsortableStruct{1}), v(unsortableStruct{3})},
- []reflect.Value{v(unsortableStruct{1}), v(unsortableStruct{2}), v(unsortableStruct{3})},
- },
- }
- cs := spew.ConfigState{DisableMethods: true, SpewKeys: true}
- helpTestSortValues(tests, &cs, t)
-}
diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dump_test.go b/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dump_test.go
deleted file mode 100644
index 3dd9089177e..00000000000
--- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dump_test.go
+++ /dev/null
@@ -1,1021 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
-Test Summary:
-NOTE: For each test, a nil pointer, a single pointer and double pointer to the
-base test element are also tested to ensure proper indirection across all types.
-
-- Max int8, int16, int32, int64, int
-- Max uint8, uint16, uint32, uint64, uint
-- Boolean true and false
-- Standard complex64 and complex128
-- Array containing standard ints
-- Array containing type with custom formatter on pointer receiver only
-- Array containing interfaces
-- Array containing bytes
-- Slice containing standard float32 values
-- Slice containing type with custom formatter on pointer receiver only
-- Slice containing interfaces
-- Slice containing bytes
-- Nil slice
-- Standard string
-- Nil interface
-- Sub-interface
-- Map with string keys and int vals
-- Map with custom formatter type on pointer receiver only keys and vals
-- Map with interface keys and values
-- Map with nil interface value
-- Struct with primitives
-- Struct that contains another struct
-- Struct that contains custom type with Stringer pointer interface via both
- exported and unexported fields
-- Struct that contains embedded struct and field to same struct
-- Uintptr to 0 (null pointer)
-- Uintptr address of real variable
-- Unsafe.Pointer to 0 (null pointer)
-- Unsafe.Pointer to address of real variable
-- Nil channel
-- Standard int channel
-- Function with no params and no returns
-- Function with param and no returns
-- Function with multiple params and multiple returns
-- Struct that is circular through self referencing
-- Structs that are circular through cross referencing
-- Structs that are indirectly circular
-- Type that panics in its Stringer interface
-*/
-
-package spew_test
-
-import (
- "bytes"
- "fmt"
- "testing"
- "unsafe"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-// dumpTest is used to describe a test to be perfomed against the Dump method.
-type dumpTest struct {
- in interface{}
- wants []string
-}
-
-// dumpTests houses all of the tests to be performed against the Dump method.
-var dumpTests = make([]dumpTest, 0)
-
-// addDumpTest is a helper method to append the passed input and desired result
-// to dumpTests
-func addDumpTest(in interface{}, wants ...string) {
- test := dumpTest{in, wants}
- dumpTests = append(dumpTests, test)
-}
-
-func addIntDumpTests() {
- // Max int8.
- v := int8(127)
- nv := (*int8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "int8"
- vs := "127"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Max int16.
- v2 := int16(32767)
- nv2 := (*int16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "int16"
- v2s := "32767"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")()\n")
-
- // Max int32.
- v3 := int32(2147483647)
- nv3 := (*int32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "int32"
- v3s := "2147483647"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")()\n")
-
- // Max int64.
- v4 := int64(9223372036854775807)
- nv4 := (*int64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "int64"
- v4s := "9223372036854775807"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")()\n")
-
- // Max int.
- v5 := int(2147483647)
- nv5 := (*int)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "int"
- v5s := "2147483647"
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
- addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
- addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
- addDumpTest(nv5, "(*"+v5t+")()\n")
-}
-
-func addUintDumpTests() {
- // Max uint8.
- v := uint8(255)
- nv := (*uint8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uint8"
- vs := "255"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Max uint16.
- v2 := uint16(65535)
- nv2 := (*uint16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")()\n")
-
- // Max uint32.
- v3 := uint32(4294967295)
- nv3 := (*uint32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "uint32"
- v3s := "4294967295"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")()\n")
-
- // Max uint64.
- v4 := uint64(18446744073709551615)
- nv4 := (*uint64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "uint64"
- v4s := "18446744073709551615"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")()\n")
-
- // Max uint.
- v5 := uint(4294967295)
- nv5 := (*uint)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "uint"
- v5s := "4294967295"
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
- addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
- addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
- addDumpTest(nv5, "(*"+v5t+")()\n")
-}
-
-func addBoolDumpTests() {
- // Boolean true.
- v := bool(true)
- nv := (*bool)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "bool"
- vs := "true"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Boolean false.
- v2 := bool(false)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "bool"
- v2s := "false"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
-}
-
-func addFloatDumpTests() {
- // Standard float32.
- v := float32(3.1415)
- nv := (*float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "float32"
- vs := "3.1415"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Standard float64.
- v2 := float64(3.1415926)
- nv2 := (*float64)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "float64"
- v2s := "3.1415926"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")()\n")
-}
-
-func addComplexDumpTests() {
- // Standard complex64.
- v := complex(float32(6), -2)
- nv := (*complex64)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "complex64"
- vs := "(6-2i)"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Standard complex128.
- v2 := complex(float64(-6), 2)
- nv2 := (*complex128)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "complex128"
- v2s := "(-6+2i)"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")()\n")
-}
-
-func addArrayDumpTests() {
- // Array containing standard ints.
- v := [3]int{1, 2, 3}
- vLen := fmt.Sprintf("%d", len(v))
- vCap := fmt.Sprintf("%d", cap(v))
- nv := (*[3]int)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "int"
- vs := "(len=" + vLen + " cap=" + vCap + ") {\n (" + vt + ") 1,\n (" +
- vt + ") 2,\n (" + vt + ") 3\n}"
- addDumpTest(v, "([3]"+vt+") "+vs+"\n")
- addDumpTest(pv, "(*[3]"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**[3]"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*[3]"+vt+")()\n")
-
- // Array containing type with custom formatter on pointer receiver only.
- v2i0 := pstringer("1")
- v2i1 := pstringer("2")
- v2i2 := pstringer("3")
- v2 := [3]pstringer{v2i0, v2i1, v2i2}
- v2i0Len := fmt.Sprintf("%d", len(v2i0))
- v2i1Len := fmt.Sprintf("%d", len(v2i1))
- v2i2Len := fmt.Sprintf("%d", len(v2i2))
- v2Len := fmt.Sprintf("%d", len(v2))
- v2Cap := fmt.Sprintf("%d", cap(v2))
- nv2 := (*[3]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.pstringer"
- v2s := "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t + ") (len=" +
- v2i0Len + ") stringer 1,\n (" + v2t + ") (len=" + v2i1Len +
- ") stringer 2,\n (" + v2t + ") (len=" + v2i2Len + ") " +
- "stringer 3\n}"
- addDumpTest(v2, "([3]"+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*[3]"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**[3]"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*[3]"+v2t+")()\n")
-
- // Array containing interfaces.
- v3i0 := "one"
- v3 := [3]interface{}{v3i0, int(2), uint(3)}
- v3i0Len := fmt.Sprintf("%d", len(v3i0))
- v3Len := fmt.Sprintf("%d", len(v3))
- v3Cap := fmt.Sprintf("%d", cap(v3))
- nv3 := (*[3]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[3]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3s := "(len=" + v3Len + " cap=" + v3Cap + ") {\n (" + v3t2 + ") " +
- "(len=" + v3i0Len + ") \"one\",\n (" + v3t3 + ") 2,\n (" +
- v3t4 + ") 3\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")()\n")
-
- // Array containing bytes.
- v4 := [34]byte{
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
- 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32,
- }
- v4Len := fmt.Sprintf("%d", len(v4))
- v4Cap := fmt.Sprintf("%d", cap(v4))
- nv4 := (*[34]byte)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "[34]uint8"
- v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
- "{\n 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20" +
- " |............... |\n" +
- " 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30" +
- " |!\"#$%&'()*+,-./0|\n" +
- " 00000020 31 32 " +
- " |12|\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")()\n")
-}
-
-func addSliceDumpTests() {
- // Slice containing standard float32 values.
- v := []float32{3.14, 6.28, 12.56}
- vLen := fmt.Sprintf("%d", len(v))
- vCap := fmt.Sprintf("%d", cap(v))
- nv := (*[]float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "float32"
- vs := "(len=" + vLen + " cap=" + vCap + ") {\n (" + vt + ") 3.14,\n (" +
- vt + ") 6.28,\n (" + vt + ") 12.56\n}"
- addDumpTest(v, "([]"+vt+") "+vs+"\n")
- addDumpTest(pv, "(*[]"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**[]"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*[]"+vt+")()\n")
-
- // Slice containing type with custom formatter on pointer receiver only.
- v2i0 := pstringer("1")
- v2i1 := pstringer("2")
- v2i2 := pstringer("3")
- v2 := []pstringer{v2i0, v2i1, v2i2}
- v2i0Len := fmt.Sprintf("%d", len(v2i0))
- v2i1Len := fmt.Sprintf("%d", len(v2i1))
- v2i2Len := fmt.Sprintf("%d", len(v2i2))
- v2Len := fmt.Sprintf("%d", len(v2))
- v2Cap := fmt.Sprintf("%d", cap(v2))
- nv2 := (*[]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.pstringer"
- v2s := "(len=" + v2Len + " cap=" + v2Cap + ") {\n (" + v2t + ") (len=" +
- v2i0Len + ") stringer 1,\n (" + v2t + ") (len=" + v2i1Len +
- ") stringer 2,\n (" + v2t + ") (len=" + v2i2Len + ") " +
- "stringer 3\n}"
- addDumpTest(v2, "([]"+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*[]"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**[]"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*[]"+v2t+")()\n")
-
- // Slice containing interfaces.
- v3i0 := "one"
- v3 := []interface{}{v3i0, int(2), uint(3), nil}
- v3i0Len := fmt.Sprintf("%d", len(v3i0))
- v3Len := fmt.Sprintf("%d", len(v3))
- v3Cap := fmt.Sprintf("%d", cap(v3))
- nv3 := (*[]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3t5 := "interface {}"
- v3s := "(len=" + v3Len + " cap=" + v3Cap + ") {\n (" + v3t2 + ") " +
- "(len=" + v3i0Len + ") \"one\",\n (" + v3t3 + ") 2,\n (" +
- v3t4 + ") 3,\n (" + v3t5 + ") \n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")()\n")
-
- // Slice containing bytes.
- v4 := []byte{
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
- 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32,
- }
- v4Len := fmt.Sprintf("%d", len(v4))
- v4Cap := fmt.Sprintf("%d", cap(v4))
- nv4 := (*[]byte)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "[]uint8"
- v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
- "{\n 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20" +
- " |............... |\n" +
- " 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30" +
- " |!\"#$%&'()*+,-./0|\n" +
- " 00000020 31 32 " +
- " |12|\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")()\n")
-
- // Nil slice.
- v5 := []int(nil)
- nv5 := (*[]int)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "[]int"
- v5s := ""
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
- addDumpTest(pv5, "(*"+v5t+")("+v5Addr+")("+v5s+")\n")
- addDumpTest(&pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")("+v5s+")\n")
- addDumpTest(nv5, "(*"+v5t+")()\n")
-}
-
-func addStringDumpTests() {
- // Standard string.
- v := "test"
- vLen := fmt.Sprintf("%d", len(v))
- nv := (*string)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "string"
- vs := "(len=" + vLen + ") \"test\""
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-}
-
-func addInterfaceDumpTests() {
- // Nil interface.
- var v interface{}
- nv := (*interface{})(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "interface {}"
- vs := ""
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Sub-interface.
- v2 := interface{}(uint16(65535))
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
-}
-
-func addMapDumpTests() {
- // Map with string keys and int vals.
- k := "one"
- kk := "two"
- m := map[string]int{k: 1, kk: 2}
- klen := fmt.Sprintf("%d", len(k)) // not kLen to shut golint up
- kkLen := fmt.Sprintf("%d", len(kk))
- mLen := fmt.Sprintf("%d", len(m))
- nilMap := map[string]int(nil)
- nm := (*map[string]int)(nil)
- pm := &m
- mAddr := fmt.Sprintf("%p", pm)
- pmAddr := fmt.Sprintf("%p", &pm)
- mt := "map[string]int"
- mt1 := "string"
- mt2 := "int"
- ms := "(len=" + mLen + ") {\n (" + mt1 + ") (len=" + klen + ") " +
- "\"one\": (" + mt2 + ") 1,\n (" + mt1 + ") (len=" + kkLen +
- ") \"two\": (" + mt2 + ") 2\n}"
- ms2 := "(len=" + mLen + ") {\n (" + mt1 + ") (len=" + kkLen + ") " +
- "\"two\": (" + mt2 + ") 2,\n (" + mt1 + ") (len=" + klen +
- ") \"one\": (" + mt2 + ") 1\n}"
- addDumpTest(m, "("+mt+") "+ms+"\n", "("+mt+") "+ms2+"\n")
- addDumpTest(pm, "(*"+mt+")("+mAddr+")("+ms+")\n",
- "(*"+mt+")("+mAddr+")("+ms2+")\n")
- addDumpTest(&pm, "(**"+mt+")("+pmAddr+"->"+mAddr+")("+ms+")\n",
- "(**"+mt+")("+pmAddr+"->"+mAddr+")("+ms2+")\n")
- addDumpTest(nm, "(*"+mt+")()\n")
- addDumpTest(nilMap, "("+mt+") \n")
-
- // Map with custom formatter type on pointer receiver only keys and vals.
- k2 := pstringer("one")
- v2 := pstringer("1")
- m2 := map[pstringer]pstringer{k2: v2}
- k2Len := fmt.Sprintf("%d", len(k2))
- v2Len := fmt.Sprintf("%d", len(v2))
- m2Len := fmt.Sprintf("%d", len(m2))
- nilMap2 := map[pstringer]pstringer(nil)
- nm2 := (*map[pstringer]pstringer)(nil)
- pm2 := &m2
- m2Addr := fmt.Sprintf("%p", pm2)
- pm2Addr := fmt.Sprintf("%p", &pm2)
- m2t := "map[spew_test.pstringer]spew_test.pstringer"
- m2t1 := "spew_test.pstringer"
- m2t2 := "spew_test.pstringer"
- m2s := "(len=" + m2Len + ") {\n (" + m2t1 + ") (len=" + k2Len + ") " +
- "stringer one: (" + m2t2 + ") (len=" + v2Len + ") stringer 1\n}"
- addDumpTest(m2, "("+m2t+") "+m2s+"\n")
- addDumpTest(pm2, "(*"+m2t+")("+m2Addr+")("+m2s+")\n")
- addDumpTest(&pm2, "(**"+m2t+")("+pm2Addr+"->"+m2Addr+")("+m2s+")\n")
- addDumpTest(nm2, "(*"+m2t+")()\n")
- addDumpTest(nilMap2, "("+m2t+") \n")
-
- // Map with interface keys and values.
- k3 := "one"
- k3Len := fmt.Sprintf("%d", len(k3))
- m3 := map[interface{}]interface{}{k3: 1}
- m3Len := fmt.Sprintf("%d", len(m3))
- nilMap3 := map[interface{}]interface{}(nil)
- nm3 := (*map[interface{}]interface{})(nil)
- pm3 := &m3
- m3Addr := fmt.Sprintf("%p", pm3)
- pm3Addr := fmt.Sprintf("%p", &pm3)
- m3t := "map[interface {}]interface {}"
- m3t1 := "string"
- m3t2 := "int"
- m3s := "(len=" + m3Len + ") {\n (" + m3t1 + ") (len=" + k3Len + ") " +
- "\"one\": (" + m3t2 + ") 1\n}"
- addDumpTest(m3, "("+m3t+") "+m3s+"\n")
- addDumpTest(pm3, "(*"+m3t+")("+m3Addr+")("+m3s+")\n")
- addDumpTest(&pm3, "(**"+m3t+")("+pm3Addr+"->"+m3Addr+")("+m3s+")\n")
- addDumpTest(nm3, "(*"+m3t+")()\n")
- addDumpTest(nilMap3, "("+m3t+") \n")
-
- // Map with nil interface value.
- k4 := "nil"
- k4Len := fmt.Sprintf("%d", len(k4))
- m4 := map[string]interface{}{k4: nil}
- m4Len := fmt.Sprintf("%d", len(m4))
- nilMap4 := map[string]interface{}(nil)
- nm4 := (*map[string]interface{})(nil)
- pm4 := &m4
- m4Addr := fmt.Sprintf("%p", pm4)
- pm4Addr := fmt.Sprintf("%p", &pm4)
- m4t := "map[string]interface {}"
- m4t1 := "string"
- m4t2 := "interface {}"
- m4s := "(len=" + m4Len + ") {\n (" + m4t1 + ") (len=" + k4Len + ")" +
- " \"nil\": (" + m4t2 + ") \n}"
- addDumpTest(m4, "("+m4t+") "+m4s+"\n")
- addDumpTest(pm4, "(*"+m4t+")("+m4Addr+")("+m4s+")\n")
- addDumpTest(&pm4, "(**"+m4t+")("+pm4Addr+"->"+m4Addr+")("+m4s+")\n")
- addDumpTest(nm4, "(*"+m4t+")()\n")
- addDumpTest(nilMap4, "("+m4t+") \n")
-}
-
-func addStructDumpTests() {
- // Struct with primitives.
- type s1 struct {
- a int8
- b uint8
- }
- v := s1{127, 255}
- nv := (*s1)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.s1"
- vt2 := "int8"
- vt3 := "uint8"
- vs := "{\n a: (" + vt2 + ") 127,\n b: (" + vt3 + ") 255\n}"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Struct that contains another struct.
- type s2 struct {
- s1 s1
- b bool
- }
- v2 := s2{s1{127, 255}, true}
- nv2 := (*s2)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.s2"
- v2t2 := "spew_test.s1"
- v2t3 := "int8"
- v2t4 := "uint8"
- v2t5 := "bool"
- v2s := "{\n s1: (" + v2t2 + ") {\n a: (" + v2t3 + ") 127,\n b: (" +
- v2t4 + ") 255\n },\n b: (" + v2t5 + ") true\n}"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")()\n")
-
- // Struct that contains custom type with Stringer pointer interface via both
- // exported and unexported fields.
- type s3 struct {
- s pstringer
- S pstringer
- }
- v3 := s3{"test", "test2"}
- nv3 := (*s3)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.s3"
- v3t2 := "spew_test.pstringer"
- v3s := "{\n s: (" + v3t2 + ") (len=4) stringer test,\n S: (" + v3t2 +
- ") (len=5) stringer test2\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")()\n")
-
- // Struct that contains embedded struct and field to same struct.
- e := embed{"embedstr"}
- eLen := fmt.Sprintf("%d", len("embedstr"))
- v4 := embedwrap{embed: &e, e: &e}
- nv4 := (*embedwrap)(nil)
- pv4 := &v4
- eAddr := fmt.Sprintf("%p", &e)
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "spew_test.embedwrap"
- v4t2 := "spew_test.embed"
- v4t3 := "string"
- v4s := "{\n embed: (*" + v4t2 + ")(" + eAddr + ")({\n a: (" + v4t3 +
- ") (len=" + eLen + ") \"embedstr\"\n }),\n e: (*" + v4t2 +
- ")(" + eAddr + ")({\n a: (" + v4t3 + ") (len=" + eLen + ")" +
- " \"embedstr\"\n })\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
- addDumpTest(pv4, "(*"+v4t+")("+v4Addr+")("+v4s+")\n")
- addDumpTest(&pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")("+v4s+")\n")
- addDumpTest(nv4, "(*"+v4t+")()\n")
-}
-
-func addUintptrDumpTests() {
- // Null pointer.
- v := uintptr(0)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uintptr"
- vs := ""
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
-
- // Address of real variable.
- i := 1
- v2 := uintptr(unsafe.Pointer(&i))
- nv2 := (*uintptr)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uintptr"
- v2s := fmt.Sprintf("%p", &i)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")()\n")
-}
-
-func addUnsafePointerDumpTests() {
- // Null pointer.
- v := unsafe.Pointer(uintptr(0))
- nv := (*unsafe.Pointer)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "unsafe.Pointer"
- vs := ""
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Address of real variable.
- i := 1
- v2 := unsafe.Pointer(&i)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "unsafe.Pointer"
- v2s := fmt.Sprintf("%p", &i)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-}
-
-func addChanDumpTests() {
- // Nil channel.
- var v chan int
- pv := &v
- nv := (*chan int)(nil)
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "chan int"
- vs := ""
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Real channel.
- v2 := make(chan int)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "chan int"
- v2s := fmt.Sprintf("%p", v2)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
-}
-
-func addFuncDumpTests() {
- // Function with no params and no returns.
- v := addIntDumpTests
- nv := (*func())(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "func()"
- vs := fmt.Sprintf("%p", v)
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-
- // Function with param and no returns.
- v2 := TestDump
- nv2 := (*func(*testing.T))(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "func(*testing.T)"
- v2s := fmt.Sprintf("%p", v2)
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s+")\n")
- addDumpTest(nv2, "(*"+v2t+")()\n")
-
- // Function with multiple params and multiple returns.
- var v3 = func(i int, s string) (b bool, err error) {
- return true, nil
- }
- nv3 := (*func(int, string) (bool, error))(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "func(int, string) (bool, error)"
- v3s := fmt.Sprintf("%p", v3)
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s+")\n")
- addDumpTest(nv3, "(*"+v3t+")()\n")
-}
-
-func addCircularDumpTests() {
- // Struct that is circular through self referencing.
- type circular struct {
- c *circular
- }
- v := circular{nil}
- v.c = &v
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.circular"
- vs := "{\n c: (*" + vt + ")(" + vAddr + ")({\n c: (*" + vt + ")(" +
- vAddr + ")()\n })\n}"
- vs2 := "{\n c: (*" + vt + ")(" + vAddr + ")()\n}"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs2+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs2+")\n")
-
- // Structs that are circular through cross referencing.
- v2 := xref1{nil}
- ts2 := xref2{&v2}
- v2.ps2 = &ts2
- pv2 := &v2
- ts2Addr := fmt.Sprintf("%p", &ts2)
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.xref1"
- v2t2 := "spew_test.xref2"
- v2s := "{\n ps2: (*" + v2t2 + ")(" + ts2Addr + ")({\n ps1: (*" + v2t +
- ")(" + v2Addr + ")({\n ps2: (*" + v2t2 + ")(" + ts2Addr +
- ")()\n })\n })\n}"
- v2s2 := "{\n ps2: (*" + v2t2 + ")(" + ts2Addr + ")({\n ps1: (*" + v2t +
- ")(" + v2Addr + ")()\n })\n}"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
- addDumpTest(pv2, "(*"+v2t+")("+v2Addr+")("+v2s2+")\n")
- addDumpTest(&pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")("+v2s2+")\n")
-
- // Structs that are indirectly circular.
- v3 := indirCir1{nil}
- tic2 := indirCir2{nil}
- tic3 := indirCir3{&v3}
- tic2.ps3 = &tic3
- v3.ps2 = &tic2
- pv3 := &v3
- tic2Addr := fmt.Sprintf("%p", &tic2)
- tic3Addr := fmt.Sprintf("%p", &tic3)
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.indirCir1"
- v3t2 := "spew_test.indirCir2"
- v3t3 := "spew_test.indirCir3"
- v3s := "{\n ps2: (*" + v3t2 + ")(" + tic2Addr + ")({\n ps3: (*" + v3t3 +
- ")(" + tic3Addr + ")({\n ps1: (*" + v3t + ")(" + v3Addr +
- ")({\n ps2: (*" + v3t2 + ")(" + tic2Addr +
- ")()\n })\n })\n })\n}"
- v3s2 := "{\n ps2: (*" + v3t2 + ")(" + tic2Addr + ")({\n ps3: (*" + v3t3 +
- ")(" + tic3Addr + ")({\n ps1: (*" + v3t + ")(" + v3Addr +
- ")()\n })\n })\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
- addDumpTest(pv3, "(*"+v3t+")("+v3Addr+")("+v3s2+")\n")
- addDumpTest(&pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")("+v3s2+")\n")
-}
-
-func addPanicDumpTests() {
- // Type that panics in its Stringer interface.
- v := panicer(127)
- nv := (*panicer)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.panicer"
- vs := "(PANIC=test panic)127"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-}
-
-func addErrorDumpTests() {
- // Type that has a custom Error interface.
- v := customError(127)
- nv := (*customError)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.customError"
- vs := "error: 127"
- addDumpTest(v, "("+vt+") "+vs+"\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")("+vs+")\n")
- addDumpTest(nv, "(*"+vt+")()\n")
-}
-
-// TestDump executes all of the tests described by dumpTests.
-func TestDump(t *testing.T) {
- // Setup tests.
- addIntDumpTests()
- addUintDumpTests()
- addBoolDumpTests()
- addFloatDumpTests()
- addComplexDumpTests()
- addArrayDumpTests()
- addSliceDumpTests()
- addStringDumpTests()
- addInterfaceDumpTests()
- addMapDumpTests()
- addStructDumpTests()
- addUintptrDumpTests()
- addUnsafePointerDumpTests()
- addChanDumpTests()
- addFuncDumpTests()
- addCircularDumpTests()
- addPanicDumpTests()
- addErrorDumpTests()
- addCgoDumpTests()
-
- t.Logf("Running %d tests", len(dumpTests))
- for i, test := range dumpTests {
- buf := new(bytes.Buffer)
- spew.Fdump(buf, test.in)
- s := buf.String()
- if testFailed(s, test.wants) {
- t.Errorf("Dump #%d\n got: %s %s", i, s, stringizeWants(test.wants))
- continue
- }
- }
-}
-
-func TestDumpSortedKeys(t *testing.T) {
- cfg := spew.ConfigState{SortKeys: true}
- s := cfg.Sdump(map[int]string{1: "1", 3: "3", 2: "2"})
- expected := `(map[int]string) (len=3) {
-(int) 1: (string) (len=1) "1",
-(int) 2: (string) (len=1) "2",
-(int) 3: (string) (len=1) "3"
-}
-`
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
- s = cfg.Sdump(map[stringer]int{"1": 1, "3": 3, "2": 2})
- expected = `(map[spew_test.stringer]int) (len=3) {
-(spew_test.stringer) (len=1) stringer 1: (int) 1,
-(spew_test.stringer) (len=1) stringer 2: (int) 2,
-(spew_test.stringer) (len=1) stringer 3: (int) 3
-}
-`
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
- s = cfg.Sdump(map[pstringer]int{pstringer("1"): 1, pstringer("3"): 3, pstringer("2"): 2})
- expected = `(map[spew_test.pstringer]int) (len=3) {
-(spew_test.pstringer) (len=1) stringer 1: (int) 1,
-(spew_test.pstringer) (len=1) stringer 2: (int) 2,
-(spew_test.pstringer) (len=1) stringer 3: (int) 3
-}
-`
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
- s = cfg.Sdump(map[customError]int{customError(1): 1, customError(3): 3, customError(2): 2})
- expected = `(map[spew_test.customError]int) (len=3) {
-(spew_test.customError) error: 1: (int) 1,
-(spew_test.customError) error: 2: (int) 2,
-(spew_test.customError) error: 3: (int) 3
-}
-`
- if s != expected {
- t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dumpcgo_test.go b/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dumpcgo_test.go
deleted file mode 100644
index 9b8a358ec8d..00000000000
--- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dumpcgo_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2013 Dave Collins
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when both cgo is supported and "-tags testcgo" is added to the go test
-// command line. This means the cgo tests are only added (and hence run) when
-// specifially requested. This configuration is used because spew itself
-// does not require cgo to run even though it does handle certain cgo types
-// specially. Rather than forcing all clients to require cgo and an external
-// C compiler just to run the tests, this scheme makes them optional.
-// +build cgo,testcgo
-
-package spew_test
-
-import (
- "fmt"
- "github.com/davecgh/go-spew/spew/testdata"
-)
-
-func addCgoDumpTests() {
- // C char pointer.
- v := testdata.GetCgoCharPointer()
- nv := testdata.GetCgoNullCharPointer()
- pv := &v
- vcAddr := fmt.Sprintf("%p", v)
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "*testdata._Ctype_char"
- vs := "116"
- addDumpTest(v, "("+vt+")("+vcAddr+")("+vs+")\n")
- addDumpTest(pv, "(*"+vt+")("+vAddr+"->"+vcAddr+")("+vs+")\n")
- addDumpTest(&pv, "(**"+vt+")("+pvAddr+"->"+vAddr+"->"+vcAddr+")("+vs+")\n")
- addDumpTest(nv, "("+vt+")()\n")
-
- // C char array.
- v2, v2l, v2c := testdata.GetCgoCharArray()
- v2Len := fmt.Sprintf("%d", v2l)
- v2Cap := fmt.Sprintf("%d", v2c)
- v2t := "[6]testdata._Ctype_char"
- v2s := "(len=" + v2Len + " cap=" + v2Cap + ") " +
- "{\n 00000000 74 65 73 74 32 00 " +
- " |test2.|\n}"
- addDumpTest(v2, "("+v2t+") "+v2s+"\n")
-
- // C unsigned char array.
- v3, v3l, v3c := testdata.GetCgoUnsignedCharArray()
- v3Len := fmt.Sprintf("%d", v3l)
- v3Cap := fmt.Sprintf("%d", v3c)
- v3t := "[6]testdata._Ctype_unsignedchar"
- v3s := "(len=" + v3Len + " cap=" + v3Cap + ") " +
- "{\n 00000000 74 65 73 74 33 00 " +
- " |test3.|\n}"
- addDumpTest(v3, "("+v3t+") "+v3s+"\n")
-
- // C signed char array.
- v4, v4l, v4c := testdata.GetCgoSignedCharArray()
- v4Len := fmt.Sprintf("%d", v4l)
- v4Cap := fmt.Sprintf("%d", v4c)
- v4t := "[6]testdata._Ctype_schar"
- v4t2 := "testdata._Ctype_schar"
- v4s := "(len=" + v4Len + " cap=" + v4Cap + ") " +
- "{\n (" + v4t2 + ") 116,\n (" + v4t2 + ") 101,\n (" + v4t2 +
- ") 115,\n (" + v4t2 + ") 116,\n (" + v4t2 + ") 52,\n (" + v4t2 +
- ") 0\n}"
- addDumpTest(v4, "("+v4t+") "+v4s+"\n")
-
- // C uint8_t array.
- v5, v5l, v5c := testdata.GetCgoUint8tArray()
- v5Len := fmt.Sprintf("%d", v5l)
- v5Cap := fmt.Sprintf("%d", v5c)
- v5t := "[6]testdata._Ctype_uint8_t"
- v5s := "(len=" + v5Len + " cap=" + v5Cap + ") " +
- "{\n 00000000 74 65 73 74 35 00 " +
- " |test5.|\n}"
- addDumpTest(v5, "("+v5t+") "+v5s+"\n")
-
- // C typedefed unsigned char array.
- v6, v6l, v6c := testdata.GetCgoTypdefedUnsignedCharArray()
- v6Len := fmt.Sprintf("%d", v6l)
- v6Cap := fmt.Sprintf("%d", v6c)
- v6t := "[6]testdata._Ctype_custom_uchar_t"
- v6s := "(len=" + v6Len + " cap=" + v6Cap + ") " +
- "{\n 00000000 74 65 73 74 36 00 " +
- " |test6.|\n}"
- addDumpTest(v6, "("+v6t+") "+v6s+"\n")
-}
diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dumpnocgo_test.go b/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dumpnocgo_test.go
deleted file mode 100644
index 52a0971fb3f..00000000000
--- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/dumpnocgo_test.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2013 Dave Collins
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when either cgo is not supported or "-tags testcgo" is not added to the go
-// test command line. This file intentionally does not setup any cgo tests in
-// this scenario.
-// +build !cgo !testcgo
-
-package spew_test
-
-func addCgoDumpTests() {
- // Don't add any tests for cgo since this file is only compiled when
- // there should not be any cgo tests.
-}
diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/example_test.go b/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/example_test.go
deleted file mode 100644
index a7acd141257..00000000000
--- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/example_test.go
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew_test
-
-import (
- "fmt"
- "github.com/davecgh/go-spew/spew"
-)
-
-type Flag int
-
-const (
- flagOne Flag = iota
- flagTwo
-)
-
-var flagStrings = map[Flag]string{
- flagOne: "flagOne",
- flagTwo: "flagTwo",
-}
-
-func (f Flag) String() string {
- if s, ok := flagStrings[f]; ok {
- return s
- }
- return fmt.Sprintf("Unknown flag (%d)", int(f))
-}
-
-type Bar struct {
- flag Flag
- data uintptr
-}
-
-type Foo struct {
- unexportedField Bar
- ExportedField map[interface{}]interface{}
-}
-
-// This example demonstrates how to use Dump to dump variables to stdout.
-func ExampleDump() {
- // The following package level declarations are assumed for this example:
- /*
- type Flag int
-
- const (
- flagOne Flag = iota
- flagTwo
- )
-
- var flagStrings = map[Flag]string{
- flagOne: "flagOne",
- flagTwo: "flagTwo",
- }
-
- func (f Flag) String() string {
- if s, ok := flagStrings[f]; ok {
- return s
- }
- return fmt.Sprintf("Unknown flag (%d)", int(f))
- }
-
- type Bar struct {
- flag Flag
- data uintptr
- }
-
- type Foo struct {
- unexportedField Bar
- ExportedField map[interface{}]interface{}
- }
- */
-
- // Setup some sample data structures for the example.
- bar := Bar{Flag(flagTwo), uintptr(0)}
- s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
- f := Flag(5)
- b := []byte{
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
- 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32,
- }
-
- // Dump!
- spew.Dump(s1, f, b)
-
- // Output:
- // (spew_test.Foo) {
- // unexportedField: (spew_test.Bar) {
- // flag: (spew_test.Flag) flagTwo,
- // data: (uintptr)
- // },
- // ExportedField: (map[interface {}]interface {}) (len=1) {
- // (string) (len=3) "one": (bool) true
- // }
- // }
- // (spew_test.Flag) Unknown flag (5)
- // ([]uint8) (len=34 cap=34) {
- // 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
- // 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
- // 00000020 31 32 |12|
- // }
- //
-}
-
-// This example demonstrates how to use Printf to display a variable with a
-// format string and inline formatting.
-func ExamplePrintf() {
- // Create a double pointer to a uint 8.
- ui8 := uint8(5)
- pui8 := &ui8
- ppui8 := &pui8
-
- // Create a circular data type.
- type circular struct {
- ui8 uint8
- c *circular
- }
- c := circular{ui8: 1}
- c.c = &c
-
- // Print!
- spew.Printf("ppui8: %v\n", ppui8)
- spew.Printf("circular: %v\n", c)
-
- // Output:
- // ppui8: <**>5
- // circular: {1 <*>{1 <*>}}
-}
-
-// This example demonstrates how to use a ConfigState.
-func ExampleConfigState() {
- // Modify the indent level of the ConfigState only. The global
- // configuration is not modified.
- scs := spew.ConfigState{Indent: "\t"}
-
- // Output using the ConfigState instance.
- v := map[string]int{"one": 1}
- scs.Printf("v: %v\n", v)
- scs.Dump(v)
-
- // Output:
- // v: map[one:1]
- // (map[string]int) (len=1) {
- // (string) (len=3) "one": (int) 1
- // }
-}
-
-// This example demonstrates how to use ConfigState.Dump to dump variables to
-// stdout
-func ExampleConfigState_Dump() {
- // See the top-level Dump example for details on the types used in this
- // example.
-
- // Create two ConfigState instances with different indentation.
- scs := spew.ConfigState{Indent: "\t"}
- scs2 := spew.ConfigState{Indent: " "}
-
- // Setup some sample data structures for the example.
- bar := Bar{Flag(flagTwo), uintptr(0)}
- s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
-
- // Dump using the ConfigState instances.
- scs.Dump(s1)
- scs2.Dump(s1)
-
- // Output:
- // (spew_test.Foo) {
- // unexportedField: (spew_test.Bar) {
- // flag: (spew_test.Flag) flagTwo,
- // data: (uintptr)
- // },
- // ExportedField: (map[interface {}]interface {}) (len=1) {
- // (string) (len=3) "one": (bool) true
- // }
- // }
- // (spew_test.Foo) {
- // unexportedField: (spew_test.Bar) {
- // flag: (spew_test.Flag) flagTwo,
- // data: (uintptr)
- // },
- // ExportedField: (map[interface {}]interface {}) (len=1) {
- // (string) (len=3) "one": (bool) true
- // }
- // }
- //
-}
-
-// This example demonstrates how to use ConfigState.Printf to display a variable
-// with a format string and inline formatting.
-func ExampleConfigState_Printf() {
- // See the top-level Dump example for details on the types used in this
- // example.
-
- // Create two ConfigState instances and modify the method handling of the
- // first ConfigState only.
- scs := spew.NewDefaultConfig()
- scs2 := spew.NewDefaultConfig()
- scs.DisableMethods = true
-
- // Alternatively
- // scs := spew.ConfigState{Indent: " ", DisableMethods: true}
- // scs2 := spew.ConfigState{Indent: " "}
-
- // This is of type Flag which implements a Stringer and has raw value 1.
- f := flagTwo
-
- // Dump using the ConfigState instances.
- scs.Printf("f: %v\n", f)
- scs2.Printf("f: %v\n", f)
-
- // Output:
- // f: 1
- // f: flagTwo
-}
diff --git a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/format_test.go b/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/format_test.go
deleted file mode 100644
index b0f9761a4c4..00000000000
--- a/Godeps/_workspace/src/github.com/davecgh/go-spew/spew/format_test.go
+++ /dev/null
@@ -1,1535 +0,0 @@
-/*
- * Copyright (c) 2013 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
-Test Summary:
-NOTE: For each test, a nil pointer, a single pointer and double pointer to the
-base test element are also tested to ensure proper indirection across all types.
-
-- Max int8, int16, int32, int64, int
-- Max uint8, uint16, uint32, uint64, uint
-- Boolean true and false
-- Standard complex64 and complex128
-- Array containing standard ints
-- Array containing type with custom formatter on pointer receiver only
-- Array containing interfaces
-- Slice containing standard float32 values
-- Slice containing type with custom formatter on pointer receiver only
-- Slice containing interfaces
-- Nil slice
-- Standard string
-- Nil interface
-- Sub-interface
-- Map with string keys and int vals
-- Map with custom formatter type on pointer receiver only keys and vals
-- Map with interface keys and values
-- Map with nil interface value
-- Struct with primitives
-- Struct that contains another struct
-- Struct that contains custom type with Stringer pointer interface via both
- exported and unexported fields
-- Struct that contains embedded struct and field to same struct
-- Uintptr to 0 (null pointer)
-- Uintptr address of real variable
-- Unsafe.Pointer to 0 (null pointer)
-- Unsafe.Pointer to address of real variable
-- Nil channel
-- Standard int channel
-- Function with no params and no returns
-- Function with param and no returns
-- Function with multiple params and multiple returns
-- Struct that is circular through self referencing
-- Structs that are circular through cross referencing
-- Structs that are indirectly circular
-- Type that panics in its Stringer interface
-- Type that has a custom Error interface
-- %x passthrough with uint
-- %#x passthrough with uint
-- %f passthrough with precision
-- %f passthrough with width and precision
-- %d passthrough with width
-- %q passthrough with string
-*/
-
-package spew_test
-
-import (
- "bytes"
- "fmt"
- "testing"
- "unsafe"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-// formatterTest is used to describe a test to be perfomed against NewFormatter.
-type formatterTest struct {
- format string
- in interface{}
- wants []string
-}
-
-// formatterTests houses all of the tests to be performed against NewFormatter.
-var formatterTests = make([]formatterTest, 0)
-
-// addFormatterTest is a helper method to append the passed input and desired
-// result to formatterTests.
-func addFormatterTest(format string, in interface{}, wants ...string) {
- test := formatterTest{format, in, wants}
- formatterTests = append(formatterTests, test)
-}
-
-func addIntFormatterTests() {
- // Max int8.
- v := int8(127)
- nv := (*int8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "int8"
- vs := "127"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Max int16.
- v2 := int16(32767)
- nv2 := (*int16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "int16"
- v2s := "32767"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-
- // Max int32.
- v3 := int32(2147483647)
- nv3 := (*int32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "int32"
- v3s := "2147483647"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%v", nv3, "")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
-
- // Max int64.
- v4 := int64(9223372036854775807)
- nv4 := (*int64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "int64"
- v4s := "9223372036854775807"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%v", nv4, "")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"")
-
- // Max int.
- v5 := int(2147483647)
- nv5 := (*int)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "int"
- v5s := "2147483647"
- addFormatterTest("%v", v5, v5s)
- addFormatterTest("%v", pv5, "<*>"+v5s)
- addFormatterTest("%v", &pv5, "<**>"+v5s)
- addFormatterTest("%v", nv5, "")
- addFormatterTest("%+v", v5, v5s)
- addFormatterTest("%+v", pv5, "<*>("+v5Addr+")"+v5s)
- addFormatterTest("%+v", &pv5, "<**>("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%+v", nv5, "")
- addFormatterTest("%#v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#v", pv5, "(*"+v5t+")"+v5s)
- addFormatterTest("%#v", &pv5, "(**"+v5t+")"+v5s)
- addFormatterTest("%#v", nv5, "(*"+v5t+")"+"")
- addFormatterTest("%#+v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#+v", pv5, "(*"+v5t+")("+v5Addr+")"+v5s)
- addFormatterTest("%#+v", &pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%#+v", nv5, "(*"+v5t+")"+"")
-}
-
-func addUintFormatterTests() {
- // Max uint8.
- v := uint8(255)
- nv := (*uint8)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uint8"
- vs := "255"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Max uint16.
- v2 := uint16(65535)
- nv2 := (*uint16)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-
- // Max uint32.
- v3 := uint32(4294967295)
- nv3 := (*uint32)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "uint32"
- v3s := "4294967295"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%v", nv3, "")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
-
- // Max uint64.
- v4 := uint64(18446744073709551615)
- nv4 := (*uint64)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "uint64"
- v4s := "18446744073709551615"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%v", nv4, "")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"")
-
- // Max uint.
- v5 := uint(4294967295)
- nv5 := (*uint)(nil)
- pv5 := &v5
- v5Addr := fmt.Sprintf("%p", pv5)
- pv5Addr := fmt.Sprintf("%p", &pv5)
- v5t := "uint"
- v5s := "4294967295"
- addFormatterTest("%v", v5, v5s)
- addFormatterTest("%v", pv5, "<*>"+v5s)
- addFormatterTest("%v", &pv5, "<**>"+v5s)
- addFormatterTest("%v", nv5, "")
- addFormatterTest("%+v", v5, v5s)
- addFormatterTest("%+v", pv5, "<*>("+v5Addr+")"+v5s)
- addFormatterTest("%+v", &pv5, "<**>("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%+v", nv5, "")
- addFormatterTest("%#v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#v", pv5, "(*"+v5t+")"+v5s)
- addFormatterTest("%#v", &pv5, "(**"+v5t+")"+v5s)
- addFormatterTest("%#v", nv5, "(*"+v5t+")"+"")
- addFormatterTest("%#+v", v5, "("+v5t+")"+v5s)
- addFormatterTest("%#+v", pv5, "(*"+v5t+")("+v5Addr+")"+v5s)
- addFormatterTest("%#+v", &pv5, "(**"+v5t+")("+pv5Addr+"->"+v5Addr+")"+v5s)
- addFormatterTest("%#v", nv5, "(*"+v5t+")"+"")
-}
-
-func addBoolFormatterTests() {
- // Boolean true.
- v := bool(true)
- nv := (*bool)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "bool"
- vs := "true"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Boolean false.
- v2 := bool(false)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "bool"
- v2s := "false"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addFloatFormatterTests() {
- // Standard float32.
- v := float32(3.1415)
- nv := (*float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "float32"
- vs := "3.1415"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Standard float64.
- v2 := float64(3.1415926)
- nv2 := (*float64)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "float64"
- v2s := "3.1415926"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-}
-
-func addComplexFormatterTests() {
- // Standard complex64.
- v := complex(float32(6), -2)
- nv := (*complex64)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "complex64"
- vs := "(6-2i)"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Standard complex128.
- v2 := complex(float64(-6), 2)
- nv2 := (*complex128)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "complex128"
- v2s := "(-6+2i)"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-}
-
-func addArrayFormatterTests() {
- // Array containing standard ints.
- v := [3]int{1, 2, 3}
- nv := (*[3]int)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "[3]int"
- vs := "[1 2 3]"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Array containing type with custom formatter on pointer receiver only.
- v2 := [3]pstringer{"1", "2", "3"}
- nv2 := (*[3]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "[3]spew_test.pstringer"
- v2s := "[stringer 1 stringer 2 stringer 3]"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-
- // Array containing interfaces.
- v3 := [3]interface{}{"one", int(2), uint(3)}
- nv3 := (*[3]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[3]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3s := "[one 2 3]"
- v3s2 := "[(" + v3t2 + ")one (" + v3t3 + ")2 (" + v3t4 + ")3]"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s2)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s2)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"")
-}
-
-func addSliceFormatterTests() {
- // Slice containing standard float32 values.
- v := []float32{3.14, 6.28, 12.56}
- nv := (*[]float32)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "[]float32"
- vs := "[3.14 6.28 12.56]"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Slice containing type with custom formatter on pointer receiver only.
- v2 := []pstringer{"1", "2", "3"}
- nv2 := (*[]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "[]spew_test.pstringer"
- v2s := "[stringer 1 stringer 2 stringer 3]"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-
- // Slice containing interfaces.
- v3 := []interface{}{"one", int(2), uint(3), nil}
- nv3 := (*[]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "[]interface {}"
- v3t2 := "string"
- v3t3 := "int"
- v3t4 := "uint"
- v3t5 := "interface {}"
- v3s := "[one 2 3 ]"
- v3s2 := "[(" + v3t2 + ")one (" + v3t3 + ")2 (" + v3t4 + ")3 (" + v3t5 +
- ")]"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s2)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s2)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"")
-
- // Nil slice.
- var v4 []int
- nv4 := (*[]int)(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "[]int"
- v4s := ""
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"")
-}
-
-func addStringFormatterTests() {
- // Standard string.
- v := "test"
- nv := (*string)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "string"
- vs := "test"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-}
-
-func addInterfaceFormatterTests() {
- // Nil interface.
- var v interface{}
- nv := (*interface{})(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "interface {}"
- vs := ""
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Sub-interface.
- v2 := interface{}(uint16(65535))
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uint16"
- v2s := "65535"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addMapFormatterTests() {
- // Map with string keys and int vals.
- v := map[string]int{"one": 1, "two": 2}
- nilMap := map[string]int(nil)
- nv := (*map[string]int)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "map[string]int"
- vs := "map[one:1 two:2]"
- vs2 := "map[two:2 one:1]"
- addFormatterTest("%v", v, vs, vs2)
- addFormatterTest("%v", pv, "<*>"+vs, "<*>"+vs2)
- addFormatterTest("%v", &pv, "<**>"+vs, "<**>"+vs2)
- addFormatterTest("%+v", nilMap, "")
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs, vs2)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs, "<*>("+vAddr+")"+vs2)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs,
- "<**>("+pvAddr+"->"+vAddr+")"+vs2)
- addFormatterTest("%+v", nilMap, "")
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs, "("+vt+")"+vs2)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs, "(*"+vt+")"+vs2)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs, "(**"+vt+")"+vs2)
- addFormatterTest("%#v", nilMap, "("+vt+")"+"")
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs, "("+vt+")"+vs2)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs,
- "(*"+vt+")("+vAddr+")"+vs2)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs,
- "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs2)
- addFormatterTest("%#+v", nilMap, "("+vt+")"+"")
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Map with custom formatter type on pointer receiver only keys and vals.
- v2 := map[pstringer]pstringer{"one": "1"}
- nv2 := (*map[pstringer]pstringer)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "map[spew_test.pstringer]spew_test.pstringer"
- v2s := "map[stringer one:stringer 1]"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-
- // Map with interface keys and values.
- v3 := map[interface{}]interface{}{"one": 1}
- nv3 := (*map[interface{}]interface{})(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "map[interface {}]interface {}"
- v3t1 := "string"
- v3t2 := "int"
- v3s := "map[one:1]"
- v3s2 := "map[(" + v3t1 + ")one:(" + v3t2 + ")1]"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s2)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s2)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s2)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s2)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"")
-
- // Map with nil interface value
- v4 := map[string]interface{}{"nil": nil}
- nv4 := (*map[string]interface{})(nil)
- pv4 := &v4
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "map[string]interface {}"
- v4t1 := "interface {}"
- v4s := "map[nil:]"
- v4s2 := "map[nil:(" + v4t1 + ")]"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%+v", v4, v4s)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s2)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s2)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s2)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s2)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s2)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s2)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"")
-}
-
-func addStructFormatterTests() {
- // Struct with primitives.
- type s1 struct {
- a int8
- b uint8
- }
- v := s1{127, 255}
- nv := (*s1)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.s1"
- vt2 := "int8"
- vt3 := "uint8"
- vs := "{127 255}"
- vs2 := "{a:127 b:255}"
- vs3 := "{a:(" + vt2 + ")127 b:(" + vt3 + ")255}"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs2)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs2)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs2)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs3)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs3)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs3)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs3)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs3)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs3)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Struct that contains another struct.
- type s2 struct {
- s1 s1
- b bool
- }
- v2 := s2{s1{127, 255}, true}
- nv2 := (*s2)(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.s2"
- v2t2 := "spew_test.s1"
- v2t3 := "int8"
- v2t4 := "uint8"
- v2t5 := "bool"
- v2s := "{{127 255} true}"
- v2s2 := "{s1:{a:127 b:255} b:true}"
- v2s3 := "{s1:(" + v2t2 + "){a:(" + v2t3 + ")127 b:(" + v2t4 + ")255} b:(" +
- v2t5 + ")true}"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%+v", v2, v2s2)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s2)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s2)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s3)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s3)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s3)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s3)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s3)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s3)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-
- // Struct that contains custom type with Stringer pointer interface via both
- // exported and unexported fields.
- type s3 struct {
- s pstringer
- S pstringer
- }
- v3 := s3{"test", "test2"}
- nv3 := (*s3)(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.s3"
- v3t2 := "spew_test.pstringer"
- v3s := "{stringer test stringer test2}"
- v3s2 := "{s:stringer test S:stringer test2}"
- v3s3 := "{s:(" + v3t2 + ")stringer test S:(" + v3t2 + ")stringer test2}"
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%+v", v3, v3s2)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s2)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s2)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s3)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s3)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s3)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s3)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s3)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s3)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"")
-
- // Struct that contains embedded struct and field to same struct.
- e := embed{"embedstr"}
- v4 := embedwrap{embed: &e, e: &e}
- nv4 := (*embedwrap)(nil)
- pv4 := &v4
- eAddr := fmt.Sprintf("%p", &e)
- v4Addr := fmt.Sprintf("%p", pv4)
- pv4Addr := fmt.Sprintf("%p", &pv4)
- v4t := "spew_test.embedwrap"
- v4t2 := "spew_test.embed"
- v4t3 := "string"
- v4s := "{<*>{embedstr} <*>{embedstr}}"
- v4s2 := "{embed:<*>(" + eAddr + "){a:embedstr} e:<*>(" + eAddr +
- "){a:embedstr}}"
- v4s3 := "{embed:(*" + v4t2 + "){a:(" + v4t3 + ")embedstr} e:(*" + v4t2 +
- "){a:(" + v4t3 + ")embedstr}}"
- v4s4 := "{embed:(*" + v4t2 + ")(" + eAddr + "){a:(" + v4t3 +
- ")embedstr} e:(*" + v4t2 + ")(" + eAddr + "){a:(" + v4t3 + ")embedstr}}"
- addFormatterTest("%v", v4, v4s)
- addFormatterTest("%v", pv4, "<*>"+v4s)
- addFormatterTest("%v", &pv4, "<**>"+v4s)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%+v", v4, v4s2)
- addFormatterTest("%+v", pv4, "<*>("+v4Addr+")"+v4s2)
- addFormatterTest("%+v", &pv4, "<**>("+pv4Addr+"->"+v4Addr+")"+v4s2)
- addFormatterTest("%+v", nv4, "")
- addFormatterTest("%#v", v4, "("+v4t+")"+v4s3)
- addFormatterTest("%#v", pv4, "(*"+v4t+")"+v4s3)
- addFormatterTest("%#v", &pv4, "(**"+v4t+")"+v4s3)
- addFormatterTest("%#v", nv4, "(*"+v4t+")"+"")
- addFormatterTest("%#+v", v4, "("+v4t+")"+v4s4)
- addFormatterTest("%#+v", pv4, "(*"+v4t+")("+v4Addr+")"+v4s4)
- addFormatterTest("%#+v", &pv4, "(**"+v4t+")("+pv4Addr+"->"+v4Addr+")"+v4s4)
- addFormatterTest("%#+v", nv4, "(*"+v4t+")"+"")
-}
-
-func addUintptrFormatterTests() {
- // Null pointer.
- v := uintptr(0)
- nv := (*uintptr)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "uintptr"
- vs := ""
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Address of real variable.
- i := 1
- v2 := uintptr(unsafe.Pointer(&i))
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "uintptr"
- v2s := fmt.Sprintf("%p", &i)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addUnsafePointerFormatterTests() {
- // Null pointer.
- v := unsafe.Pointer(uintptr(0))
- nv := (*unsafe.Pointer)(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "unsafe.Pointer"
- vs := ""
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Address of real variable.
- i := 1
- v2 := unsafe.Pointer(&i)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "unsafe.Pointer"
- v2s := fmt.Sprintf("%p", &i)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addChanFormatterTests() {
- // Nil channel.
- var v chan int
- pv := &v
- nv := (*chan int)(nil)
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "chan int"
- vs := ""
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Real channel.
- v2 := make(chan int)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "chan int"
- v2s := fmt.Sprintf("%p", v2)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
-}
-
-func addFuncFormatterTests() {
- // Function with no params and no returns.
- v := addIntFormatterTests
- nv := (*func())(nil)
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "func()"
- vs := fmt.Sprintf("%p", v)
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs)
- addFormatterTest("%v", &pv, "<**>"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%+v", v, vs)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%+v", nv, "")
- addFormatterTest("%#v", v, "("+vt+")"+vs)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs)
- addFormatterTest("%#v", nv, "(*"+vt+")"+"")
- addFormatterTest("%#+v", v, "("+vt+")"+vs)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs)
- addFormatterTest("%#+v", nv, "(*"+vt+")"+"")
-
- // Function with param and no returns.
- v2 := TestFormatter
- nv2 := (*func(*testing.T))(nil)
- pv2 := &v2
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "func(*testing.T)"
- v2s := fmt.Sprintf("%p", v2)
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s)
- addFormatterTest("%v", &pv2, "<**>"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%+v", v2, v2s)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%+v", nv2, "")
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s)
- addFormatterTest("%#v", nv2, "(*"+v2t+")"+"")
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s)
- addFormatterTest("%#+v", nv2, "(*"+v2t+")"+"")
-
- // Function with multiple params and multiple returns.
- var v3 = func(i int, s string) (b bool, err error) {
- return true, nil
- }
- nv3 := (*func(int, string) (bool, error))(nil)
- pv3 := &v3
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "func(int, string) (bool, error)"
- v3s := fmt.Sprintf("%p", v3)
- addFormatterTest("%v", v3, v3s)
- addFormatterTest("%v", pv3, "<*>"+v3s)
- addFormatterTest("%v", &pv3, "<**>"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%+v", v3, v3s)
- addFormatterTest("%+v", pv3, "<*>("+v3Addr+")"+v3s)
- addFormatterTest("%+v", &pv3, "<**>("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%+v", nv3, "")
- addFormatterTest("%#v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#v", pv3, "(*"+v3t+")"+v3s)
- addFormatterTest("%#v", &pv3, "(**"+v3t+")"+v3s)
- addFormatterTest("%#v", nv3, "(*"+v3t+")"+"")
- addFormatterTest("%#+v", v3, "("+v3t+")"+v3s)
- addFormatterTest("%#+v", pv3, "(*"+v3t+")("+v3Addr+")"+v3s)
- addFormatterTest("%#+v", &pv3, "(**"+v3t+")("+pv3Addr+"->"+v3Addr+")"+v3s)
- addFormatterTest("%#+v", nv3, "(*"+v3t+")"+"")
-}
-
-func addCircularFormatterTests() {
- // Struct that is circular through self referencing.
- type circular struct {
- c *circular
- }
- v := circular{nil}
- v.c = &v
- pv := &v
- vAddr := fmt.Sprintf("%p", pv)
- pvAddr := fmt.Sprintf("%p", &pv)
- vt := "spew_test.circular"
- vs := "{<*>{<*>}}"
- vs2 := "{<*>}"
- vs3 := "{c:<*>(" + vAddr + "){c:<*>(" + vAddr + ")}}"
- vs4 := "{c:<*>(" + vAddr + ")}"
- vs5 := "{c:(*" + vt + "){c:(*" + vt + ")}}"
- vs6 := "{c:(*" + vt + ")}"
- vs7 := "{c:(*" + vt + ")(" + vAddr + "){c:(*" + vt + ")(" + vAddr +
- ")}}"
- vs8 := "{c:(*" + vt + ")(" + vAddr + ")}"
- addFormatterTest("%v", v, vs)
- addFormatterTest("%v", pv, "<*>"+vs2)
- addFormatterTest("%v", &pv, "<**>"+vs2)
- addFormatterTest("%+v", v, vs3)
- addFormatterTest("%+v", pv, "<*>("+vAddr+")"+vs4)
- addFormatterTest("%+v", &pv, "<**>("+pvAddr+"->"+vAddr+")"+vs4)
- addFormatterTest("%#v", v, "("+vt+")"+vs5)
- addFormatterTest("%#v", pv, "(*"+vt+")"+vs6)
- addFormatterTest("%#v", &pv, "(**"+vt+")"+vs6)
- addFormatterTest("%#+v", v, "("+vt+")"+vs7)
- addFormatterTest("%#+v", pv, "(*"+vt+")("+vAddr+")"+vs8)
- addFormatterTest("%#+v", &pv, "(**"+vt+")("+pvAddr+"->"+vAddr+")"+vs8)
-
- // Structs that are circular through cross referencing.
- v2 := xref1{nil}
- ts2 := xref2{&v2}
- v2.ps2 = &ts2
- pv2 := &v2
- ts2Addr := fmt.Sprintf("%p", &ts2)
- v2Addr := fmt.Sprintf("%p", pv2)
- pv2Addr := fmt.Sprintf("%p", &pv2)
- v2t := "spew_test.xref1"
- v2t2 := "spew_test.xref2"
- v2s := "{<*>{<*>{<*>}}}"
- v2s2 := "{<*>{<*>}}"
- v2s3 := "{ps2:<*>(" + ts2Addr + "){ps1:<*>(" + v2Addr + "){ps2:<*>(" +
- ts2Addr + ")}}}"
- v2s4 := "{ps2:<*>(" + ts2Addr + "){ps1:<*>(" + v2Addr + ")}}"
- v2s5 := "{ps2:(*" + v2t2 + "){ps1:(*" + v2t + "){ps2:(*" + v2t2 +
- ")}}}"
- v2s6 := "{ps2:(*" + v2t2 + "){ps1:(*" + v2t + ")}}"
- v2s7 := "{ps2:(*" + v2t2 + ")(" + ts2Addr + "){ps1:(*" + v2t +
- ")(" + v2Addr + "){ps2:(*" + v2t2 + ")(" + ts2Addr +
- ")}}}"
- v2s8 := "{ps2:(*" + v2t2 + ")(" + ts2Addr + "){ps1:(*" + v2t +
- ")(" + v2Addr + ")}}"
- addFormatterTest("%v", v2, v2s)
- addFormatterTest("%v", pv2, "<*>"+v2s2)
- addFormatterTest("%v", &pv2, "<**>"+v2s2)
- addFormatterTest("%+v", v2, v2s3)
- addFormatterTest("%+v", pv2, "<*>("+v2Addr+")"+v2s4)
- addFormatterTest("%+v", &pv2, "<**>("+pv2Addr+"->"+v2Addr+")"+v2s4)
- addFormatterTest("%#v", v2, "("+v2t+")"+v2s5)
- addFormatterTest("%#v", pv2, "(*"+v2t+")"+v2s6)
- addFormatterTest("%#v", &pv2, "(**"+v2t+")"+v2s6)
- addFormatterTest("%#+v", v2, "("+v2t+")"+v2s7)
- addFormatterTest("%#+v", pv2, "(*"+v2t+")("+v2Addr+")"+v2s8)
- addFormatterTest("%#+v", &pv2, "(**"+v2t+")("+pv2Addr+"->"+v2Addr+")"+v2s8)
-
- // Structs that are indirectly circular.
- v3 := indirCir1{nil}
- tic2 := indirCir2{nil}
- tic3 := indirCir3{&v3}
- tic2.ps3 = &tic3
- v3.ps2 = &tic2
- pv3 := &v3
- tic2Addr := fmt.Sprintf("%p", &tic2)
- tic3Addr := fmt.Sprintf("%p", &tic3)
- v3Addr := fmt.Sprintf("%p", pv3)
- pv3Addr := fmt.Sprintf("%p", &pv3)
- v3t := "spew_test.indirCir1"
- v3t2 := "spew_test.indirCir2"
- v3t3 := "spew_test.indirCir3"
- v3s := "{<*>{<*>{<*>{<*>}}}}"
- v3s2 := "{<*>{<*>{<*>}}}"
- v3s3 := "{ps2:<*>(" + tic2Addr + "){ps3:<*>(" + tic3Addr + "){ps1:<*>(" +
- v3Addr + "){ps2:<*>(" + tic2Addr + ")