Skip to content

Commit 00cd9ae

Browse files
committed
test: E2E tests for Go SDK
Signed-off-by: Jiri Petrlik <[email protected]>
1 parent 8719fc9 commit 00cd9ae

9 files changed

Lines changed: 1131 additions & 4 deletions

File tree

‎.github/workflows/e2e-docker-test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
required: false
3434
type: string
3535
default: >-
36-
[{"suite":"python","cmd":"mise run --no-deps --skip-deps e2e:python","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-python","cmd":"mise run --no-deps --skip-deps e2e:oidc-python:docker","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true}]
36+
[{"suite":"python","cmd":"mise run --no-deps --skip-deps e2e:python","apt_packages":"","python_proto":true,"mcp":false},{"suite":"go","cmd":"mise run --no-deps --skip-deps e2e:go:docker","apt_packages":"","python_proto":false,"mcp":false},{"suite":"oidc-python","cmd":"mise run --no-deps --skip-deps e2e:oidc-python:docker","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true}]
3737
3838
permissions:
3939
actions: read

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ ocsf_emit!(event);
187187
- Domain types in `sdk/go/openshell/v1/types/` must not import proto packages.
188188
- Converters in `sdk/go/openshell/v1/internal/converter/` deep-copy slices and maps at boundaries.
189189
- Tests use bufconn for in-process gRPC and testify for assertions.
190+
- E2E tests live in `e2e/go/` (a separate Go module using a `replace` directive to `sdk/go/`, gated by the `e2e` build tag) and connect to a real gateway via `gateway.NewClient`. Run `mise run e2e:go` with Podman or `mise run e2e:go:docker` with Docker.
190191

191192
## TypeScript SDK (`sdk/typescript/`)
192193

‎e2e/go/go.mod‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module github.com/NVIDIA/OpenShell/e2e/go
2+
3+
go 1.25.13
4+
5+
require (
6+
github.com/NVIDIA/OpenShell/sdk/go v0.0.0-00010101000000-000000000000
7+
github.com/stretchr/testify v1.11.1
8+
)
9+
10+
require (
11+
github.com/davecgh/go-spew v1.1.1 // indirect
12+
github.com/pmezard/go-difflib v1.0.0 // indirect
13+
golang.org/x/net v0.58.0 // indirect
14+
golang.org/x/oauth2 v0.36.0 // indirect
15+
golang.org/x/sync v0.22.0 // indirect
16+
golang.org/x/sys v0.47.0 // indirect
17+
golang.org/x/text v0.41.0 // indirect
18+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
19+
google.golang.org/grpc v1.83.2 // indirect
20+
google.golang.org/protobuf v1.36.11 // indirect
21+
gopkg.in/yaml.v3 v3.0.1 // indirect
22+
)
23+
24+
replace github.com/NVIDIA/OpenShell/sdk/go => ../../sdk/go

‎e2e/go/go.sum‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
2+
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
3+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
6+
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
7+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
8+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
9+
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
10+
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
11+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
12+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
13+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
14+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
15+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
16+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
17+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
18+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
19+
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
20+
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
21+
go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
22+
go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc=
23+
go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc=
24+
go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo=
25+
go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
26+
go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
27+
go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
28+
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
29+
go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
30+
go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
31+
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
32+
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
33+
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
34+
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
35+
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
36+
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
37+
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
38+
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
39+
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
40+
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
41+
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
42+
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
43+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk=
44+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
45+
google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
46+
google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
47+
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
48+
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
49+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
50+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
51+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
52+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

‎e2e/go/harness_test.go‎

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//go:build e2e
5+
6+
// Package e2e contains end-to-end tests for the Go SDK, run against a real
7+
// OpenShell gateway with `mise run e2e:go` (Podman) or
8+
// `mise run e2e:go:docker` (Docker).
9+
package e2e
10+
11+
import (
12+
"context"
13+
"fmt"
14+
"os"
15+
"path/filepath"
16+
"strings"
17+
"testing"
18+
"time"
19+
20+
"github.com/stretchr/testify/require"
21+
22+
v1 "github.com/NVIDIA/OpenShell/sdk/go/openshell/v1"
23+
"github.com/NVIDIA/OpenShell/sdk/go/openshell/v1/gateway"
24+
"github.com/NVIDIA/OpenShell/sdk/go/openshell/v1/types"
25+
)
26+
27+
var (
28+
sharedClient *v1.Client
29+
gatewayName string
30+
)
31+
32+
func TestMain(m *testing.M) {
33+
gatewayName = os.Getenv("OPENSHELL_GATEWAY")
34+
if gatewayName == "" {
35+
// No gateway configured; requireClient skips every test individually.
36+
os.Exit(m.Run())
37+
}
38+
39+
cfg, err := gateway.LoadConfig(gatewayName)
40+
if err != nil {
41+
fmt.Fprintf(os.Stderr, "e2e: failed to load gateway config: %v\n", err)
42+
os.Exit(1)
43+
}
44+
45+
var opts []gateway.ClientOption
46+
if opt := mtlsClientOption(cfg.Dir); opt != nil {
47+
opts = append(opts, opt)
48+
}
49+
50+
client, err := gateway.NewClient(gatewayName, opts...)
51+
if err != nil {
52+
fmt.Fprintf(os.Stderr, "e2e: failed to build gateway client: %v\n", err)
53+
os.Exit(1)
54+
}
55+
sharedClient = client
56+
57+
if err := waitForPersistenceReady(sharedClient); err != nil {
58+
fmt.Fprintf(os.Stderr, "e2e: %v\n", err)
59+
_ = sharedClient.Close()
60+
os.Exit(1)
61+
}
62+
63+
code := m.Run()
64+
_ = sharedClient.Close()
65+
os.Exit(code)
66+
}
67+
68+
// mtlsClientOption inspects <dir>/mtls for an on-disk certificate bundle
69+
// written by e2e_register_mtls_gateway (see e2e/support/gateway-common.sh)
70+
// and returns a ClientOption applying it. Returns nil when no bundle is
71+
// present (e.g. plaintext or OIDC e2e lanes), so callers should skip it.
72+
func mtlsClientOption(dir string) gateway.ClientOption {
73+
mtlsDir := filepath.Join(dir, "mtls")
74+
caPath := filepath.Join(mtlsDir, "ca.crt")
75+
if _, err := os.Stat(caPath); err != nil {
76+
return nil
77+
}
78+
79+
cfg := &types.TLSConfig{CAFile: caPath}
80+
81+
certPath := filepath.Join(mtlsDir, "tls.crt")
82+
keyPath := filepath.Join(mtlsDir, "tls.key")
83+
if _, err := os.Stat(certPath); err == nil {
84+
if _, err := os.Stat(keyPath); err == nil {
85+
cfg.CertFile = certPath
86+
cfg.KeyFile = keyPath
87+
}
88+
}
89+
90+
return gateway.WithTLS(cfg)
91+
}
92+
93+
// requireClient returns the shared gateway client, skipping the calling test
94+
// when OPENSHELL_GATEWAY was not set at process startup.
95+
func requireClient(t *testing.T) *v1.Client {
96+
t.Helper()
97+
if gatewayName == "" {
98+
t.Skip("OPENSHELL_GATEWAY not set")
99+
}
100+
return sharedClient
101+
}
102+
103+
// waitForPersistenceReady polls the gateway until its persistence layer is
104+
// initialized, tolerating the transient errors observed right after the
105+
// gateway process starts (transport not yet listening, sqlite migrations
106+
// not yet applied).
107+
func waitForPersistenceReady(client *v1.Client) error {
108+
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
109+
defer cancel()
110+
111+
var lastErr error
112+
for range 60 {
113+
_, err := client.Sandboxes().ListAll(ctx, "default", v1.ListOptions{PageSize: 1})
114+
if err == nil {
115+
return nil
116+
}
117+
lastErr = err
118+
if v1.IsUnavailable(err) {
119+
time.Sleep(2 * time.Second)
120+
continue
121+
}
122+
if strings.Contains(err.Error(), "no such table: objects") {
123+
time.Sleep(1 * time.Second)
124+
continue
125+
}
126+
return fmt.Errorf("unexpected error waiting for persistence: %w", err)
127+
}
128+
return fmt.Errorf("openshell-server persistence is not initialized after 60 attempts: %w", lastErr)
129+
}
130+
131+
// uniqueName returns a process-unique resource name so parallel tests never
132+
// collide on the same sandbox/workspace/provider name.
133+
func uniqueName(prefix string) string {
134+
return fmt.Sprintf("%s-%09d", prefix, time.Now().UnixNano()%1_000_000_000)
135+
}
136+
137+
func requireSandboxResponse(t *testing.T, sandbox *v1.Sandbox, workspace, name string) {
138+
t.Helper()
139+
require.NotNil(t, sandbox)
140+
require.NotEmpty(t, sandbox.ID)
141+
require.Equal(t, workspace, sandbox.Workspace)
142+
require.Equal(t, name, sandbox.Name)
143+
require.False(t, sandbox.CreatedAt.IsZero())
144+
require.NotZero(t, sandbox.ResourceVersion)
145+
}
146+
147+
func requireReadySandbox(t *testing.T, sandbox *v1.Sandbox, id string) {
148+
t.Helper()
149+
require.NotNil(t, sandbox)
150+
require.Equal(t, id, sandbox.ID)
151+
require.Equal(t, v1.SandboxReady, sandbox.Status.Phase)
152+
}
153+
154+
func readEnvVar(ctx context.Context, client *v1.Client, workspace, sandboxName, key string) (string, error) {
155+
command := []string{"sh", "-c", `if value=$(printenv "$1"); then printf "%s" "$value"; else printf NOT_SET; fi`, "--", key}
156+
result, err := client.Exec().Run(ctx, workspace, sandboxName, command, v1.ExecOptions{})
157+
// A supervisor reconnect can make one reverse relay miss its opening window.
158+
// Retry only that transport timeout; repeated failures still fail the test.
159+
if err != nil && ctx.Err() == nil && v1.IsDeadlineExceeded(err) && strings.Contains(err.Error(), "relay open timed out") {
160+
select {
161+
case <-ctx.Done():
162+
return "", ctx.Err()
163+
case <-time.After(250 * time.Millisecond):
164+
}
165+
result, err = client.Exec().Run(ctx, workspace, sandboxName, command, v1.ExecOptions{})
166+
}
167+
if err != nil {
168+
return "", err
169+
}
170+
if result.ExitCode != 0 {
171+
return "", fmt.Errorf("exec exited %d: %s", result.ExitCode, string(result.Stderr))
172+
}
173+
if len(result.Stderr) != 0 {
174+
return "", fmt.Errorf("exec wrote unexpected stderr: %s", string(result.Stderr))
175+
}
176+
return string(result.Stdout), nil
177+
}
178+
179+
func isPlaceholderForEnvKey(value, key string) bool {
180+
const prefix = "openshell:resolve:env:"
181+
suffix, ok := strings.CutPrefix(value, prefix)
182+
if !ok {
183+
return false
184+
}
185+
if suffix == key {
186+
return true
187+
}
188+
189+
discriminator, placeholderKey, ok := strings.Cut(suffix, "_")
190+
if !ok || placeholderKey != key || len(discriminator) < 2 {
191+
return false
192+
}
193+
194+
switch discriminator[0] {
195+
case 'v':
196+
for _, char := range discriminator[1:] {
197+
if char < '0' || char > '9' {
198+
return false
199+
}
200+
}
201+
return true
202+
case 's':
203+
if len(discriminator) != 65 {
204+
return false
205+
}
206+
for _, char := range discriminator[1:] {
207+
if !((char >= '0' && char <= '9') || (char >= 'a' && char <= 'f')) {
208+
return false
209+
}
210+
}
211+
return true
212+
default:
213+
return false
214+
}
215+
}
216+
217+
func TestIsPlaceholderForEnvKey(t *testing.T) {
218+
stableHandle := strings.Repeat("a1", 32)
219+
tests := []struct {
220+
name string
221+
value string
222+
key string
223+
want bool
224+
}{
225+
{name: "plain", value: "openshell:resolve:env:API_KEY", key: "API_KEY", want: true},
226+
{name: "revisioned", value: "openshell:resolve:env:v12_API_KEY", key: "API_KEY", want: true},
227+
{name: "stable handle", value: "openshell:resolve:env:s" + stableHandle + "_API_KEY", key: "API_KEY", want: true},
228+
{name: "overlapping key suffix", value: "openshell:resolve:env:v12_LONG_API_KEY", key: "API_KEY", want: false},
229+
{name: "revision requires digits", value: "openshell:resolve:env:vnext_API_KEY", key: "API_KEY", want: false},
230+
{name: "stable handle requires lowercase hex", value: "openshell:resolve:env:s" + strings.ToUpper(stableHandle) + "_API_KEY", key: "API_KEY", want: false},
231+
{name: "stable handle requires 64 characters", value: "openshell:resolve:env:sabc_API_KEY", key: "API_KEY", want: false},
232+
{name: "wrong key", value: "openshell:resolve:env:v12_OTHER_KEY", key: "API_KEY", want: false},
233+
{name: "raw secret", value: "secret", key: "API_KEY", want: false},
234+
}
235+
236+
for _, test := range tests {
237+
t.Run(test.name, func(t *testing.T) {
238+
require.Equal(t, test.want, isPlaceholderForEnvKey(test.value, test.key))
239+
})
240+
}
241+
}
242+
243+
// pollUntil calls fetch until the predicate is satisfied, the local polling
244+
// timeout expires, or ctx is done, whichever happens first.
245+
func pollUntil[T any](t *testing.T, ctx context.Context, fetch func() T, predicate func(T) bool) T {
246+
t.Helper()
247+
deadline := time.NewTimer(35 * time.Second)
248+
defer deadline.Stop()
249+
ticker := time.NewTicker(time.Second)
250+
defer ticker.Stop()
251+
252+
for {
253+
value := fetch()
254+
if predicate(value) {
255+
return value
256+
}
257+
select {
258+
case <-ctx.Done():
259+
t.Fatalf("context done while polling; last observed %v: %v", value, ctx.Err())
260+
case <-deadline.C:
261+
t.Fatalf("timed out waiting for expected value, last observed %v", value)
262+
case <-ticker.C:
263+
}
264+
}
265+
}
266+
267+
// defaultPolicy returns a baseline sandbox policy sufficient for exec-based tests.
268+
func defaultPolicy() *v1.SandboxPolicy {
269+
return &v1.SandboxPolicy{
270+
Version: 1,
271+
Filesystem: &v1.FilesystemPolicy{
272+
IncludeWorkdir: true,
273+
ReadOnly: []string{"/usr", "/lib", "/lib64", "/proc", "/etc", "/app", "/dev/urandom"},
274+
ReadWrite: []string{"/sandbox", "/tmp", "/dev/null"},
275+
},
276+
Landlock: &v1.LandlockPolicy{Compatibility: "best_effort"},
277+
Process: &v1.ProcessPolicy{RunAsUser: "10001", RunAsGroup: "10001"},
278+
}
279+
}

0 commit comments

Comments
 (0)