Skip to content

Commit 35d6283

Browse files
fix: Apply linters
1 parent bc39849 commit 35d6283

File tree

307 files changed

+1067
-1067
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+1067
-1067
lines changed

internal/pkg/diff/diff_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,6 @@ func TestResults_Format(t *testing.T) {
805805

806806
func newProjectState(t *testing.T) *state.State {
807807
t.Helper()
808-
d := dependencies.NewMocked(t, context.Background())
808+
d := dependencies.NewMocked(t, t.Context())
809809
return d.MockedState()
810810
}

internal/pkg/encoding/json/schema/schema_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func testInvalidComponentSchema(t *testing.T, invalidSchema []byte, expectedLogs
321321
}),
322322
},
323323
})
324-
registry := state.NewRegistry(knownpaths.NewNop(context.Background()), naming.NewRegistry(), components, model.SortByID)
324+
registry := state.NewRegistry(knownpaths.NewNop(t.Context()), naming.NewRegistry(), components, model.SortByID)
325325
require.NoError(t, registry.Set(&model.ConfigState{
326326
ConfigManifest: &model.ConfigManifest{ConfigKey: model.ConfigKey{ComponentID: componentID}},
327327
Local: &model.Config{Content: someContent},
@@ -334,7 +334,7 @@ func testInvalidComponentSchema(t *testing.T, invalidSchema []byte, expectedLogs
334334
// Validate, no error
335335
content := orderedmap.New()
336336
content.Set(`parameters`, orderedmap.New())
337-
require.NoError(t, ValidateObjects(context.Background(), logger, registry))
337+
require.NoError(t, ValidateObjects(t.Context(), logger, registry))
338338
assert.Equal(t, strings.TrimLeft(expectedLogs, "\n"), logger.AllMessagesTxt())
339339
}
340340

internal/pkg/encoding/jsonnet/fsimporter/fsimporter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestImporter(t *testing.T) {
1717
t.Parallel()
1818

1919
// Create context
20-
ctx := context.Background()
20+
ctx := t.Context()
2121
fs := aferofs.NewMemoryFs()
2222
jsonnetCtx := jsonnet.NewContext().WithImporter(fsimporter.New(fs))
2323

internal/pkg/env/loader_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestLoadDotEnv(t *testing.T) {
1717
// Memory fs
1818
logger := log.NewDebugLogger()
1919
fs := aferofs.NewMemoryFs(filesystem.WithLogger(logger))
20-
ctx := context.Background()
20+
ctx := t.Context()
2121

2222
// Write envs to file
2323
osEnvs := Empty()
@@ -28,7 +28,7 @@ func TestLoadDotEnv(t *testing.T) {
2828

2929
// Load envs
3030
logger.Truncate()
31-
envs := LoadDotEnv(context.Background(), logger, osEnvs, fs, []string{"."})
31+
envs := LoadDotEnv(t.Context(), logger, osEnvs, fs, []string{"."})
3232

3333
// Assert
3434
assert.Equal(t, map[string]string{
@@ -54,11 +54,11 @@ func TestLoadDotEnv_Invalid(t *testing.T) {
5454
fs := aferofs.NewMemoryFs(filesystem.WithLogger(logger))
5555

5656
// Write envs to file
57-
require.NoError(t, fs.WriteFile(context.Background(), filesystem.NewRawFile(".env.local", "invalid")))
57+
require.NoError(t, fs.WriteFile(t.Context(), filesystem.NewRawFile(".env.local", "invalid")))
5858

5959
// Load envs
6060
logger.Truncate()
61-
envs := LoadDotEnv(context.Background(), logger, Empty(), fs, []string{"."})
61+
envs := LoadDotEnv(t.Context(), logger, Empty(), fs, []string{"."})
6262

6363
// Assert
6464
assert.Equal(t, map[string]string{}, envs.ToMap())

internal/pkg/filesystem/aferofs/filesystem_test.go

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (*testCases) TestBasePath(t *testing.T, fs filesystem.Fs, _ log.DebugLogger
126126
}
127127

128128
func (*testCases) TestWorkingDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
129-
ctx := context.Background()
129+
ctx := t.Context()
130130
assert.Equal(t, "my/dir", fs.WorkingDir())
131131
require.NoError(t, fs.Mkdir(ctx, "some/dir"))
132132
fs.SetWorkingDir(ctx, "some/dir")
@@ -136,7 +136,7 @@ func (*testCases) TestWorkingDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogg
136136
}
137137

138138
func (*testCases) TestSubDirFs(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
139-
ctx := context.Background()
139+
ctx := t.Context()
140140
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("sub/dir1/dir2/file.txt", "foo\n")))
141141
assert.True(t, fs.IsFile(ctx, `sub/dir1/dir2/file.txt`))
142142

@@ -205,7 +205,7 @@ func (*testCases) TestSetLogger(t *testing.T, fs filesystem.Fs, _ log.DebugLogge
205205
}
206206

207207
func (*testCases) TestWalk(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
208-
ctx := context.Background()
208+
ctx := t.Context()
209209
require.NoError(t, fs.Mkdir(ctx, "sub/dir1/dir2/dir3"))
210210
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("sub/dir2/file.txt", "foo\n")))
211211

@@ -233,7 +233,7 @@ func (*testCases) TestWalk(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
233233
}
234234

235235
func (*testCases) TestGlob(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
236-
ctx := context.Background()
236+
ctx := t.Context()
237237
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
238238
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir2/file.txt", "foo\n")))
239239

@@ -255,15 +255,15 @@ func (*testCases) TestGlob(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
255255
}
256256

257257
func (*testCases) TestStat(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
258-
ctx := context.Background()
258+
ctx := t.Context()
259259
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir/file.txt", "foo\n")))
260260
s, err := fs.Stat(ctx, `my/dir/file.txt`)
261261
require.NoError(t, err)
262262
assert.False(t, s.IsDir())
263263
}
264264

265265
func (*testCases) TestReadDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
266-
ctx := context.Background()
266+
ctx := t.Context()
267267
require.NoError(t, fs.Mkdir(ctx, "my/dir/subdir"))
268268
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir/file.txt", "foo\n")))
269269

@@ -273,7 +273,7 @@ func (*testCases) TestReadDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger)
273273
}
274274

275275
func (*testCases) TestExists(t *testing.T, fs filesystem.Fs, logger log.DebugLogger) {
276-
ctx := context.Background()
276+
ctx := t.Context()
277277
// Create file
278278
filePath := "file.txt"
279279
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile(filePath, "foo\n")))
@@ -286,7 +286,7 @@ func (*testCases) TestExists(t *testing.T, fs filesystem.Fs, logger log.DebugLog
286286
}
287287

288288
func (*testCases) TestIsFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
289-
ctx := context.Background()
289+
ctx := t.Context()
290290
require.NoError(t, fs.Mkdir(ctx, "my/dir"))
291291
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir/file.txt", "foo\n")))
292292

@@ -297,7 +297,7 @@ func (*testCases) TestIsFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger)
297297
}
298298

299299
func (*testCases) TestIsDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
300-
ctx := context.Background()
300+
ctx := t.Context()
301301
require.NoError(t, fs.Mkdir(ctx, "my/dir"))
302302
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir/file.txt", "foo\n")))
303303

@@ -308,7 +308,7 @@ func (*testCases) TestIsDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
308308
}
309309

310310
func (*testCases) TestCreate(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
311-
ctx := context.Background()
311+
ctx := t.Context()
312312
fd, err := fs.Create(ctx, `file.txt`)
313313
require.NoError(t, err)
314314

@@ -323,7 +323,7 @@ func (*testCases) TestCreate(t *testing.T, fs filesystem.Fs, _ log.DebugLogger)
323323
}
324324

325325
func (*testCases) TestOpen(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
326-
ctx := context.Background()
326+
ctx := t.Context()
327327
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile(`file.txt`, "foo\n")))
328328

329329
fd, err := fs.Open(ctx, `file.txt`)
@@ -336,7 +336,7 @@ func (*testCases) TestOpen(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
336336
}
337337

338338
func (*testCases) TestOpenFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
339-
ctx := context.Background()
339+
ctx := t.Context()
340340
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile(`file.txt`, "foo\n")))
341341

342342
fd, err := fs.OpenFile(ctx, `file.txt`, os.O_RDONLY, 0o600)
@@ -349,7 +349,7 @@ func (*testCases) TestOpenFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger
349349
}
350350

351351
func (*testCases) TestMkdir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
352-
ctx := context.Background()
352+
ctx := t.Context()
353353
assert.False(t, fs.Exists(ctx, "my/dir"))
354354
require.NoError(t, fs.Mkdir(ctx, "my/dir"))
355355
assert.True(t, fs.Exists(ctx, "my/dir"))
@@ -358,7 +358,7 @@ func (*testCases) TestMkdir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
358358
}
359359

360360
func (*testCases) TestCopyFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
361-
ctx := context.Background()
361+
ctx := t.Context()
362362
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
363363
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
364364
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
@@ -373,7 +373,7 @@ func (*testCases) TestCopyFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger
373373
}
374374

375375
func (*testCases) TestCopyFileExists(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
376-
ctx := context.Background()
376+
ctx := t.Context()
377377
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
378378
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
379379
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
@@ -387,7 +387,7 @@ func (*testCases) TestCopyFileExists(t *testing.T, fs filesystem.Fs, _ log.Debug
387387
}
388388

389389
func (*testCases) TestCopyForce(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
390-
ctx := context.Background()
390+
ctx := t.Context()
391391
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
392392
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
393393
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
@@ -405,7 +405,7 @@ func (*testCases) TestCopyForce(t *testing.T, fs filesystem.Fs, _ log.DebugLogge
405405
}
406406

407407
func (*testCases) TestCopyDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
408-
ctx := context.Background()
408+
ctx := t.Context()
409409
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
410410
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
411411

@@ -419,7 +419,7 @@ func (*testCases) TestCopyDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger)
419419
}
420420

421421
func (*testCases) TestCopyDirExists(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
422-
ctx := context.Background()
422+
ctx := t.Context()
423423
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
424424
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
425425
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
@@ -431,7 +431,7 @@ func (*testCases) TestCopyDirExists(t *testing.T, fs filesystem.Fs, _ log.DebugL
431431
}
432432

433433
func (*testCases) TestMoveFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
434-
ctx := context.Background()
434+
ctx := t.Context()
435435
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
436436
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
437437
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
@@ -446,7 +446,7 @@ func (*testCases) TestMoveFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger
446446
}
447447

448448
func (*testCases) TestMoveFileExists(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
449-
ctx := context.Background()
449+
ctx := t.Context()
450450
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
451451
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
452452
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
@@ -460,7 +460,7 @@ func (*testCases) TestMoveFileExists(t *testing.T, fs filesystem.Fs, _ log.Debug
460460
}
461461

462462
func (*testCases) TestMoveForce(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
463-
ctx := context.Background()
463+
ctx := t.Context()
464464
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
465465
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
466466
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
@@ -478,7 +478,7 @@ func (*testCases) TestMoveForce(t *testing.T, fs filesystem.Fs, _ log.DebugLogge
478478
}
479479

480480
func (*testCases) TestMoveDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
481-
ctx := context.Background()
481+
ctx := t.Context()
482482
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
483483
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
484484

@@ -492,7 +492,7 @@ func (*testCases) TestMoveDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger)
492492
}
493493

494494
func (*testCases) TestMoveDirExists(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
495-
ctx := context.Background()
495+
ctx := t.Context()
496496
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
497497
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
498498
require.NoError(t, fs.Mkdir(ctx, "my/dir2"))
@@ -504,7 +504,7 @@ func (*testCases) TestMoveDirExists(t *testing.T, fs filesystem.Fs, _ log.DebugL
504504
}
505505

506506
func (*testCases) TestRemoveFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
507-
ctx := context.Background()
507+
ctx := t.Context()
508508
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
509509
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
510510

@@ -514,7 +514,7 @@ func (*testCases) TestRemoveFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogg
514514
}
515515

516516
func (*testCases) TestRemoveDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
517-
ctx := context.Background()
517+
ctx := t.Context()
518518
require.NoError(t, fs.Mkdir(ctx, "my/dir1"))
519519
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile("my/dir1/file.txt", "foo\n")))
520520

@@ -524,12 +524,12 @@ func (*testCases) TestRemoveDir(t *testing.T, fs filesystem.Fs, _ log.DebugLogge
524524
}
525525

526526
func (*testCases) TestRemoveNotExist(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
527-
ctx := context.Background()
527+
ctx := t.Context()
528528
require.NoError(t, fs.Remove(ctx, "my/dir1/file.txt"))
529529
}
530530

531531
func (*testCases) TestReadFile(t *testing.T, fs filesystem.Fs, logger log.DebugLogger) {
532-
ctx := context.Background()
532+
ctx := t.Context()
533533
// Create file
534534
filePath := "file.txt"
535535
require.NoError(t, fs.WriteFile(ctx, filesystem.NewRawFile(filePath, "foo\n")))
@@ -544,7 +544,7 @@ func (*testCases) TestReadFile(t *testing.T, fs filesystem.Fs, logger log.DebugL
544544
}
545545

546546
func (*testCases) TestReadFileNotFound(t *testing.T, fs filesystem.Fs, logger log.DebugLogger) {
547-
ctx := context.Background()
547+
ctx := t.Context()
548548
filePath := "file.txt"
549549
file, err := fs.ReadFile(ctx, filesystem.NewFileDef(filePath))
550550
require.Error(t, err)
@@ -554,7 +554,7 @@ func (*testCases) TestReadFileNotFound(t *testing.T, fs filesystem.Fs, logger lo
554554
}
555555

556556
func (*testCases) TestWriteFile(t *testing.T, fs filesystem.Fs, logger log.DebugLogger) {
557-
ctx := context.Background()
557+
ctx := t.Context()
558558
filePath := "file.txt"
559559

560560
// Write
@@ -569,7 +569,7 @@ func (*testCases) TestWriteFile(t *testing.T, fs filesystem.Fs, logger log.Debug
569569
}
570570

571571
func (*testCases) TestWriteFileDirNotFound(t *testing.T, fs filesystem.Fs, logger log.DebugLogger) {
572-
ctx := context.Background()
572+
ctx := t.Context()
573573
filePath := "my/dir/file.txt"
574574

575575
// Write
@@ -588,7 +588,7 @@ func (*testCases) TestWriteFileDirNotFound(t *testing.T, fs filesystem.Fs, logge
588588
}
589589

590590
func (*testCases) TestWriteFile_JsonFile(t *testing.T, fs filesystem.Fs, logger log.DebugLogger) {
591-
ctx := context.Background()
591+
ctx := t.Context()
592592
filePath := "file.json"
593593

594594
// Write
@@ -605,7 +605,7 @@ func (*testCases) TestWriteFile_JsonFile(t *testing.T, fs filesystem.Fs, logger
605605
}
606606

607607
func (*testCases) TestCreateOrUpdateFile(t *testing.T, fs filesystem.Fs, _ log.DebugLogger) {
608-
ctx := context.Background()
608+
ctx := t.Context()
609609
filePath := "file.txt"
610610

611611
// Create empty file

internal/pkg/filesystem/aferofs/mountfs/mountfs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestMountFs_Rename(t *testing.T) {
2323
t.Parallel()
2424

2525
// Create FS
26-
ctx := context.Background()
26+
ctx := t.Context()
2727
root := aferofs.NewMemoryFs()
2828
dir1 := aferofs.NewMemoryFs()
2929
dir2 := aferofs.NewMemoryFs()

0 commit comments

Comments
 (0)