-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow easy DB test helpers being exported
Move those and link from a subpackage, to ensure we know exactly what we import in a package (not importing tests by accident). This will be reused in the PAM/NSS services tests to load and dump the database.
- Loading branch information
Showing
2 changed files
with
25 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Package tests export cache test functionalities used by other packages. | ||
package tests | ||
|
||
import ( | ||
"io" | ||
//nolint:revive,nolintlint // needed for go:linkname, but only used in tests. nolinlint as false positive then. | ||
_ "unsafe" | ||
|
||
"github.com/ubuntu/authd/internal/cache" | ||
) | ||
|
||
// DumpToYaml deserializes the cache database to a writer in a yaml format. | ||
// | ||
//go:linkname DumpToYaml github.com/ubuntu/authd/internal/cache.(*Cache).dumpToYaml | ||
func DumpToYaml(c *cache.Cache) (string, error) | ||
|
||
// DbfromYAML loads a yaml formatted of the buckets and dump it into destDir, with its dbname. | ||
// | ||
//go:linkname DbfromYAML github.com/ubuntu/authd/internal/cache.dbfromYAML | ||
func DbfromYAML(r io.Reader, destDir string) error |