MCPcopy
hub / github.com/ddworken/hishtory / TestCtxConfigIsReference

Function TestCtxConfigIsReference

client/integration_test.go:2969–2994  ·  view source on GitHub ↗

Test that the config retrieved from the context is a reference and there are no consistency issues with it getting out of sync

(t *testing.T)

Source from the content-addressed store, hash-verified

2967
2968// Test that the config retrieved from the context is a reference and there are no consistency issues with it getting out of sync
2969func TestCtxConfigIsReference(t *testing.T) {
2970 // Setup
2971 markTestForSharding(t, 11)
2972 tester := zshTester{}
2973 defer testutils.BackupAndRestore(t)()
2974 installHishtory(t, tester, "")
2975
2976 // Get two copies of the conifg
2977 ctx := hctx.MakeContext()
2978 c1 := hctx.GetConf(ctx)
2979 c2 := hctx.GetConf(ctx)
2980 require.Equal(t, *c1, *c2)
2981
2982 // Change one and check that the other is changed
2983 c1.LastSavedHistoryLine = "foobar"
2984 require.Equal(t, c1.LastSavedHistoryLine, "foobar")
2985 require.Equal(t, c2.LastSavedHistoryLine, "foobar")
2986
2987 // Persist that one, and then get the config again, and that one should also contain the change
2988 require.NoError(t, hctx.SetConfig(c1))
2989 c3 := hctx.GetConf(ctx)
2990 require.Equal(t, *c1, *c3)
2991 require.Equal(t, c1.LastSavedHistoryLine, "foobar")
2992 require.Equal(t, c2.LastSavedHistoryLine, "foobar")
2993 require.Equal(t, c3.LastSavedHistoryLine, "foobar")
2994}
2995
2996func testMultipleUsers(t *testing.T, tester shellTester) {
2997 defer testutils.BackupAndRestore(t)()

Callers

nothing calls this directly

Calls 6

BackupAndRestoreFunction · 0.92
MakeContextFunction · 0.92
GetConfFunction · 0.92
SetConfigFunction · 0.92
markTestForShardingFunction · 0.85
installHishtoryFunction · 0.85

Tested by

no test coverage detected