Test_SessionManager_SetRaw_SaveError covers the save-failure warning branch of setRaw, where the store loads successfully but persisting it fails.
(t *testing.T)
| 2943 | // Test_SessionManager_SetRaw_SaveError covers the save-failure warning branch of |
| 2944 | // setRaw, where the store loads successfully but persisting it fails. |
| 2945 | func Test_SessionManager_SetRaw_SaveError(t *testing.T) { |
| 2946 | var buf bytes.Buffer |
| 2947 | fiberlog.SetOutput(&buf) |
| 2948 | t.Cleanup(func() { fiberlog.SetOutput(os.Stderr) }) |
| 2949 | |
| 2950 | storage := newFlakySessionStorage() |
| 2951 | storage.failSet = true |
| 2952 | store := session.NewStore(session.Config{ |
| 2953 | Storage: storage, |
| 2954 | Extractor: extractors.FromCookie("session_id"), |
| 2955 | }) |
| 2956 | m := newSessionManager(store) |
| 2957 | |
| 2958 | app := fiber.New() |
| 2959 | c := newSessionCtx(app, "") |
| 2960 | defer app.ReleaseCtx(c) |
| 2961 | |
| 2962 | m.setRaw(c, "key", dummyValue, time.Minute) |
| 2963 | require.Contains(t, buf.String(), "failed to save session") |
| 2964 | } |
| 2965 | |
| 2966 | // Test_SessionManager_DelRaw_StoreError covers the error branch when the session |
| 2967 | // store cannot be loaded during delRaw. |
nothing calls this directly
no test coverage detected