@@ -12,7 +12,6 @@ import (
12
12
"github.com/hashicorp/nomad/testutil"
13
13
14
14
"github.com/hashicorp/nomad/client/config"
15
- "github.com/hashicorp/nomad/client/secretdir"
16
15
ctestutil "github.com/hashicorp/nomad/client/testutil"
17
16
)
18
17
@@ -26,7 +25,7 @@ func (m *MockAllocStateUpdater) Update(alloc *structs.Allocation) {
26
25
m .Allocs = append (m .Allocs , alloc )
27
26
}
28
27
29
- func testAllocRunnerFromAlloc (t * testing. T , alloc * structs.Allocation , restarts bool ) (* MockAllocStateUpdater , * AllocRunner ) {
28
+ func testAllocRunnerFromAlloc (alloc * structs.Allocation , restarts bool ) (* MockAllocStateUpdater , * AllocRunner ) {
30
29
logger := testLogger ()
31
30
conf := config .DefaultConfig ()
32
31
conf .StateDir = os .TempDir ()
@@ -36,17 +35,17 @@ func testAllocRunnerFromAlloc(t *testing.T, alloc *structs.Allocation, restarts
36
35
* alloc .Job .LookupTaskGroup (alloc .TaskGroup ).RestartPolicy = structs.RestartPolicy {Attempts : 0 }
37
36
alloc .Job .Type = structs .JobTypeBatch
38
37
}
39
- ar := NewAllocRunner (logger , conf , upd .Update , alloc , secretdir . NewTestSecretDir ( t ) )
38
+ ar := NewAllocRunner (logger , conf , upd .Update , alloc )
40
39
return upd , ar
41
40
}
42
41
43
- func testAllocRunner (t * testing. T , restarts bool ) (* MockAllocStateUpdater , * AllocRunner ) {
44
- return testAllocRunnerFromAlloc (t , mock .Alloc (), restarts )
42
+ func testAllocRunner (restarts bool ) (* MockAllocStateUpdater , * AllocRunner ) {
43
+ return testAllocRunnerFromAlloc (mock .Alloc (), restarts )
45
44
}
46
45
47
46
func TestAllocRunner_SimpleRun (t * testing.T ) {
48
47
ctestutil .ExecCompatible (t )
49
- upd , ar := testAllocRunner (t , false )
48
+ upd , ar := testAllocRunner (false )
50
49
go ar .Run ()
51
50
defer ar .Destroy ()
52
51
@@ -83,7 +82,7 @@ func TestAllocRunner_RetryArtifact(t *testing.T) {
83
82
}
84
83
85
84
alloc .Job .TaskGroups [0 ].Tasks = append (alloc .Job .TaskGroups [0 ].Tasks , badtask )
86
- upd , ar := testAllocRunnerFromAlloc (t , alloc , true )
85
+ upd , ar := testAllocRunnerFromAlloc (alloc , true )
87
86
go ar .Run ()
88
87
defer ar .Destroy ()
89
88
@@ -119,7 +118,7 @@ func TestAllocRunner_RetryArtifact(t *testing.T) {
119
118
120
119
func TestAllocRunner_TerminalUpdate_Destroy (t * testing.T ) {
121
120
ctestutil .ExecCompatible (t )
122
- upd , ar := testAllocRunner (t , false )
121
+ upd , ar := testAllocRunner (false )
123
122
124
123
// Ensure task takes some time
125
124
task := ar .alloc .Job .TaskGroups [0 ].Tasks [0 ]
@@ -208,7 +207,7 @@ func TestAllocRunner_TerminalUpdate_Destroy(t *testing.T) {
208
207
209
208
func TestAllocRunner_DiskExceeded_Destroy (t * testing.T ) {
210
209
ctestutil .ExecCompatible (t )
211
- upd , ar := testAllocRunner (t , false )
210
+ upd , ar := testAllocRunner (false )
212
211
213
212
// Ensure task takes some time
214
213
task := ar .alloc .Job .TaskGroups [0 ].Tasks [0 ]
@@ -314,7 +313,7 @@ func TestAllocRunner_DiskExceeded_Destroy(t *testing.T) {
314
313
}
315
314
func TestAllocRunner_Destroy (t * testing.T ) {
316
315
ctestutil .ExecCompatible (t )
317
- upd , ar := testAllocRunner (t , false )
316
+ upd , ar := testAllocRunner (false )
318
317
319
318
// Ensure task takes some time
320
319
task := ar .alloc .Job .TaskGroups [0 ].Tasks [0 ]
@@ -366,7 +365,7 @@ func TestAllocRunner_Destroy(t *testing.T) {
366
365
367
366
func TestAllocRunner_Update (t * testing.T ) {
368
367
ctestutil .ExecCompatible (t )
369
- _ , ar := testAllocRunner (t , false )
368
+ _ , ar := testAllocRunner (false )
370
369
371
370
// Ensure task takes some time
372
371
task := ar .alloc .Job .TaskGroups [0 ].Tasks [0 ]
@@ -392,7 +391,7 @@ func TestAllocRunner_Update(t *testing.T) {
392
391
393
392
func TestAllocRunner_SaveRestoreState (t * testing.T ) {
394
393
ctestutil .ExecCompatible (t )
395
- upd , ar := testAllocRunner (t , false )
394
+ upd , ar := testAllocRunner (false )
396
395
397
396
// Ensure task takes some time
398
397
task := ar .alloc .Job .TaskGroups [0 ].Tasks [0 ]
@@ -414,7 +413,7 @@ func TestAllocRunner_SaveRestoreState(t *testing.T) {
414
413
415
414
// Create a new alloc runner
416
415
ar2 := NewAllocRunner (ar .logger , ar .config , upd .Update ,
417
- & structs.Allocation {ID : ar .alloc .ID }, ar . secretDir )
416
+ & structs.Allocation {ID : ar .alloc .ID })
418
417
err = ar2 .RestoreState ()
419
418
if err != nil {
420
419
t .Fatalf ("err: %v" , err )
@@ -442,7 +441,7 @@ func TestAllocRunner_SaveRestoreState(t *testing.T) {
442
441
443
442
func TestAllocRunner_SaveRestoreState_TerminalAlloc (t * testing.T ) {
444
443
ctestutil .ExecCompatible (t )
445
- upd , ar := testAllocRunner (t , false )
444
+ upd , ar := testAllocRunner (false )
446
445
ar .logger = prefixedTestLogger ("ar1: " )
447
446
448
447
// Ensure task takes some time
@@ -486,7 +485,7 @@ func TestAllocRunner_SaveRestoreState_TerminalAlloc(t *testing.T) {
486
485
487
486
// Create a new alloc runner
488
487
ar2 := NewAllocRunner (ar .logger , ar .config , upd .Update ,
489
- & structs.Allocation {ID : ar .alloc .ID }, ar . secretDir )
488
+ & structs.Allocation {ID : ar .alloc .ID })
490
489
ar2 .logger = prefixedTestLogger ("ar2: " )
491
490
err = ar2 .RestoreState ()
492
491
if err != nil {
@@ -548,7 +547,7 @@ func TestAllocRunner_SaveRestoreState_TerminalAlloc(t *testing.T) {
548
547
549
548
func TestAllocRunner_TaskFailed_KillTG (t * testing.T ) {
550
549
ctestutil .ExecCompatible (t )
551
- upd , ar := testAllocRunner (t , false )
550
+ upd , ar := testAllocRunner (false )
552
551
553
552
// Create two tasks in the task group
554
553
task := ar .alloc .Job .TaskGroups [0 ].Tasks [0 ]
0 commit comments