Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

weaveworks / weave / #3760

22 Sep 2015 - 13:52 coverage increased (+0.3%) to 77.586%
#3760

Pull #1449

circleci

Eac6f57e46837c7b0d0bacac4288d0b9?size=18&default=identiconpaulbellamy
Removing confusing variable from getDNSDomain, just return "" when disabled
Pull Request #1449: Override sneaky /start HostConfig params

44 of 70 new or added lines in 3 files covered. (62.86%)

3 existing lines in 1 file now uncovered.

5317 of 6853 relevant lines covered (77.59%)

126843.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
/proxy/start_container_interceptor.go
1
package proxy
2

3
import (
4
        "net/http"
5

6
        "github.com/fsouza/go-dockerclient"
7
)
8

9
type startContainerInterceptor struct{ proxy *Proxy }
10

11
type startContainerRequestBody struct {
12
        HostConfig *docker.HostConfig `json:"HostConfig,omitempty" yaml:"HostConfig,omitempty"`
13
}
14

15
func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
131×
16
        container, err := inspectContainerInPath(i.proxy.client, r.URL.Path)
131×
NEW
17
        if err != nil {
!
NEW
18
                return err
!
NEW
19
        }
!
20

21
        if !containerShouldAttach(container) || r.Header.Get("Content-Type") != "application/json" {
129×
22
                i.proxy.createWait(r, container.ID)
129×
23
                return nil
129×
24
        }
129×
25

26
        hostConfig := &docker.HostConfig{}
2×
NEW
27
        if err := unmarshalRequestBody(r, &hostConfig); err != nil {
!
NEW
28
                return err
!
NEW
29
        }
!
30

31
        i.proxy.addWeaveWaitVolume(hostConfig)
2×
32
        if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
2×
NEW
33
                if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, dnsDomain); err != nil {
!
NEW
34
                        return err
!
NEW
35
                }
!
36
        }
37

NEW
38
        if err := marshalRequestBody(r, hostConfig); err != nil {
!
NEW
39
                return err
!
NEW
40
        }
!
41
        i.proxy.createWait(r, container.ID)
2×
42
        return nil
2×
43
}
44

45
func (i *startContainerInterceptor) InterceptResponse(r *http.Response) error {
131×
46
        defer i.proxy.removeWait(r.Request)
131×
47
        if r.StatusCode < 200 || r.StatusCode >= 300 { // Docker didn't do the start
1×
48
                return nil
1×
49
        }
1×
50
        i.proxy.waitForStart(r.Request)
130×
51
        return nil
130×
52
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2022 Coveralls, Inc