-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reporegistry: add new
LoadAllRepositoriesFromFS
and use in tests
This commit is a (hopefully) less controversial version of: #1037 Here only a new helper to load repository information from an `fs.FS` is added and only used for loading the test repositories. This will help to have a single test repository that can be embedded accross osbuild-composer, image-builder and images. It also removes the public "NewTestedDefault()" in favor of a new `testrepos.New()` helper so that the `reporegistry` only has non-test API left.
- Loading branch information
Showing
10 changed files
with
59 additions
and
44 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
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
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
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
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,19 @@ | ||
package testrepos | ||
|
||
import ( | ||
"embed" | ||
"io/fs" | ||
|
||
"github.com/osbuild/images/pkg/reporegistry" | ||
) | ||
|
||
//go:embed *.json | ||
var FS embed.FS | ||
|
||
func New() (*reporegistry.RepoRegistry, error) { | ||
repositories, err := reporegistry.LoadAllRepositoriesFromFS([]fs.FS{FS}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return reporegistry.NewFromDistrosRepoConfigs(repositories), nil | ||
} |