Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/sandbox/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func ImportProfile(ctx context.Context, id, profilePath string) error {

importCtx, importCancel := context.WithTimeout(ctx, providerTimeout)
defer importCancel()
cmd := exec.CommandContext(importCtx, "openshell", "provider", "profile", "import", profilePath)
cmd := exec.CommandContext(importCtx, "openshell", "provider", "profile", "import", "--file", profilePath)
out, err := cmd.CombinedOutput()
if err != nil {
outStr := strings.ToLower(string(out))
Expand Down
24 changes: 24 additions & 0 deletions internal/sandbox/sandbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,30 @@ exit 0
assert.NoError(t, err)
}

func TestImportProfile_UsesFileFlag(t *testing.T) {
dir := t.TempDir()
argsFile := filepath.Join(dir, "args.log")

// Fake openshell that logs args on "import" invocations and exits 0.
script := `#!/bin/sh
if [ "$3" = "import" ]; then
echo "$@" >> ` + argsFile + `
fi
exit 0
`
fakePath := filepath.Join(dir, "openshell")
require.NoError(t, os.WriteFile(fakePath, []byte(script), 0o755))
t.Setenv("PATH", dir)

err := ImportProfile(context.Background(), "my-profile", "/some/my-profile.yaml")
require.NoError(t, err)

logged, err := os.ReadFile(argsFile)
require.NoError(t, err)
assert.Contains(t, string(logged), "--file /some/my-profile.yaml",
"ImportProfile must pass --file flag to openshell provider profile import")
}

func TestImportProfile_AlreadyExists(t *testing.T) {
dir := t.TempDir()

Expand Down
Loading