remove the use key stripping and store the proper keys (#1603)

This commit is contained in:
Kristoffer Dalby 2023-11-16 17:55:29 +01:00 committed by GitHub
parent 2af71c9e31
commit c0fd06e3f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 99 additions and 198 deletions

View file

@ -348,6 +348,14 @@ func (t *HeadscaleInContainer) Shutdown() error {
)
}
err = t.SaveDatabase("/tmp/control")
if err != nil {
log.Printf(
"Failed to save database from control: %s",
fmt.Errorf("failed to save database from control: %w", err),
)
}
return t.pool.Purge(t.container)
}
@ -393,6 +401,24 @@ func (t *HeadscaleInContainer) SaveMapResponses(savePath string) error {
return nil
}
func (t *HeadscaleInContainer) SaveDatabase(savePath string) error {
tarFile, err := t.FetchPath("/tmp/integration_test_db.sqlite3")
if err != nil {
return err
}
err = os.WriteFile(
path.Join(savePath, t.hostname+".db.tar"),
tarFile,
os.ModePerm,
)
if err != nil {
return err
}
return nil
}
// Execute runs a command inside the Headscale container and returns the
// result of stdout as a string.
func (t *HeadscaleInContainer) Execute(