| ... | ... |
@@ -187,6 +187,40 @@ func TestExitCode(t *testing.T) {
|
| 187 | 187 |
} |
| 188 | 188 |
} |
| 189 | 189 |
|
| 190 |
+func TestRestart(t *testing.T) {
|
|
| 191 |
+ docker, err := newTestDocker() |
|
| 192 |
+ if err != nil {
|
|
| 193 |
+ t.Fatal(err) |
|
| 194 |
+ } |
|
| 195 |
+ container, err := docker.Create( |
|
| 196 |
+ "restart_test", |
|
| 197 |
+ "echo", |
|
| 198 |
+ []string{"-n", "foobar"},
|
|
| 199 |
+ []string{"/var/lib/docker/images/ubuntu"},
|
|
| 200 |
+ &Config{},
|
|
| 201 |
+ ) |
|
| 202 |
+ if err != nil {
|
|
| 203 |
+ t.Fatal(err) |
|
| 204 |
+ } |
|
| 205 |
+ defer docker.Destroy(container) |
|
| 206 |
+ output, err := container.Output() |
|
| 207 |
+ if err != nil {
|
|
| 208 |
+ t.Fatal(err) |
|
| 209 |
+ } |
|
| 210 |
+ if string(output) != "foobar" {
|
|
| 211 |
+ t.Error(string(output)) |
|
| 212 |
+ } |
|
| 213 |
+ |
|
| 214 |
+ // Run the container again and check the output |
|
| 215 |
+ output, err = container.Output() |
|
| 216 |
+ if err != nil {
|
|
| 217 |
+ t.Fatal(err) |
|
| 218 |
+ } |
|
| 219 |
+ if string(output) != "foobar" {
|
|
| 220 |
+ t.Error(string(output)) |
|
| 221 |
+ } |
|
| 222 |
+} |
|
| 223 |
+ |
|
| 190 | 224 |
func TestUser(t *testing.T) {
|
| 191 | 225 |
docker, err := newTestDocker() |
| 192 | 226 |
if err != nil {
|