diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-03-21 09:35:15 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-04-08 13:26:17 +0200 |
commit | d070bdf10f14d233288f7318a4e9f7555f070a65 (patch) | |
tree | fff8d59f98bdab3027bb45c4e10ca88594332872 /resources | |
parent | b08193971a821fc27e549a73120c15e5e5186775 (diff) |
Rework the Destination filesystem to make --renderStaticToDisk work
See #9626
Diffstat (limited to 'resources')
-rw-r--r-- | resources/resource_transformers/htesting/testhelpers.go | 4 | ||||
-rw-r--r-- | resources/testhelpers_test.go | 3 | ||||
-rw-r--r-- | resources/transform_test.go | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/resources/resource_transformers/htesting/testhelpers.go b/resources/resource_transformers/htesting/testhelpers.go index 147e5b89c..3c91fc0dd 100644 --- a/resources/resource_transformers/htesting/testhelpers.go +++ b/resources/resource_transformers/htesting/testhelpers.go @@ -27,9 +27,7 @@ import ( ) func NewTestResourceSpec() (*resources.Spec, error) { - cfg := config.New() - cfg.Set("baseURL", "https://example.org") - cfg.Set("publishDir", "public") + cfg := config.NewWithTestDefaults() imagingCfg := map[string]any{ "resampleFilter": "linear", diff --git a/resources/testhelpers_test.go b/resources/testhelpers_test.go index 9941e12cf..1f7e5f93c 100644 --- a/resources/testhelpers_test.go +++ b/resources/testhelpers_test.go @@ -79,7 +79,7 @@ func newTestResourceSpec(desc specDescriptor) *Spec { cfg.Set("imaging", imagingCfg) fs := hugofs.NewFrom(afs, cfg) - fs.Destination = hugofs.NewCreateCountingFs(fs.Destination) + fs.PublishDir = hugofs.NewCreateCountingFs(fs.PublishDir) s, err := helpers.NewPathSpec(fs, cfg, nil) c.Assert(err, qt.IsNil) @@ -118,7 +118,6 @@ func newTestResourceOsFs(c *qt.C) (*Spec, string) { cfg.Set("workingDir", workDir) fs := hugofs.NewFrom(hugofs.NewBaseFileDecorator(hugofs.Os), cfg) - fs.Destination = &afero.MemMapFs{} s, err := helpers.NewPathSpec(fs, cfg, nil) c.Assert(err, qt.IsNil) diff --git a/resources/transform_test.go b/resources/transform_test.go index cfc004224..cf0a7d421 100644 --- a/resources/transform_test.go +++ b/resources/transform_test.go @@ -70,13 +70,13 @@ func TestTransform(t *testing.T) { // Verify that we publish the same file once only. assertNoDuplicateWrites := func(c *qt.C, spec *Spec) { c.Helper() - d := spec.Fs.Destination.(hugofs.DuplicatesReporter) + d := spec.Fs.PublishDir.(hugofs.DuplicatesReporter) c.Assert(d.ReportDuplicates(), qt.Equals, "") } assertShouldExist := func(c *qt.C, spec *Spec, filename string, should bool) { c.Helper() - exists, _ := helpers.Exists(filepath.FromSlash(filename), spec.Fs.Destination) + exists, _ := helpers.Exists(filepath.FromSlash(filename), spec.Fs.WorkingDirReadOnly) c.Assert(exists, qt.Equals, should) } |