Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
| ... | ... |
@@ -62,3 +62,24 @@ func TestCommitNewFile(t *testing.T) {
|
| 62 | 62 |
|
| 63 | 63 |
logDone("commit - commit file and read")
|
| 64 | 64 |
} |
| 65 |
+ |
|
| 66 |
+func TestCommitTTY(t *testing.T) {
|
|
| 67 |
+ cmd := exec.Command(dockerBinary, "run", "-t", "--name", "tty", "busybox", "/bin/ls") |
|
| 68 |
+ |
|
| 69 |
+ if _, err := runCommand(cmd); err != nil {
|
|
| 70 |
+ t.Fatal(err) |
|
| 71 |
+ } |
|
| 72 |
+ |
|
| 73 |
+ cmd = exec.Command(dockerBinary, "commit", "tty", "ttytest") |
|
| 74 |
+ imageId, _, err := runCommandWithOutput(cmd) |
|
| 75 |
+ if err != nil {
|
|
| 76 |
+ t.Fatal(err) |
|
| 77 |
+ } |
|
| 78 |
+ imageId = strings.Trim(imageId, "\r\n") |
|
| 79 |
+ |
|
| 80 |
+ cmd = exec.Command(dockerBinary, "run", "ttytest", "/bin/ls") |
|
| 81 |
+ |
|
| 82 |
+ if _, err := runCommand(cmd); err != nil {
|
|
| 83 |
+ t.Fatal(err) |
|
| 84 |
+ } |
|
| 85 |
+} |
| ... | ... |
@@ -3,12 +3,6 @@ package docker |
| 3 | 3 |
import ( |
| 4 | 4 |
"bufio" |
| 5 | 5 |
"fmt" |
| 6 |
- "github.com/dotcloud/docker/api/client" |
|
| 7 |
- "github.com/dotcloud/docker/daemon" |
|
| 8 |
- "github.com/dotcloud/docker/engine" |
|
| 9 |
- "github.com/dotcloud/docker/image" |
|
| 10 |
- "github.com/dotcloud/docker/pkg/term" |
|
| 11 |
- "github.com/dotcloud/docker/utils" |
|
| 12 | 6 |
"io" |
| 13 | 7 |
"io/ioutil" |
| 14 | 8 |
"os" |
| ... | ... |
@@ -19,6 +13,13 @@ import ( |
| 19 | 19 |
"syscall" |
| 20 | 20 |
"testing" |
| 21 | 21 |
"time" |
| 22 |
+ |
|
| 23 |
+ "github.com/dotcloud/docker/api/client" |
|
| 24 |
+ "github.com/dotcloud/docker/daemon" |
|
| 25 |
+ "github.com/dotcloud/docker/engine" |
|
| 26 |
+ "github.com/dotcloud/docker/image" |
|
| 27 |
+ "github.com/dotcloud/docker/pkg/term" |
|
| 28 |
+ "github.com/dotcloud/docker/utils" |
|
| 22 | 29 |
) |
| 23 | 30 |
|
| 24 | 31 |
func closeWrap(args ...io.Closer) error {
|
| ... | ... |
@@ -1163,27 +1164,3 @@ func TestCmdKill(t *testing.T) {
|
| 1163 | 1163 |
|
| 1164 | 1164 |
closeWrap(stdin, stdinPipe, stdout, stdoutPipe) |
| 1165 | 1165 |
} |
| 1166 |
- |
|
| 1167 |
-func TestRunTTYCommitRun(t *testing.T) {
|
|
| 1168 |
- cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1169 |
- |
|
| 1170 |
- defer cleanup(globalEngine, t) |
|
| 1171 |
- |
|
| 1172 |
- ch := make(chan struct{})
|
|
| 1173 |
- go func() {
|
|
| 1174 |
- defer close(ch) |
|
| 1175 |
- cli.CmdRun("-t", unitTestImageID, "/bin/ls")
|
|
| 1176 |
- }() |
|
| 1177 |
- |
|
| 1178 |
- container := waitContainerStart(t, 10*time.Second) |
|
| 1179 |
- time.Sleep(500 * time.Millisecond) |
|
| 1180 |
- setTimeout(t, "Waiting for container timedout", 5*time.Second, func() {
|
|
| 1181 |
- <-ch |
|
| 1182 |
- }) |
|
| 1183 |
- |
|
| 1184 |
- cli.CmdCommit(container.ID, "ttytest") |
|
| 1185 |
- |
|
| 1186 |
- if err := cli.CmdRun("ttytest", "/bin/ls"); err != nil {
|
|
| 1187 |
- t.Fatal(err) |
|
| 1188 |
- } |
|
| 1189 |
-} |
| ... | ... |
@@ -65,15 +65,6 @@ func Merge(userConf, imageConf *Config) error {
|
| 65 | 65 |
} |
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
- if !userConf.Tty {
|
|
| 69 |
- userConf.Tty = imageConf.Tty |
|
| 70 |
- } |
|
| 71 |
- if !userConf.OpenStdin {
|
|
| 72 |
- userConf.OpenStdin = imageConf.OpenStdin |
|
| 73 |
- } |
|
| 74 |
- if !userConf.StdinOnce {
|
|
| 75 |
- userConf.StdinOnce = imageConf.StdinOnce |
|
| 76 |
- } |
|
| 77 | 68 |
if userConf.Env == nil || len(userConf.Env) == 0 {
|
| 78 | 69 |
userConf.Env = imageConf.Env |
| 79 | 70 |
} else {
|