@@ -33,7 +33,6 @@ import (
33
33
"github.com/firecracker-microvm/firecracker-go-sdk/client/operations"
34
34
ops "github.com/firecracker-microvm/firecracker-go-sdk/client/operations"
35
35
"github.com/firecracker-microvm/firecracker-go-sdk/fctesting"
36
- log "github.com/sirupsen/logrus"
37
36
"github.com/stretchr/testify/assert"
38
37
)
39
38
@@ -86,7 +85,8 @@ func TestNewMachine(t *testing.T) {
86
85
ExecFile : "/path/to/firecracker" ,
87
86
ChrootStrategy : NewNaiveChrootStrategy ("path" , "kernel-image-path" ),
88
87
},
89
- })
88
+ },
89
+ WithLogger (fctesting .NewLogEntry ()))
90
90
if err != nil {
91
91
t .Fatalf ("failed to create new machine: %v" , err )
92
92
}
@@ -241,7 +241,7 @@ func TestJailerMicroVMExecution(t *testing.T) {
241
241
WithStderr (os .Stderr ).
242
242
Build (ctx )
243
243
244
- m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ))
244
+ m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ), WithLogger ( fctesting . NewLogEntry ()) )
245
245
if err != nil {
246
246
t .Fatalf ("failed to create new machine: %v" , err )
247
247
}
@@ -304,7 +304,7 @@ func TestMicroVMExecution(t *testing.T) {
304
304
WithBin (getFirecrackerBinaryPath ()).
305
305
Build (ctx )
306
306
307
- m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ))
307
+ m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ), WithLogger ( fctesting . NewLogEntry ()) )
308
308
if err != nil {
309
309
t .Fatalf ("failed to create new machine: %v" , err )
310
310
}
@@ -368,7 +368,7 @@ func TestStartVMM(t *testing.T) {
368
368
WithSocketPath (cfg .SocketPath ).
369
369
WithBin (getFirecrackerBinaryPath ()).
370
370
Build (ctx )
371
- m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ))
371
+ m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ), WithLogger ( fctesting . NewLogEntry ()) )
372
372
if err != nil {
373
373
t .Fatalf ("failed to create new machine: %v" , err )
374
374
}
@@ -416,7 +416,7 @@ func TestStartVMMOnce(t *testing.T) {
416
416
WithSocketPath (cfg .SocketPath ).
417
417
WithBin (getFirecrackerBinaryPath ()).
418
418
Build (ctx )
419
- m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ))
419
+ m , err := NewMachine (ctx , cfg , WithProcessRunner (cmd ), WithLogger ( fctesting . NewLogEntry ()) )
420
420
if err != nil {
421
421
t .Fatalf ("unexpected error: %v" , err )
422
422
}
@@ -625,7 +625,8 @@ func TestWaitForSocket(t *testing.T) {
625
625
errchan := make (chan error )
626
626
627
627
m := Machine {
628
- cfg : Config {SocketPath : filename },
628
+ cfg : Config {SocketPath : filename },
629
+ logger : fctesting .NewLogEntry (),
629
630
}
630
631
631
632
go func () {
@@ -637,13 +638,13 @@ func TestWaitForSocket(t *testing.T) {
637
638
}()
638
639
639
640
// Socket file created, HTTP request succeeded
640
- m .client = NewClient (filename , log . NewEntry ( log . New () ), true , WithOpsClient (& okClient ))
641
+ m .client = NewClient (filename , fctesting . NewLogEntry ( ), true , WithOpsClient (& okClient ))
641
642
if err := m .waitForSocket (500 * time .Millisecond , errchan ); err != nil {
642
643
t .Errorf ("waitForSocket returned unexpected error %s" , err )
643
644
}
644
645
645
646
// Socket file exists, HTTP request failed
646
- m .client = NewClient (filename , log . NewEntry ( log . New () ), true , WithOpsClient (& errClient ))
647
+ m .client = NewClient (filename , fctesting . NewLogEntry ( ), true , WithOpsClient (& errClient ))
647
648
if err := m .waitForSocket (500 * time .Millisecond , errchan ); err != context .DeadlineExceeded {
648
649
t .Error ("waitforSocket did not return an expected timeout error" )
649
650
}
@@ -698,7 +699,7 @@ func TestLogFiles(t *testing.T) {
698
699
},
699
700
}
700
701
ctx := context .Background ()
701
- client := NewClient ("socket-path" , log . NewEntry ( log . New () ), true , WithOpsClient (& opClient ))
702
+ client := NewClient ("socket-path" , fctesting . NewLogEntry ( ), true , WithOpsClient (& opClient ))
702
703
703
704
stdoutPath := filepath .Join (testDataPath , "stdout.log" )
704
705
stderrPath := filepath .Join (testDataPath , "stderr.log" )
@@ -727,6 +728,7 @@ func TestLogFiles(t *testing.T) {
727
728
cfg ,
728
729
WithClient (client ),
729
730
WithProcessRunner (cmd ),
731
+ WithLogger (fctesting .NewLogEntry ()),
730
732
)
731
733
if err != nil {
732
734
t .Fatalf ("failed to create new machine: %v" , err )
@@ -777,7 +779,7 @@ func TestCaptureFifoToFile(t *testing.T) {
777
779
t .Fatalf ("Failed to create fifo file: %v" , err )
778
780
}
779
781
780
- if err := captureFifoToFile (log . NewEntry ( log . New () ), fifoPath , fifo ); err != nil {
782
+ if err := captureFifoToFile (fctesting . NewLogEntry ( ), fifoPath , fifo ); err != nil {
781
783
t .Errorf ("Unexpected error: %v" , err )
782
784
}
783
785
0 commit comments