From 9d20a706722b1603c21d82e6c7263bb3a673af61 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 19 Jun 2025 16:46:19 +0200 Subject: [PATCH] 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. --- integration/hsic/hsic.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/integration/hsic/hsic.go b/integration/hsic/hsic.go index 4d1c824f..1049b730 100644 --- a/integration/hsic/hsic.go +++ b/integration/hsic/hsic.go @@ -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)