idle_runtime_timeout_test.go RawHistoryFolder

1package config
2
3import (
4	"os"
5	"path/filepath"
6	"testing"
7
8	"github.com/spf13/viper"
9	"github.com/stretchr/testify/require"
10)
11
12func TestIdleRuntimeTimeoutDefaultsToDisabled(t *testing.T) {
13	require.Equal(t, 0, DefaultConfig().Engine.CEF.IdleRuntimeTimeoutMs)
14}
15
16func TestIdleRuntimeTimeoutFileOverride(t *testing.T) {
17	dir := t.TempDir()
18	configPath := filepath.Join(dir, "config.toml")
19	require.NoError(t, os.WriteFile(configPath, []byte("[engine.cef]\nidle_runtime_timeout_ms = 60000\n"), 0o600))
20
21	m := &Manager{viper: viper.New()}
22	m.viper.SetConfigFile(configPath)
23	m.viper.SetConfigType("toml")
24	m.configureAutomaticEnv()
25	m.setDefaults()
26	require.NoError(t, m.viper.ReadInConfig())
27
28	require.Equal(t, 60000, m.viper.GetInt("engine.cef.idle_runtime_timeout_ms"))
29}
30
31func TestIdleRuntimeTimeoutEnvMapping(t *testing.T) {
32	dir := t.TempDir()
33	configPath := filepath.Join(dir, "config.toml")
34	require.NoError(t, os.WriteFile(configPath, []byte("[engine.cef]\n"), 0o600))
35	t.Setenv("DUMBER_ENGINE_CEF_IDLE_RUNTIME_TIMEOUT_MS", "45000")
36
37	m := &Manager{viper: viper.New()}
38	m.viper.SetConfigFile(configPath)
39	m.viper.SetConfigType("toml")
40	m.configureAutomaticEnv()
41	m.setDefaults()
42	require.NoError(t, m.viper.ReadInConfig())
43
44	require.Equal(t, 45000, m.viper.GetInt("engine.cef.idle_runtime_timeout_ms"))
45}
46
47func TestIdleRuntimeTimeoutStableAcrossUnrelatedReload(t *testing.T) {
48	dir := t.TempDir()
49	configPath := filepath.Join(dir, "config.toml")
50	require.NoError(t, os.WriteFile(configPath, []byte("[engine.cef]\nidle_runtime_timeout_ms = 60000\n"), 0o600))
51
52	load := func() int {
53		m := &Manager{viper: viper.New()}
54		m.viper.SetConfigFile(configPath)
55		m.viper.SetConfigType("toml")
56		m.configureAutomaticEnv()
57		m.setDefaults()
58		require.NoError(t, m.viper.ReadInConfig())
59		return m.viper.GetInt("engine.cef.idle_runtime_timeout_ms")
60	}
61	require.Equal(t, 60000, load())
62
63	require.NoError(t, os.WriteFile(configPath, []byte("[engine.cef]\nidle_runtime_timeout_ms = 60000\nlog_severity = 3\n"), 0o600))
64	require.Equal(t, 60000, load(), "unrelated reload must not change the effective timeout")
65}

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