Skip to content

Commit ef22b26

Browse files
committed
Implement https support in request and bench actions
1 parent b4be4d5 commit ef22b26

22 files changed

Lines changed: 191 additions & 150 deletions

File tree

TODO.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ in the future.
4949

5050
#### Structure - Instances, Actions, Servers, Services
5151

52-
- extend environment and request action to support TLS certificate
53-
- environment publicUrl should support https - currently it is hard coded to return http so it should allow extra param to select it
54-
- extend request action with a protocol option to select between http and https
5552
- http/2 requests
5653
- add http_version field to the request action
5754
- update the client to allow using http/2
@@ -156,7 +153,6 @@ in the future.
156153

157154
#### Local environment
158155

159-
- implement https publicUrl support
160156
- look into issues with orphaned children which happen when a task main process dies suddenly
161157
- find a way to get them somehow killed so it doesn't require manual clean up/
162158
- consider reporting closing output streams in Destroy
@@ -170,7 +166,6 @@ in the future.
170166
- support exec
171167
- implement storing and handling certificates
172168
- this should go to secrets from rendered certificates
173-
- implement https publicUrl support
174169
- allow setting default kubeconfig to ~/.kube/config (will require home dir support)
175170
- support and test native hook start where command is nil (set better executable - ideally configurable)
176171
- add health probes setup
@@ -183,7 +178,6 @@ in the future.
183178
- support exec
184179
- implement storing and handling certificates
185180
- this is currently done using bind so check if there is a better (more secure) way to do it for private keye
186-
- implement https publicUrl support
187181
- health check - waiting for container to be able to serve the traffic
188182
- custom docker
189183

conf/parser/parser_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,7 @@ func Test_ConfigParser_ParseConfig(t *testing.T) {
20562056
When: "on_success",
20572057
OnFailure: "fail",
20582058
Id: "last",
2059+
Scheme: "http",
20592060
Path: "/api/status",
20602061
EncodePath: true,
20612062
Method: "GET",

conf/types/action.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ type RequestAction struct {
114114
When string `wst:"when,enum=always|on_success|on_failure,default=on_success"`
115115
OnFailure string `wst:"on_failure,enum=fail|ignore|skip,default=fail"`
116116
Id string `wst:"id,default=last"`
117+
Scheme string `wst:"scheme,enum=http|https,default=http"`
117118
Path string `wst:"path"`
118119
EncodePath bool `wst:"encode_path,default=true"`
119120
Method string `wst:"method,enum=GET|HEAD|DELETE|POST|PUT|PATCH|PURGE,default=GET"`
@@ -126,6 +127,7 @@ type BenchAction struct {
126127
When string `wst:"when,enum=always|on_success|on_failure,default=on_success"`
127128
OnFailure string `wst:"on_failure,enum=fail|ignore|skip,default=fail"`
128129
Id string `wst:"id,default=last"`
130+
Scheme string `wst:"scheme,enum=http|https,default=http"`
129131
Path string `wst:"path"`
130132
Method string `wst:"method,enum=GET|HEAD|DELETE|POST|PUT|PATCH|PURGE,default=GET"`
131133
Headers Headers `wst:"headers"`

mocks/generated/run/environments/task/mock_Task.go

Lines changed: 22 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mocks/generated/run/services/mock_Service.go

Lines changed: 30 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mocks/generated/run/services/template/service/mock_TemplateService.go

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

run/actions/action/bench/bench.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func (m *ActionMaker) Make(
7979
onFailure: action.OnFailureType(config.OnFailure),
8080
freq: config.Frequency,
8181
id: config.Id,
82+
scheme: config.Scheme,
8283
path: config.Path,
8384
method: config.Method,
8485
headers: config.Headers,
@@ -94,6 +95,7 @@ type Action struct {
9495
duration time.Duration
9596
freq int
9697
id string
98+
scheme string
9799
path string
98100
method string
99101
headers types.Headers
@@ -113,7 +115,7 @@ func (a *Action) Timeout() time.Duration {
113115

114116
func (a *Action) Execute(ctx context.Context, runData runtime.Data) (bool, error) {
115117
a.fnd.Logger().Infof("Executing bench action")
116-
url, err := a.service.PublicUrl(a.path)
118+
url, err := a.service.PublicUrl(a.scheme, a.path)
117119
if err != nil {
118120
return false, err
119121
}

0 commit comments

Comments
 (0)