mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-07-19 01:09:52 +00:00
Co-authored-by: Elias Schneider <login@eliasschneider.com> Co-authored-by: Claude <noreply@anthropic.com>
31 lines
1.0 KiB
Go
31 lines
1.0 KiB
Go
package service
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/pocket-id/pocket-id/backend/internal/utils"
|
|
)
|
|
|
|
// TestExportExcludesActorHostTables verifies that an export does not dump the actor host's own "francis_" tables
|
|
// They hold volatile runtime state (host registrations, alarms, …), are not part of a Pocket ID export, and including them made the CLI export/import comparison tests fail
|
|
func TestExportExcludesActorHostTables(t *testing.T) {
|
|
dbPath := filepath.Join(t.TempDir(), "pocket-id.db")
|
|
db := openImportTestDB(t, dbPath, nil)
|
|
defer closeImportTestDB(db)
|
|
|
|
sqlDB, _ := db.DB()
|
|
require.NoError(t, utils.MigrateDatabase(t.Context(), sqlDB))
|
|
seedActorHostSchema(t, db) // creates francis_active_actors (with a row) and a view over it
|
|
|
|
export, err := NewExportService(db, nil).extractDatabase()
|
|
require.NoError(t, err)
|
|
|
|
for table := range export.Tables {
|
|
require.Falsef(t, strings.HasPrefix(table, "francis_"), "export must not include actor host table %q", table)
|
|
}
|
|
}
|