Home / Function/ Test_Storage_Memory_ResetWithContext() — fiber Function Reference

Test_Storage_Memory_ResetWithContext() — fiber Function Reference

Architecture documentation for the Test_Storage_Memory_ResetWithContext() function in memory_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  f69ca7d9_011f_b0a3_c04b_b277d9d3af11["Test_Storage_Memory_ResetWithContext()"]
  5fc515d5_e762_b957_5588_68b2d14010d3["memory_test.go"]
  f69ca7d9_011f_b0a3_c04b_b277d9d3af11 -->|defined in| 5fc515d5_e762_b957_5588_68b2d14010d3
  style f69ca7d9_011f_b0a3_c04b_b277d9d3af11 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

internal/storage/memory/memory_test.go lines 262–294

func Test_Storage_Memory_ResetWithContext(t *testing.T) {
	t.Parallel()
	testStore := New()
	val := []byte("doe")

	err := testStore.Set("john1", val, 0)
	require.NoError(t, err)

	err = testStore.Set("john2", val, 0)
	require.NoError(t, err)

	keys, err := testStore.Keys()
	require.NoError(t, err)
	require.Len(t, keys, 2)

	ctx, cancel := context.WithCancel(context.Background())
	cancel()

	err = testStore.ResetWithContext(ctx)
	require.ErrorIs(t, err, context.Canceled)

	result, err := testStore.Get("john1")
	require.NoError(t, err)
	require.Equal(t, val, result)

	result, err = testStore.Get("john2")
	require.NoError(t, err)
	require.Equal(t, val, result)

	keys, err = testStore.Keys()
	require.NoError(t, err)
	require.Len(t, keys, 2)
}

Subdomains

Frequently Asked Questions

What does Test_Storage_Memory_ResetWithContext() do?
Test_Storage_Memory_ResetWithContext() is a function in the fiber codebase, defined in internal/storage/memory/memory_test.go.
Where is Test_Storage_Memory_ResetWithContext() defined?
Test_Storage_Memory_ResetWithContext() is defined in internal/storage/memory/memory_test.go at line 262.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free