fix: Move SyncRoot field to the top og the struct

This commit is contained in:
Ilya Kuznetsov 2024-11-18 11:24:33 +01:00
parent a3c6d571c8
commit 80ea3a05e3
No known key found for this signature in database
GPG Key ID: 91F3DDCF5D21CDDF
1 changed files with 7 additions and 7 deletions

View File

@ -47,6 +47,7 @@ func TestApplyPresetsPrefix(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
SyncRoot: vfs.MustNew(t.TempDir()),
Config: config.Root{ Config: config.Root{
Resources: config.Resources{ Resources: config.Resources{
Jobs: map[string]*resources.Job{ Jobs: map[string]*resources.Job{
@ -57,7 +58,6 @@ func TestApplyPresetsPrefix(t *testing.T) {
NamePrefix: tt.prefix, NamePrefix: tt.prefix,
}, },
}, },
SyncRoot: vfs.MustNew(t.TempDir()),
} }
ctx := context.Background() ctx := context.Background()
@ -174,6 +174,7 @@ func TestApplyPresetsTags(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
SyncRoot: vfs.MustNew(t.TempDir()),
Config: config.Root{ Config: config.Root{
Resources: config.Resources{ Resources: config.Resources{
Jobs: map[string]*resources.Job{ Jobs: map[string]*resources.Job{
@ -184,7 +185,6 @@ func TestApplyPresetsTags(t *testing.T) {
Tags: tt.tags, Tags: tt.tags,
}, },
}, },
SyncRoot: vfs.MustNew(t.TempDir()),
} }
ctx := context.Background() ctx := context.Background()
@ -234,6 +234,7 @@ func TestApplyPresetsJobsMaxConcurrentRuns(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
SyncRoot: vfs.MustNew(t.TempDir()),
Config: config.Root{ Config: config.Root{
Resources: config.Resources{ Resources: config.Resources{
Jobs: map[string]*resources.Job{ Jobs: map[string]*resources.Job{
@ -244,7 +245,6 @@ func TestApplyPresetsJobsMaxConcurrentRuns(t *testing.T) {
JobsMaxConcurrentRuns: tt.setting, JobsMaxConcurrentRuns: tt.setting,
}, },
}, },
SyncRoot: vfs.MustNew(t.TempDir()),
} }
ctx := context.Background() ctx := context.Background()
diag := bundle.Apply(ctx, b, mutator.ApplyPresets()) diag := bundle.Apply(ctx, b, mutator.ApplyPresets())
@ -260,6 +260,7 @@ func TestApplyPresetsJobsMaxConcurrentRuns(t *testing.T) {
func TestApplyPresetsPrefixWithoutJobSettings(t *testing.T) { func TestApplyPresetsPrefixWithoutJobSettings(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
SyncRoot: vfs.MustNew(t.TempDir()),
Config: config.Root{ Config: config.Root{
Resources: config.Resources{ Resources: config.Resources{
Jobs: map[string]*resources.Job{ Jobs: map[string]*resources.Job{
@ -270,7 +271,6 @@ func TestApplyPresetsPrefixWithoutJobSettings(t *testing.T) {
NamePrefix: "prefix-", NamePrefix: "prefix-",
}, },
}, },
SyncRoot: vfs.MustNew(t.TempDir()),
} }
ctx := context.Background() ctx := context.Background()
@ -356,13 +356,13 @@ func TestApplyPresetsResourceNotDefined(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.error, func(t *testing.T) { t.Run(tt.error, func(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
SyncRoot: vfs.MustNew(t.TempDir()),
Config: config.Root{ Config: config.Root{
Resources: tt.resources, Resources: tt.resources,
Presets: config.Presets{ Presets: config.Presets{
TriggerPauseStatus: config.Paused, TriggerPauseStatus: config.Paused,
}, },
}, },
SyncRoot: vfs.MustNew(t.TempDir()),
} }
ctx := context.Background() ctx := context.Background()
@ -433,6 +433,8 @@ func TestApplyPresetsInPlaceDeployment(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
b := &bundle.Bundle{ b := &bundle.Bundle{
SyncRoot: vfs.MustNew(tt.bundlePath),
SyncRootPath: tt.bundlePath,
Config: config.Root{ Config: config.Root{
Presets: config.Presets{ Presets: config.Presets{
InPlaceDeployment: tt.initialValue, InPlaceDeployment: tt.initialValue,
@ -441,8 +443,6 @@ func TestApplyPresetsInPlaceDeployment(t *testing.T) {
FilePath: remotePath, FilePath: remotePath,
}, },
}, },
SyncRoot: vfs.MustNew(tt.bundlePath),
SyncRootPath: tt.bundlePath,
} }
diags := bundle.Apply(tt.ctx, b, mutator.ApplyPresets()) diags := bundle.Apply(tt.ctx, b, mutator.ApplyPresets())