@@ -31,6 +31,7 @@ import (
31
31
"testing"
32
32
33
33
"github.com/gohugoio/hugo/common/loggers"
34
+ "github.com/gohugoio/hugo/deploy/deployconfig"
34
35
"github.com/gohugoio/hugo/hugofs"
35
36
"github.com/gohugoio/hugo/media"
36
37
"github.com/google/go-cmp/cmp"
@@ -110,7 +111,7 @@ func TestFindDiffs(t *testing.T) {
110
111
{
111
112
Description : "local == remote with route.Force true -> diffs" ,
112
113
Local : []* localFile {
113
- {NativePath : "aaa" , SlashPath : "aaa" , UploadSize : 1 , matcher : & Matcher {Force : true }, md5 : hash1 },
114
+ {NativePath : "aaa" , SlashPath : "aaa" , UploadSize : 1 , matcher : & deployconfig. Matcher {Force : true }, md5 : hash1 },
114
115
makeLocal ("bbb" , 2 , hash1 ),
115
116
},
116
117
Remote : []* blob.ListObject {
@@ -293,7 +294,7 @@ func TestLocalFile(t *testing.T) {
293
294
tests := []struct {
294
295
Description string
295
296
Path string
296
- Matcher * Matcher
297
+ Matcher * deployconfig. Matcher
297
298
MediaTypesConfig map [string ]any
298
299
WantContent []byte
299
300
WantSize int64
@@ -319,7 +320,7 @@ func TestLocalFile(t *testing.T) {
319
320
{
320
321
Description : "CacheControl from matcher" ,
321
322
Path : "foo.txt" ,
322
- Matcher : & Matcher {CacheControl : "max-age=630720000" },
323
+ Matcher : & deployconfig. Matcher {CacheControl : "max-age=630720000" },
323
324
WantContent : contentBytes ,
324
325
WantSize : contentLen ,
325
326
WantMD5 : contentMD5 [:],
@@ -328,7 +329,7 @@ func TestLocalFile(t *testing.T) {
328
329
{
329
330
Description : "ContentEncoding from matcher" ,
330
331
Path : "foo.txt" ,
331
- Matcher : & Matcher {ContentEncoding : "foobar" },
332
+ Matcher : & deployconfig. Matcher {ContentEncoding : "foobar" },
332
333
WantContent : contentBytes ,
333
334
WantSize : contentLen ,
334
335
WantMD5 : contentMD5 [:],
@@ -337,7 +338,7 @@ func TestLocalFile(t *testing.T) {
337
338
{
338
339
Description : "ContentType from matcher" ,
339
340
Path : "foo.txt" ,
340
- Matcher : & Matcher {ContentType : "foo/bar" },
341
+ Matcher : & deployconfig. Matcher {ContentType : "foo/bar" },
341
342
WantContent : contentBytes ,
342
343
WantSize : contentLen ,
343
344
WantMD5 : contentMD5 [:],
@@ -346,7 +347,7 @@ func TestLocalFile(t *testing.T) {
346
347
{
347
348
Description : "gzipped content" ,
348
349
Path : "foo.txt" ,
349
- Matcher : & Matcher {Gzip : true },
350
+ Matcher : & deployconfig. Matcher {Gzip : true },
350
351
WantContent : gzBytes ,
351
352
WantSize : gzLen ,
352
353
WantMD5 : gzMD5 [:],
@@ -560,7 +561,7 @@ func TestEndToEndSync(t *testing.T) {
560
561
localFs : test .fs ,
561
562
bucket : test .bucket ,
562
563
mediaTypes : media .DefaultTypes ,
563
- cfg : DeployConfig {MaxDeletes : - 1 },
564
+ cfg : deployconfig. DeployConfig {MaxDeletes : - 1 },
564
565
}
565
566
566
567
// Initial deployment should sync remote with local.
@@ -643,7 +644,7 @@ func TestMaxDeletes(t *testing.T) {
643
644
localFs : test .fs ,
644
645
bucket : test .bucket ,
645
646
mediaTypes : media .DefaultTypes ,
646
- cfg : DeployConfig {MaxDeletes : - 1 },
647
+ cfg : deployconfig. DeployConfig {MaxDeletes : - 1 },
647
648
}
648
649
649
650
// Sync remote with local.
@@ -764,16 +765,16 @@ func TestIncludeExclude(t *testing.T) {
764
765
if err != nil {
765
766
t .Fatal (err )
766
767
}
767
- tgt := & Target {
768
+ tgt := & deployconfig. Target {
768
769
Include : test .Include ,
769
770
Exclude : test .Exclude ,
770
771
}
771
- if err := tgt .parseIncludeExclude (); err != nil {
772
+ if err := tgt .ParseIncludeExclude (); err != nil {
772
773
t .Error (err )
773
774
}
774
775
deployer := & Deployer {
775
776
localFs : fsTest .fs ,
776
- cfg : DeployConfig {MaxDeletes : - 1 }, bucket : fsTest .bucket ,
777
+ cfg : deployconfig. DeployConfig {MaxDeletes : - 1 }, bucket : fsTest .bucket ,
777
778
target : tgt ,
778
779
mediaTypes : media .DefaultTypes ,
779
780
}
@@ -830,7 +831,7 @@ func TestIncludeExcludeRemoteDelete(t *testing.T) {
830
831
}
831
832
deployer := & Deployer {
832
833
localFs : fsTest .fs ,
833
- cfg : DeployConfig {MaxDeletes : - 1 }, bucket : fsTest .bucket ,
834
+ cfg : deployconfig. DeployConfig {MaxDeletes : - 1 }, bucket : fsTest .bucket ,
834
835
mediaTypes : media .DefaultTypes ,
835
836
}
836
837
@@ -848,11 +849,11 @@ func TestIncludeExcludeRemoteDelete(t *testing.T) {
848
849
}
849
850
850
851
// Second sync
851
- tgt := & Target {
852
+ tgt := & deployconfig. Target {
852
853
Include : test .Include ,
853
854
Exclude : test .Exclude ,
854
855
}
855
- if err := tgt .parseIncludeExclude (); err != nil {
856
+ if err := tgt .ParseIncludeExclude (); err != nil {
856
857
t .Error (err )
857
858
}
858
859
deployer .target = tgt
@@ -882,7 +883,7 @@ func TestCompression(t *testing.T) {
882
883
deployer := & Deployer {
883
884
localFs : test .fs ,
884
885
bucket : test .bucket ,
885
- cfg : DeployConfig {MaxDeletes : - 1 , Matchers : []* Matcher {{Pattern : ".*" , Gzip : true , re : regexp .MustCompile (".*" )}}},
886
+ cfg : deployconfig. DeployConfig {MaxDeletes : - 1 , Matchers : []* deployconfig. Matcher {{Pattern : ".*" , Gzip : true , Re : regexp .MustCompile (".*" )}}},
886
887
mediaTypes : media .DefaultTypes ,
887
888
}
888
889
@@ -937,7 +938,7 @@ func TestMatching(t *testing.T) {
937
938
deployer := & Deployer {
938
939
localFs : test .fs ,
939
940
bucket : test .bucket ,
940
- cfg : DeployConfig {MaxDeletes : - 1 , Matchers : []* Matcher {{Pattern : "^subdir/aaa$" , Force : true , re : regexp .MustCompile ("^subdir/aaa$" )}}},
941
+ cfg : deployconfig. DeployConfig {MaxDeletes : - 1 , Matchers : []* deployconfig. Matcher {{Pattern : "^subdir/aaa$" , Force : true , Re : regexp .MustCompile ("^subdir/aaa$" )}}},
941
942
mediaTypes : media .DefaultTypes ,
942
943
}
943
944
@@ -962,7 +963,7 @@ func TestMatching(t *testing.T) {
962
963
}
963
964
964
965
// Repeat with a matcher that should now match 3 files.
965
- deployer .cfg .Matchers = []* Matcher {{Pattern : "aaa" , Force : true , re : regexp .MustCompile ("aaa" )}}
966
+ deployer .cfg .Matchers = []* deployconfig. Matcher {{Pattern : "aaa" , Force : true , Re : regexp .MustCompile ("aaa" )}}
966
967
if err := deployer .Deploy (ctx ); err != nil {
967
968
t .Errorf ("no-op deploy with triple force matcher: %v" , err )
968
969
}
0 commit comments