Skip to content

Commit 0d5cd8c

Browse files
committed
Add durable proxy acceptance fixtures
1 parent 18e374c commit 0d5cd8c

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

internal/kernelclient/client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ func (c Clients) GetProxy(ctx context.Context, projectID, id string) (*kernel.Pr
106106
return c.proxies.Get(ctx, id, scope(projectID)...)
107107
}
108108

109+
func (c Clients) CreateProxy(ctx context.Context, projectID string, params kernel.ProxyNewParams) (*kernel.ProxyNewResponse, error) {
110+
return c.proxies.New(ctx, params, scope(projectID, noMutationRetries())...)
111+
}
112+
113+
func (c Clients) DeleteProxy(ctx context.Context, projectID, id string) error {
114+
return c.proxies.Delete(ctx, id, scope(projectID, noMutationRetries())...)
115+
}
116+
109117
func (c Clients) ListProxyPage(ctx context.Context, projectID string, offset int64) (ProxyPage, error) {
110118
var raw *http.Response
111119
params := kernel.ProxyListParams{

internal/kernelclient/client_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,26 @@ func TestMutationsDisableSDKRetriesAndUseExpectedScope(t *testing.T) {
404404
return clients.DeleteProfile(ctx, "project_123", "profile_123")
405405
},
406406
},
407+
"proxy create": {
408+
method: http.MethodPost,
409+
path: "/proxies",
410+
projectID: "project_123",
411+
call: func(ctx context.Context, clients Clients) error {
412+
_, err := clients.CreateProxy(ctx, "project_123", kernel.ProxyNewParams{
413+
Name: kernel.String("Proxy"),
414+
Type: kernel.ProxyNewParamsTypeDatacenter,
415+
})
416+
return err
417+
},
418+
},
419+
"proxy delete": {
420+
method: http.MethodDelete,
421+
path: "/proxies/proxy_123",
422+
projectID: "project_123",
423+
call: func(ctx context.Context, clients Clients) error {
424+
return clients.DeleteProxy(ctx, "project_123", "proxy_123")
425+
},
426+
},
407427
"browser pool create": {
408428
method: http.MethodPost,
409429
path: "/browser_pools",
@@ -553,6 +573,14 @@ func TestClientsDoNotExposeProfileArchiveMethods(t *testing.T) {
553573
}
554574
}
555575

576+
func TestClientsDoNotExposeProxyHealthCheck(t *testing.T) {
577+
t.Parallel()
578+
579+
if _, ok := reflect.TypeOf(Clients{}).MethodByName("CheckProxy"); ok {
580+
t.Fatal("Clients exposes runtime proxy health check")
581+
}
582+
}
583+
556584
func appListPage(id string) string {
557585
return `[{"id":"` + id + `","app_name":"demo","version":"v1","region":"aws.us-east-1a","deployment":"deployment-1","actions":[],"env_vars":{}}]`
558586
}

0 commit comments

Comments
 (0)