add content-addressed hak source mode (#7)
Reviewed-on: #7 Co-authored-by: vickydotbat <vickydotbat@tutamail.com> Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit was merged in pull request #7.
This commit is contained in:
@@ -11,6 +11,48 @@ import (
|
||||
"git.westgate.pw/ShadowsOverWestgate/sow-tools/internal/pipeline"
|
||||
)
|
||||
|
||||
func TestParseBuildHAKArgsContentAddressedRoot(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args []string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "separated",
|
||||
args: []string{"--content-addressed-root", "/var/cache/blobs"},
|
||||
want: "/var/cache/blobs",
|
||||
},
|
||||
{
|
||||
name: "inline",
|
||||
args: []string{"--content-addressed-root=/var/cache/blobs"},
|
||||
want: "/var/cache/blobs",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
opts, err := parseBuildHAKArgs(tt.args)
|
||||
if err != nil {
|
||||
t.Fatalf("parse build-haks args: %v", err)
|
||||
}
|
||||
if opts.contentAddressedRoot != tt.want {
|
||||
t.Fatalf("content-addressed root = %q, want %q", opts.contentAddressedRoot, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseBuildHAKArgsHelpListsContentAddressedRoot(t *testing.T) {
|
||||
_, err := parseBuildHAKArgs([]string{"--help"})
|
||||
if err == nil {
|
||||
t.Fatal("expected help usage error")
|
||||
}
|
||||
const want = "usage: build-haks [--hak <hak-name> ...] [--archive <archive-name> ...] [--source-manifest <path>] [--content-addressed-root <path>] [--plan-only] [--skip-music] [--music-dataset <id> ...] [--quiet|--verbose|--debug]"
|
||||
if err.Error() != want {
|
||||
t.Fatalf("help usage = %q, want %q", err.Error(), want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunBuildTopPackageUsesCachedCompiledOutputs(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mkdirAll(t, filepath.Join(root, "build"))
|
||||
|
||||
Reference in New Issue
Block a user