(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func TestSharedState_NotConfigured(t *testing.T) { |
| 117 | t.Parallel() |
| 118 | |
| 119 | app := New() |
| 120 | |
| 121 | err := app.SharedState().Set("raw-key", []byte("raw"), time.Second) |
| 122 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 123 | |
| 124 | raw, found, err := app.SharedState().Get("raw-key") |
| 125 | require.Nil(t, raw) |
| 126 | require.False(t, found) |
| 127 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 128 | |
| 129 | err = app.SharedState().SetJSON("key", Map{"v": 1}, time.Second) |
| 130 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 131 | err = app.SharedState().SetMsgPack("key", Map{"v": 1}, time.Second) |
| 132 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 133 | err = app.SharedState().SetCBOR("key", Map{"v": 1}, time.Second) |
| 134 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 135 | err = app.SharedState().SetXML("key", Map{"v": 1}, time.Second) |
| 136 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 137 | |
| 138 | _, found, err = app.SharedState().GetJSON("key", &Map{}) |
| 139 | require.False(t, found) |
| 140 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 141 | _, found, err = app.SharedState().GetMsgPack("key", &Map{}) |
| 142 | require.False(t, found) |
| 143 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 144 | _, found, err = app.SharedState().GetCBOR("key", &Map{}) |
| 145 | require.False(t, found) |
| 146 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 147 | _, found, err = app.SharedState().GetXML("key", &Map{}) |
| 148 | require.False(t, found) |
| 149 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 150 | |
| 151 | err = app.SharedState().Delete("key") |
| 152 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 153 | |
| 154 | has, err := app.SharedState().Has("key") |
| 155 | require.False(t, has) |
| 156 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 157 | |
| 158 | err = app.SharedState().Reset() |
| 159 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 160 | |
| 161 | err = app.SharedState().Close() |
| 162 | require.ErrorIs(t, err, ErrSharedStorageNotConfigured) |
| 163 | } |
| 164 | |
| 165 | func TestSharedState_PreforkSafeWithSharedStorage(t *testing.T) { |
| 166 | t.Parallel() |
nothing calls this directly
no test coverage detected