forked from kenn-io/agentsview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesktop_sidecar_test.go
More file actions
62 lines (52 loc) · 1.46 KB
/
Copy pathdesktop_sidecar_test.go
File metadata and controls
62 lines (52 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package agentsview_test
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func TestPrepareSidecarRestoresPricingSnapshotBeforeBuild(t *testing.T) {
requireUnixShell(t)
root := t.TempDir()
installRepoFile(t, root, "desktop/scripts/prepare-sidecar.sh", 0o755)
writeDesktopDevWorkspace(t, root)
stubs := installUnixBuildStubs(t, root)
out, err := runInWorkspace(
t,
root,
stubs.env("AGENTSVIEW_VERSION=v1.2.3"),
"bash",
"desktop/scripts/prepare-sidecar.sh",
)
require.NoError(t, err, "%s", out)
assertEventOrder(t, stubs.events(t),
"npm run build",
"go run ./internal/pricing/cmd/litellm-snapshot -restore",
"go build -tags fts5",
)
require.FileExists(t, filepath.Join(
root,
"desktop",
"src-tauri",
"binaries",
"agentsview-x86_64-unknown-linux-gnu",
))
}
func TestPrepareSidecarStopsWhenPricingSnapshotRestoreFails(t *testing.T) {
requireUnixShell(t)
root := t.TempDir()
installRepoFile(t, root, "desktop/scripts/prepare-sidecar.sh", 0o755)
writeDesktopDevWorkspace(t, root)
stubs := installUnixBuildStubs(t, root)
out, err := runInWorkspace(
t,
root,
stubs.env("AGENTSVIEW_VERSION=v1.2.3", "RESTORE_FAIL=1"),
"bash",
"desktop/scripts/prepare-sidecar.sh",
)
require.Error(t, err, "script should fail when snapshot restore fails: %s", out)
events := stubs.events(t)
assertEventContains(t, events,
"go run ./internal/pricing/cmd/litellm-snapshot -restore")
assertNoEventContains(t, events, "go build")
}