| ... | ... |
@@ -25,11 +25,11 @@ func TestInspectApiContainerResponse(t *testing.T) {
|
| 25 | 25 |
} |
| 26 | 26 |
body, err := sockRequest("GET", endpoint)
|
| 27 | 27 |
if err != nil {
|
| 28 |
- t.Fatal("sockRequest failed for %s version: %v", testVersion, err)
|
|
| 28 |
+ t.Fatalf("sockRequest failed for %s version: %v", testVersion, err)
|
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 |
- var inspect_json map[string]interface{}
|
|
| 32 |
- if err = json.Unmarshal(body, &inspect_json); err != nil {
|
|
| 31 |
+ var inspectJSON map[string]interface{}
|
|
| 32 |
+ if err = json.Unmarshal(body, &inspectJSON); err != nil {
|
|
| 33 | 33 |
t.Fatalf("unable to unmarshal body for %s version: %v", testVersion, err)
|
| 34 | 34 |
} |
| 35 | 35 |
|
| ... | ... |
@@ -42,12 +42,12 @@ func TestInspectApiContainerResponse(t *testing.T) {
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 | 44 |
for _, key := range keys {
|
| 45 |
- if _, ok := inspect_json[key]; !ok {
|
|
| 45 |
+ if _, ok := inspectJSON[key]; !ok {
|
|
| 46 | 46 |
t.Fatalf("%s does not exist in reponse for %s version", key, testVersion)
|
| 47 | 47 |
} |
| 48 | 48 |
} |
| 49 | 49 |
//Issue #6830: type not properly converted to JSON/back |
| 50 |
- if _, ok := inspect_json["Path"].(bool); ok {
|
|
| 50 |
+ if _, ok := inspectJSON["Path"].(bool); ok {
|
|
| 51 | 51 |
t.Fatalf("Path of `true` should not be converted to boolean `true` via JSON marshalling")
|
| 52 | 52 |
} |
| 53 | 53 |
} |
| ... | ... |
@@ -265,7 +265,7 @@ func TestBuildCopyWildcard(t *testing.T) {
|
| 265 | 265 |
} |
| 266 | 266 |
|
| 267 | 267 |
if id1 != id2 {
|
| 268 |
- t.Fatal(fmt.Errorf("Didn't use the cache"))
|
|
| 268 |
+ t.Fatal("didn't use the cache")
|
|
| 269 | 269 |
} |
| 270 | 270 |
|
| 271 | 271 |
logDone("build - copy wild card")
|
| ... | ... |
@@ -284,7 +284,7 @@ func TestBuildCopyWildcardNoFind(t *testing.T) {
|
| 284 | 284 |
|
| 285 | 285 |
_, err = buildImageFromContext(name, ctx, true) |
| 286 | 286 |
if err == nil {
|
| 287 |
- t.Fatal(fmt.Errorf("Should have failed to find a file"))
|
|
| 287 |
+ t.Fatal("should have failed to find a file")
|
|
| 288 | 288 |
} |
| 289 | 289 |
if !strings.Contains(err.Error(), "No source files were specified") {
|
| 290 | 290 |
t.Fatalf("Wrong error %v, must be about no source files", err)
|
| ... | ... |
@@ -322,7 +322,7 @@ func TestBuildCopyWildcardCache(t *testing.T) {
|
| 322 | 322 |
} |
| 323 | 323 |
|
| 324 | 324 |
if id1 != id2 {
|
| 325 |
- t.Fatal(fmt.Errorf("Didn't use the cache"))
|
|
| 325 |
+ t.Fatal("didn't use the cache")
|
|
| 326 | 326 |
} |
| 327 | 327 |
|
| 328 | 328 |
logDone("build - copy wild card cache")
|
| ... | ... |
@@ -568,11 +568,11 @@ func TestBuildCopyWholeDirToRoot(t *testing.T) {
|
| 568 | 568 |
} |
| 569 | 569 |
|
| 570 | 570 |
buildDirectory = filepath.Join(buildDirectory, testDirName) |
| 571 |
- test_dir := filepath.Join(buildDirectory, "test_dir") |
|
| 572 |
- if err := os.MkdirAll(test_dir, 0755); err != nil {
|
|
| 571 |
+ testDir := filepath.Join(buildDirectory, "test_dir") |
|
| 572 |
+ if err := os.MkdirAll(testDir, 0755); err != nil {
|
|
| 573 | 573 |
t.Fatal(err) |
| 574 | 574 |
} |
| 575 |
- f, err := os.OpenFile(filepath.Join(test_dir, "test_file"), os.O_CREATE, 0644) |
|
| 575 |
+ f, err := os.OpenFile(filepath.Join(testDir, "test_file"), os.O_CREATE, 0644) |
|
| 576 | 576 |
if err != nil {
|
| 577 | 577 |
t.Fatal(err) |
| 578 | 578 |
} |
| ... | ... |
@@ -68,13 +68,13 @@ func TestCommitNewFile(t *testing.T) {
|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
cmd = exec.Command(dockerBinary, "commit", "commiter") |
| 71 |
- imageId, _, err := runCommandWithOutput(cmd) |
|
| 71 |
+ imageID, _, err := runCommandWithOutput(cmd) |
|
| 72 | 72 |
if err != nil {
|
| 73 | 73 |
t.Fatal(err) |
| 74 | 74 |
} |
| 75 |
- imageId = strings.Trim(imageId, "\r\n") |
|
| 75 |
+ imageID = strings.Trim(imageID, "\r\n") |
|
| 76 | 76 |
|
| 77 |
- cmd = exec.Command(dockerBinary, "run", imageId, "cat", "/foo") |
|
| 77 |
+ cmd = exec.Command(dockerBinary, "run", imageID, "cat", "/foo") |
|
| 78 | 78 |
|
| 79 | 79 |
out, _, err := runCommandWithOutput(cmd) |
| 80 | 80 |
if err != nil {
|
| ... | ... |
@@ -85,7 +85,7 @@ func TestCommitNewFile(t *testing.T) {
|
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
deleteAllContainers() |
| 88 |
- deleteImages(imageId) |
|
| 88 |
+ deleteImages(imageID) |
|
| 89 | 89 |
|
| 90 | 90 |
logDone("commit - commit file and read")
|
| 91 | 91 |
} |
| ... | ... |
@@ -98,11 +98,11 @@ func TestCommitTTY(t *testing.T) {
|
| 98 | 98 |
} |
| 99 | 99 |
|
| 100 | 100 |
cmd = exec.Command(dockerBinary, "commit", "tty", "ttytest") |
| 101 |
- imageId, _, err := runCommandWithOutput(cmd) |
|
| 101 |
+ imageID, _, err := runCommandWithOutput(cmd) |
|
| 102 | 102 |
if err != nil {
|
| 103 | 103 |
t.Fatal(err) |
| 104 | 104 |
} |
| 105 |
- imageId = strings.Trim(imageId, "\r\n") |
|
| 105 |
+ imageID = strings.Trim(imageID, "\r\n") |
|
| 106 | 106 |
|
| 107 | 107 |
cmd = exec.Command(dockerBinary, "run", "ttytest", "/bin/ls") |
| 108 | 108 |
|
| ... | ... |
@@ -120,11 +120,11 @@ func TestCommitWithHostBindMount(t *testing.T) {
|
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
cmd = exec.Command(dockerBinary, "commit", "bind-commit", "bindtest") |
| 123 |
- imageId, _, err := runCommandWithOutput(cmd) |
|
| 123 |
+ imageID, _, err := runCommandWithOutput(cmd) |
|
| 124 | 124 |
if err != nil {
|
| 125 |
- t.Fatal(imageId, err) |
|
| 125 |
+ t.Fatal(imageID, err) |
|
| 126 | 126 |
} |
| 127 |
- imageId = strings.Trim(imageId, "\r\n") |
|
| 127 |
+ imageID = strings.Trim(imageID, "\r\n") |
|
| 128 | 128 |
|
| 129 | 129 |
cmd = exec.Command(dockerBinary, "run", "bindtest", "true") |
| 130 | 130 |
|
| ... | ... |
@@ -133,7 +133,7 @@ func TestCommitWithHostBindMount(t *testing.T) {
|
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 | 135 |
deleteAllContainers() |
| 136 |
- deleteImages(imageId) |
|
| 136 |
+ deleteImages(imageID) |
|
| 137 | 137 |
|
| 138 | 138 |
logDone("commit - commit bind mounted file")
|
| 139 | 139 |
} |
| ... | ... |
@@ -25,11 +25,11 @@ func TestEventsUntag(t *testing.T) {
|
| 25 | 25 |
eventsCmd := exec.Command("timeout", "0.2", dockerBinary, "events", "--since=1")
|
| 26 | 26 |
out, _, _ = runCommandWithOutput(eventsCmd) |
| 27 | 27 |
events := strings.Split(out, "\n") |
| 28 |
- n_events := len(events) |
|
| 28 |
+ nEvents := len(events) |
|
| 29 | 29 |
// The last element after the split above will be an empty string, so we |
| 30 | 30 |
// get the two elements before the last, which are the untags we're |
| 31 | 31 |
// looking for. |
| 32 |
- for _, v := range events[n_events-3 : n_events-1] {
|
|
| 32 |
+ for _, v := range events[nEvents-3 : nEvents-1] {
|
|
| 33 | 33 |
if !strings.Contains(v, "untag") {
|
| 34 | 34 |
t.Fatalf("event should be untag, not %#v", v)
|
| 35 | 35 |
} |
| ... | ... |
@@ -99,9 +99,9 @@ func TestEventsLimit(t *testing.T) {
|
| 99 | 99 |
eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
|
| 100 | 100 |
out, _, _ := runCommandWithOutput(eventsCmd) |
| 101 | 101 |
events := strings.Split(out, "\n") |
| 102 |
- n_events := len(events) - 1 |
|
| 103 |
- if n_events != 64 {
|
|
| 104 |
- t.Fatalf("events should be limited to 64, but received %d", n_events)
|
|
| 102 |
+ nEvents := len(events) - 1 |
|
| 103 |
+ if nEvents != 64 {
|
|
| 104 |
+ t.Fatalf("events should be limited to 64, but received %d", nEvents)
|
|
| 105 | 105 |
} |
| 106 | 106 |
logDone("events - limited to 64 entries")
|
| 107 | 107 |
} |
| ... | ... |
@@ -51,15 +51,15 @@ RUN echo "Z"`, |
| 51 | 51 |
t.Fatal("failed to get image history")
|
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 |
- actual_values := strings.Split(out, "\n")[1:27] |
|
| 55 |
- expected_values := [26]string{"Z", "Y", "X", "W", "V", "U", "T", "S", "R", "Q", "P", "O", "N", "M", "L", "K", "J", "I", "H", "G", "F", "E", "D", "C", "B", "A"}
|
|
| 54 |
+ actualValues := strings.Split(out, "\n")[1:27] |
|
| 55 |
+ expectedValues := [26]string{"Z", "Y", "X", "W", "V", "U", "T", "S", "R", "Q", "P", "O", "N", "M", "L", "K", "J", "I", "H", "G", "F", "E", "D", "C", "B", "A"}
|
|
| 56 | 56 |
|
| 57 | 57 |
for i := 0; i < 26; i++ {
|
| 58 |
- echo_value := fmt.Sprintf("echo \"%s\"", expected_values[i])
|
|
| 59 |
- actual_value := actual_values[i] |
|
| 58 |
+ echoValue := fmt.Sprintf("echo \"%s\"", expectedValues[i])
|
|
| 59 |
+ actualValue := actualValues[i] |
|
| 60 | 60 |
|
| 61 |
- if !strings.Contains(actual_value, echo_value) {
|
|
| 62 |
- t.Fatalf("Expected layer \"%s\", but was: %s", expected_values[i], actual_value)
|
|
| 61 |
+ if !strings.Contains(actualValue, echoValue) {
|
|
| 62 |
+ t.Fatalf("Expected layer \"%s\", but was: %s", expectedValues[i], actualValue)
|
|
| 63 | 63 |
} |
| 64 | 64 |
} |
| 65 | 65 |
|
| ... | ... |
@@ -15,8 +15,8 @@ func TestImportDisplay(t *testing.T) {
|
| 15 | 15 |
t.Fatal(err) |
| 16 | 16 |
} |
| 17 | 17 |
defer server.Close() |
| 18 |
- fileUrl := fmt.Sprintf("%s/cirros.tar.gz", server.URL)
|
|
| 19 |
- importCmd := exec.Command(dockerBinary, "import", fileUrl) |
|
| 18 |
+ fileURL := fmt.Sprintf("%s/cirros.tar.gz", server.URL)
|
|
| 19 |
+ importCmd := exec.Command(dockerBinary, "import", fileURL) |
|
| 20 | 20 |
out, _, err := runCommandWithOutput(importCmd) |
| 21 | 21 |
if err != nil {
|
| 22 | 22 |
t.Errorf("import failed with errors: %v, output: %q", err, out)
|
| ... | ... |
@@ -8,15 +8,15 @@ import ( |
| 8 | 8 |
|
| 9 | 9 |
func TestInspectImage(t *testing.T) {
|
| 10 | 10 |
imageTest := "scratch" |
| 11 |
- imageTestId := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158" |
|
| 11 |
+ imageTestID := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158" |
|
| 12 | 12 |
imagesCmd := exec.Command(dockerBinary, "inspect", "--format='{{.Id}}'", imageTest)
|
| 13 | 13 |
|
| 14 | 14 |
out, exitCode, err := runCommandWithOutput(imagesCmd) |
| 15 | 15 |
if exitCode != 0 || err != nil {
|
| 16 | 16 |
t.Fatalf("failed to inspect image")
|
| 17 | 17 |
} |
| 18 |
- if id := strings.TrimSuffix(out, "\n"); id != imageTestId {
|
|
| 19 |
- t.Fatalf("Expected id: %s for image: %s but received id: %s", imageTestId, imageTest, id)
|
|
| 18 |
+ if id := strings.TrimSuffix(out, "\n"); id != imageTestID {
|
|
| 19 |
+ t.Fatalf("Expected id: %s for image: %s but received id: %s", imageTestID, imageTest, id)
|
|
| 20 | 20 |
} |
| 21 | 21 |
logDone("inspect - inspect an image")
|
| 22 | 22 |
} |
| ... | ... |
@@ -75,11 +75,11 @@ func TestLinksIpTablesRulesWhenLinkAndUnlink(t *testing.T) {
|
| 75 | 75 |
cmd(t, "run", "-d", "--name", "child", "--publish", "8080:80", "busybox", "sleep", "10") |
| 76 | 76 |
cmd(t, "run", "-d", "--name", "parent", "--link", "child:http", "busybox", "sleep", "10") |
| 77 | 77 |
|
| 78 |
- childIp := findContainerIp(t, "child") |
|
| 79 |
- parentIp := findContainerIp(t, "parent") |
|
| 78 |
+ childIP := findContainerIP(t, "child") |
|
| 79 |
+ parentIP := findContainerIP(t, "parent") |
|
| 80 | 80 |
|
| 81 |
- sourceRule := []string{"FORWARD", "-i", "docker0", "-o", "docker0", "-p", "tcp", "-s", childIp, "--sport", "80", "-d", parentIp, "-j", "ACCEPT"}
|
|
| 82 |
- destinationRule := []string{"FORWARD", "-i", "docker0", "-o", "docker0", "-p", "tcp", "-s", parentIp, "--dport", "80", "-d", childIp, "-j", "ACCEPT"}
|
|
| 81 |
+ sourceRule := []string{"FORWARD", "-i", "docker0", "-o", "docker0", "-p", "tcp", "-s", childIP, "--sport", "80", "-d", parentIP, "-j", "ACCEPT"}
|
|
| 82 |
+ destinationRule := []string{"FORWARD", "-i", "docker0", "-o", "docker0", "-p", "tcp", "-s", parentIP, "--dport", "80", "-d", childIP, "-j", "ACCEPT"}
|
|
| 83 | 83 |
if !iptables.Exists(sourceRule...) || !iptables.Exists(destinationRule...) {
|
| 84 | 84 |
t.Fatal("Iptables rules not found")
|
| 85 | 85 |
} |
| ... | ... |
@@ -19,7 +19,7 @@ func TestNetworkNat(t *testing.T) {
|
| 19 | 19 |
t.Fatalf("Error retrieving addresses for eth0: %v (%d addresses)", err, len(ifaceAddrs))
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
- ifaceIp, _, err := net.ParseCIDR(ifaceAddrs[0].String()) |
|
| 22 |
+ ifaceIP, _, err := net.ParseCIDR(ifaceAddrs[0].String()) |
|
| 23 | 23 |
if err != nil {
|
| 24 | 24 |
t.Fatalf("Error retrieving the up for eth0: %s", err)
|
| 25 | 25 |
} |
| ... | ... |
@@ -30,7 +30,7 @@ func TestNetworkNat(t *testing.T) {
|
| 30 | 30 |
|
| 31 | 31 |
cleanedContainerID := stripTrailingCharacters(out) |
| 32 | 32 |
|
| 33 |
- runCmd = exec.Command(dockerBinary, "run", "busybox", "sh", "-c", fmt.Sprintf("echo hello world | nc -w 30 %s 8080", ifaceIp))
|
|
| 33 |
+ runCmd = exec.Command(dockerBinary, "run", "busybox", "sh", "-c", fmt.Sprintf("echo hello world | nc -w 30 %s 8080", ifaceIP))
|
|
| 34 | 34 |
out, _, err = runCommandWithOutput(runCmd) |
| 35 | 35 |
errorOut(err, t, fmt.Sprintf("run2 failed with errors: %v (%s)", err, out))
|
| 36 | 36 |
|
| ... | ... |
@@ -40,7 +40,7 @@ func TestNetworkNat(t *testing.T) {
|
| 40 | 40 |
out = strings.Trim(out, "\r\n") |
| 41 | 41 |
|
| 42 | 42 |
if expected := "hello world"; out != expected {
|
| 43 |
- t.Fatalf("Unexpected output. Expected: %q, received: %q for iface %s", expected, out, ifaceIp)
|
|
| 43 |
+ t.Fatalf("Unexpected output. Expected: %q, received: %q for iface %s", expected, out, ifaceIP)
|
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
killCmd := exec.Command(dockerBinary, "kill", cleanedContainerID) |
| ... | ... |
@@ -190,9 +190,9 @@ func assertContainerList(out string, expected []string) bool {
|
| 190 | 190 |
return false |
| 191 | 191 |
} |
| 192 | 192 |
|
| 193 |
- containerIdIndex := strings.Index(lines[0], "CONTAINER ID") |
|
| 193 |
+ containerIDIndex := strings.Index(lines[0], "CONTAINER ID") |
|
| 194 | 194 |
for i := 0; i < len(expected); i++ {
|
| 195 |
- foundID := lines[i+1][containerIdIndex : containerIdIndex+12] |
|
| 195 |
+ foundID := lines[i+1][containerIDIndex : containerIDIndex+12] |
|
| 196 | 196 |
if foundID != expected[i][:12] {
|
| 197 | 197 |
return false |
| 198 | 198 |
} |
| ... | ... |
@@ -2038,7 +2038,7 @@ func TestRunNetworkNotInitializedNoneMode(t *testing.T) {
|
| 2038 | 2038 |
t.Fatal(err) |
| 2039 | 2039 |
} |
| 2040 | 2040 |
if res != "" {
|
| 2041 |
- t.Fatal("For 'none' mode network must not be initialized, but container got IP: %s", res)
|
|
| 2041 |
+ t.Fatalf("For 'none' mode network must not be initialized, but container got IP: %s", res)
|
|
| 2042 | 2042 |
} |
| 2043 | 2043 |
deleteAllContainers() |
| 2044 | 2044 |
logDone("run - network must not be initialized in 'none' mode")
|
| ... | ... |
@@ -44,11 +44,11 @@ func NewDaemon(t *testing.T) *Daemon {
|
| 44 | 44 |
dir := filepath.Join(dest, fmt.Sprintf("daemon%d", time.Now().Unix()))
|
| 45 | 45 |
daemonFolder, err := filepath.Abs(dir) |
| 46 | 46 |
if err != nil {
|
| 47 |
- t.Fatal("Could not make '%s' an absolute path: %v", dir, err)
|
|
| 47 |
+ t.Fatalf("Could not make '%s' an absolute path: %v", dir, err)
|
|
| 48 | 48 |
} |
| 49 | 49 |
|
| 50 | 50 |
if err := os.MkdirAll(filepath.Join(daemonFolder, "graph"), 0600); err != nil {
|
| 51 |
- t.Fatal("Could not create %s/graph directory", daemonFolder)
|
|
| 51 |
+ t.Fatalf("Could not create %s/graph directory", daemonFolder)
|
|
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 | 54 |
return &Daemon{
|
| ... | ... |
@@ -92,7 +92,7 @@ func (d *Daemon) Start(arg ...string) error {
|
| 92 | 92 |
d.cmd.Stderr = d.logFile |
| 93 | 93 |
|
| 94 | 94 |
if err := d.cmd.Start(); err != nil {
|
| 95 |
- return fmt.Errorf("Could not start daemon container: %v", err)
|
|
| 95 |
+ return fmt.Errorf("could not start daemon container: %v", err)
|
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
wait := make(chan error) |
| ... | ... |
@@ -172,7 +172,7 @@ func (d *Daemon) StartWithBusybox(arg ...string) error {
|
| 172 | 172 |
// instantiate a new one with NewDaemon. |
| 173 | 173 |
func (d *Daemon) Stop() error {
|
| 174 | 174 |
if d.cmd == nil || d.wait == nil {
|
| 175 |
- return errors.New("Daemon not started")
|
|
| 175 |
+ return errors.New("daemon not started")
|
|
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 | 178 |
defer func() {
|
| ... | ... |
@@ -184,7 +184,7 @@ func (d *Daemon) Stop() error {
|
| 184 | 184 |
tick := time.Tick(time.Second) |
| 185 | 185 |
|
| 186 | 186 |
if err := d.cmd.Process.Signal(os.Interrupt); err != nil {
|
| 187 |
- return fmt.Errorf("Could not send signal: %v", err)
|
|
| 187 |
+ return fmt.Errorf("could not send signal: %v", err)
|
|
| 188 | 188 |
} |
| 189 | 189 |
out: |
| 190 | 190 |
for {
|
| ... | ... |
@@ -197,7 +197,7 @@ out: |
| 197 | 197 |
case <-tick: |
| 198 | 198 |
d.t.Logf("Attempt #%d: daemon is still running with pid %d", i+1, d.cmd.Process.Pid)
|
| 199 | 199 |
if err := d.cmd.Process.Signal(os.Interrupt); err != nil {
|
| 200 |
- return fmt.Errorf("Could not send signal: %v", err)
|
|
| 200 |
+ return fmt.Errorf("could not send signal: %v", err)
|
|
| 201 | 201 |
} |
| 202 | 202 |
i++ |
| 203 | 203 |
} |
| ... | ... |
@@ -376,7 +376,7 @@ func dockerCmdInDirWithTimeout(timeout time.Duration, path string, args ...strin |
| 376 | 376 |
return out, status, err |
| 377 | 377 |
} |
| 378 | 378 |
|
| 379 |
-func findContainerIp(t *testing.T, id string) string {
|
|
| 379 |
+func findContainerIP(t *testing.T, id string) string {
|
|
| 380 | 380 |
cmd := exec.Command(dockerBinary, "inspect", "--format='{{ .NetworkSettings.IPAddress }}'", id)
|
| 381 | 381 |
out, _, err := runCommandWithOutput(cmd) |
| 382 | 382 |
if err != nil {
|
| ... | ... |
@@ -625,17 +625,17 @@ func fakeGIT(name string, files map[string]string) (*FakeGIT, error) {
|
| 625 | 625 |
defer os.Chdir(curdir) |
| 626 | 626 |
|
| 627 | 627 |
if output, err := exec.Command("git", "init", ctx.Dir).CombinedOutput(); err != nil {
|
| 628 |
- return nil, fmt.Errorf("Error trying to init repo: %s (%s)", err, output)
|
|
| 628 |
+ return nil, fmt.Errorf("error trying to init repo: %s (%s)", err, output)
|
|
| 629 | 629 |
} |
| 630 | 630 |
err = os.Chdir(ctx.Dir) |
| 631 | 631 |
if err != nil {
|
| 632 | 632 |
return nil, err |
| 633 | 633 |
} |
| 634 | 634 |
if output, err := exec.Command("git", "add", "*").CombinedOutput(); err != nil {
|
| 635 |
- return nil, fmt.Errorf("Error trying to add files to repo: %s (%s)", err, output)
|
|
| 635 |
+ return nil, fmt.Errorf("error trying to add files to repo: %s (%s)", err, output)
|
|
| 636 | 636 |
} |
| 637 | 637 |
if output, err := exec.Command("git", "commit", "-a", "-m", "Initial commit").CombinedOutput(); err != nil {
|
| 638 |
- return nil, fmt.Errorf("Error trying to commit to repo: %s (%s)", err, output)
|
|
| 638 |
+ return nil, fmt.Errorf("error trying to commit to repo: %s (%s)", err, output)
|
|
| 639 | 639 |
} |
| 640 | 640 |
|
| 641 | 641 |
root, err := ioutil.TempDir("", "docker-test-git-repo")
|
| ... | ... |
@@ -645,7 +645,7 @@ func fakeGIT(name string, files map[string]string) (*FakeGIT, error) {
|
| 645 | 645 |
repoPath := filepath.Join(root, name+".git") |
| 646 | 646 |
if output, err := exec.Command("git", "clone", "--bare", ctx.Dir, repoPath).CombinedOutput(); err != nil {
|
| 647 | 647 |
os.RemoveAll(root) |
| 648 |
- return nil, fmt.Errorf("Error trying to clone --bare: %s (%s)", err, output)
|
|
| 648 |
+ return nil, fmt.Errorf("error trying to clone --bare: %s (%s)", err, output)
|
|
| 649 | 649 |
} |
| 650 | 650 |
err = os.Chdir(repoPath) |
| 651 | 651 |
if err != nil {
|
| ... | ... |
@@ -654,7 +654,7 @@ func fakeGIT(name string, files map[string]string) (*FakeGIT, error) {
|
| 654 | 654 |
} |
| 655 | 655 |
if output, err := exec.Command("git", "update-server-info").CombinedOutput(); err != nil {
|
| 656 | 656 |
os.RemoveAll(root) |
| 657 |
- return nil, fmt.Errorf("Error trying to git update-server-info: %s (%s)", err, output)
|
|
| 657 |
+ return nil, fmt.Errorf("error trying to git update-server-info: %s (%s)", err, output)
|
|
| 658 | 658 |
} |
| 659 | 659 |
err = os.Chdir(curdir) |
| 660 | 660 |
if err != nil {
|
| ... | ... |
@@ -149,25 +149,25 @@ func convertSliceOfStringsToMap(input []string) map[string]struct{} {
|
| 149 | 149 |
return output |
| 150 | 150 |
} |
| 151 | 151 |
|
| 152 |
-func waitForContainer(contId string, args ...string) error {
|
|
| 153 |
- args = append([]string{"run", "--name", contId}, args...)
|
|
| 152 |
+func waitForContainer(contID string, args ...string) error {
|
|
| 153 |
+ args = append([]string{"run", "--name", contID}, args...)
|
|
| 154 | 154 |
cmd := exec.Command(dockerBinary, args...) |
| 155 | 155 |
if _, err := runCommand(cmd); err != nil {
|
| 156 | 156 |
return err |
| 157 | 157 |
} |
| 158 | 158 |
|
| 159 |
- if err := waitRun(contId); err != nil {
|
|
| 159 |
+ if err := waitRun(contID); err != nil {
|
|
| 160 | 160 |
return err |
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 | 163 |
return nil |
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 |
-func waitRun(contId string) error {
|
|
| 166 |
+func waitRun(contID string) error {
|
|
| 167 | 167 |
after := time.After(5 * time.Second) |
| 168 | 168 |
|
| 169 | 169 |
for {
|
| 170 |
- cmd := exec.Command(dockerBinary, "inspect", "-f", "{{.State.Running}}", contId)
|
|
| 170 |
+ cmd := exec.Command(dockerBinary, "inspect", "-f", "{{.State.Running}}", contID)
|
|
| 171 | 171 |
out, _, err := runCommandWithOutput(cmd) |
| 172 | 172 |
if err != nil {
|
| 173 | 173 |
return fmt.Errorf("error executing docker inspect: %v", err)
|