v0.33.1 9577fee

deferred_init_test.go RawHistoryFolder

1package bootstrap
2
3import (
4	"context"
5	"sync"
6	"testing"
7
8	"github.com/bnema/dumber/internal/infrastructure/config"
9	"github.com/stretchr/testify/assert"
10	"github.com/stretchr/testify/require"
11)
12
13// TestRunDeferredInit_CEFExecutesNoWebKitDiagnostics verifies that automatic
14// CEF startup runs no unrelated WebKit pkg-config or GStreamer media
15// diagnostics. Explicit diagnostic commands invoke the Check* functions
16// directly and are unaffected.
17func TestRunDeferredInit_CEFExecutesNoWebKitDiagnostics(t *testing.T) {
18	t.Setenv("DUMBER_ENGINE", config.EngineTypeCEF)
19	cfg := config.DefaultConfig()
20	cfg.Engine.Type = config.EngineTypeCEF
21
22	// The probe fires inside each check goroutine, so a zero count proves
23	// engine selection skipped the checks without invoking them. Not
24	// parallel-safe with other probe users by design; restored via defer.
25	var mu sync.Mutex
26	var invoked []string
27	deferredInitProbeForTest = func(kind string) {
28		mu.Lock()
29		defer mu.Unlock()
30		invoked = append(invoked, kind)
31	}
32	defer func() { deferredInitProbeForTest = nil }()
33
34	result := RunDeferredInit(DeferredInitInput{Ctx: context.Background(), Config: cfg})
35
36	assert.NoError(t, result.RuntimeErr, "CEF startup must not run WebKit runtime diagnostics")
37	assert.NoError(t, result.MediaErr, "CEF startup must not run GStreamer media diagnostics")
38	assert.Empty(t, invoked, "CEF startup must not invoke WebKit runtime/media diagnostics at all")
39}
40
41// TestCheckFunctions_RemainAvailableForExplicitCommands verifies the
42// underlying checks stay callable for explicit diagnostic commands after
43// RunDeferredInit stops invoking them automatically for CEF.
44func TestCheckFunctions_RemainAvailableForExplicitCommands(t *testing.T) {
45	t.Setenv("DUMBER_ENGINE", config.EngineTypeCEF)
46	cfg := config.DefaultConfig()
47	cfg.Engine.Type = config.EngineTypeCEF
48
49	// The functions must exist and be invocable regardless of engine; their
50	// results depend on host tooling, so only invocation (not success) is
51	// asserted here.
52	_ = CheckRuntimeRequirements(context.Background(), cfg)
53	_ = CheckMediaRequirements(context.Background(), cfg)
54	require.NotNil(t, cfg)
55}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close