File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ checks:
5656 httpGet :
5757 path : /
5858 port : 8888
59+ httpHeaders :
60+ - name : User-Agent
61+ value : container-canary/0.2.1
5962 responseHttpHeaders :
6063 - name : Access-Control-Allow-Origin
6164 value : " *"
Original file line number Diff line number Diff line change @@ -104,26 +104,26 @@ func (p *Probe) UnmarshalYAML(unmarshal func(interface{}) error) error {
104104type HTTPGetAction struct {
105105 // Path to access on the HTTP server.
106106 // +optional
107- Path string `json :"path,omitempty"`
107+ Path string `yaml :"path,omitempty"`
108108 // Number of the port to access on the container.
109109 // Number must be in the range 1 to 65535.
110- Port int `json :"port"`
110+ Port int `yaml :"port"`
111111 // Scheme to use for connecting to the host.
112112 // Defaults to HTTP.
113113 // +optional
114- Scheme v1.URIScheme `json :"scheme,omitempty"`
114+ Scheme v1.URIScheme `yaml :"scheme,omitempty"`
115115 // Custom headers to set in the request. HTTP allows repeated headers.
116116 // +optional
117- HTTPHeaders []v1.HTTPHeader `json :"httpHeaders,omitempty"`
117+ HTTPHeaders []v1.HTTPHeader `yaml :"httpHeaders,omitempty"`
118118 // Headers expected in the response. Check will fail if any are missing.
119119 // +optional
120- ResponseHTTPHeaders []v1.HTTPHeader `json :"responseHttpHeaders,omitempty"`
120+ ResponseHTTPHeaders []v1.HTTPHeader `yaml :"responseHttpHeaders,omitempty"`
121121}
122122
123123type TCPSocketAction struct {
124124 // Number or name of the port to access on the container.
125125 // Number must be in the range 1 to 65535.
126- Port int `json :"port"`
126+ Port int `yaml :"port"`
127127}
128128
129129type Volume struct {
Original file line number Diff line number Diff line change @@ -41,4 +41,19 @@ func TestValidator(t *testing.T) {
4141
4242 assert .Equal (0 , check .Probe .InitialDelaySeconds )
4343
44+ check = validator .Checks [5 ]
45+
46+ assert .Equal ("allow-origin-all" , check .Name )
47+ assert .Equal ("🔓 Sets 'Access-Control-Allow-Origin: *' header" , check .Description )
48+
49+ assert .Equal ("/" , check .Probe .HTTPGet .Path )
50+ assert .Equal (8888 , check .Probe .HTTPGet .Port )
51+
52+ header := check .Probe .HTTPGet .HTTPHeaders [0 ]
53+ assert .Equal ("User-Agent" , header .Name )
54+ assert .Equal ("container-canary/0.2.1" , header .Value )
55+
56+ header = check .Probe .HTTPGet .ResponseHTTPHeaders [0 ]
57+ assert .Equal ("Access-Control-Allow-Origin" , header .Name )
58+ assert .Equal ("*" , header .Value )
4459}
You can’t perform that action at this time.
0 commit comments