MCPcopy Index your code
hub / github.com/docker/docker-agent / TestUpdateSession_Permissions

Function TestUpdateSession_Permissions

pkg/session/store_test.go:535–569  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

533}
534
535func TestUpdateSession_Permissions(t *testing.T) {
536 t.Parallel()
537
538 tempDB := filepath.Join(t.TempDir(), "test_update_permissions.db")
539
540 store, err := NewSQLiteSessionStore(t.Context(), tempDB)
541 require.NoError(t, err)
542 defer store.(*SQLiteSessionStore).Close()
543
544 // Create a session without permissions
545 session := &Session{
546 ID: "update-permissions-session",
547 CreatedAt: time.Now(),
548 }
549
550 err = store.AddSession(t.Context(), session)
551 require.NoError(t, err)
552
553 // Update with permissions
554 session.Permissions = &PermissionsConfig{
555 Allow: []string{"safe_*"},
556 Deny: []string{"dangerous_*"},
557 }
558
559 err = store.UpdateSession(t.Context(), session)
560 require.NoError(t, err)
561
562 // Retrieve and verify
563 retrieved, err := store.GetSession(t.Context(), "update-permissions-session")
564 require.NoError(t, err)
565 require.NotNil(t, retrieved.Permissions)
566
567 assert.Equal(t, []string{"safe_*"}, retrieved.Permissions.Allow)
568 assert.Equal(t, []string{"dangerous_*"}, retrieved.Permissions.Deny)
569}
570
571func TestAgentModelOverrides_SQLite(t *testing.T) {
572 t.Parallel()

Callers

nothing calls this directly

Calls 7

AddSessionMethod · 0.95
UpdateSessionMethod · 0.95
GetSessionMethod · 0.95
NewSQLiteSessionStoreFunction · 0.85
ContextMethod · 0.80
NowMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected