mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-10 13:46:46 +02:00
integration/hsic: handle PostgreSQL tests properly in SaveDatabase
When tests use PostgreSQL instead of SQLite, create a note file explaining that no SQLite database is available instead of trying to extract an empty or non-existent SQLite file. This clarifies why no .db file is present when using PostgreSQL backend.
This commit is contained in:
parent
73a368b98c
commit
9d20a70672
@ -638,9 +638,16 @@ func (t *HeadscaleInContainer) SaveMapResponses(savePath string) error {
|
||||
}
|
||||
|
||||
func (t *HeadscaleInContainer) SaveDatabase(savePath string) error {
|
||||
// If using PostgreSQL, create a note file instead of trying to extract SQLite
|
||||
if t.postgres {
|
||||
notePath := path.Join(savePath, t.hostname+".db-note")
|
||||
note := "This test used PostgreSQL - no SQLite database file available.\nDatabase data is stored in the postgres container."
|
||||
return os.WriteFile(notePath, []byte(note), 0644)
|
||||
}
|
||||
|
||||
tarFile, err := t.FetchPath("/tmp/integration_test_db.sqlite3")
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to fetch database file: %w", err)
|
||||
}
|
||||
|
||||
// For database, extract the first regular file (should be the SQLite file)
|
||||
|
Loading…
Reference in New Issue
Block a user