@@ -72,6 +72,12 @@ func TestNewMachine(t *testing.T) {
72
72
Config {
73
73
Debug : true ,
74
74
DisableValidation : true ,
75
+ MachineCfg : models.MachineConfiguration {
76
+ VcpuCount : Int64 (1 ),
77
+ MemSizeMib : Int64 (100 ),
78
+ CPUTemplate : models .CPUTemplate (models .CPUTemplateT2 ),
79
+ HtEnabled : Bool (false ),
80
+ },
75
81
JailerCfg : JailerConfig {
76
82
GID : Int (100 ),
77
83
UID : Int (100 ),
@@ -158,9 +164,10 @@ func TestJailerMicroVMExecution(t *testing.T) {
158
164
LogLevel : "Debug" ,
159
165
KernelImagePath : vmlinuxPath ,
160
166
MachineCfg : models.MachineConfiguration {
161
- VcpuCount : nCpus ,
167
+ VcpuCount : Int64 ( nCpus ) ,
162
168
CPUTemplate : cpuTemplate ,
163
- MemSizeMib : memSz ,
169
+ MemSizeMib : Int64 (memSz ),
170
+ HtEnabled : Bool (false ),
164
171
},
165
172
Drives : []models.Drive {
166
173
models.Drive {
@@ -274,9 +281,10 @@ func TestMicroVMExecution(t *testing.T) {
274
281
MetricsFifo : metricsFifo ,
275
282
LogLevel : "Debug" ,
276
283
MachineCfg : models.MachineConfiguration {
277
- VcpuCount : nCpus ,
284
+ VcpuCount : Int64 ( nCpus ) ,
278
285
CPUTemplate : cpuTemplate ,
279
- MemSizeMib : memSz ,
286
+ MemSizeMib : Int64 (memSz ),
287
+ HtEnabled : Bool (false ),
280
288
},
281
289
Debug : true ,
282
290
DisableValidation : true ,
@@ -388,7 +396,10 @@ func TestStartVMMOnce(t *testing.T) {
388
396
DisableValidation : true ,
389
397
KernelImagePath : getVmlinuxPath (t ),
390
398
MachineCfg : models.MachineConfiguration {
391
- VcpuCount : 1 ,
399
+ VcpuCount : Int64 (1 ),
400
+ MemSizeMib : Int64 (64 ),
401
+ CPUTemplate : models .CPUTemplate (models .CPUTemplateT2 ),
402
+ HtEnabled : Bool (false ),
392
403
},
393
404
}
394
405
ctx := context .Background ()
@@ -453,14 +464,10 @@ func testCreateMachine(ctx context.Context, t *testing.T, m *Machine) {
453
464
}
454
465
455
466
func testMachineConfigApplication (ctx context.Context , t * testing.T , m * Machine , expectedValues Config ) {
456
- if m .machineConfig .VcpuCount != expectedValues .MachineCfg .VcpuCount {
457
- t .Errorf ("Got unexpected number of VCPUs: Expected: %d, Actual: %d" ,
458
- expectedValues .MachineCfg .VcpuCount , m .cfg .MachineCfg .VcpuCount )
459
- }
460
- if m .machineConfig .MemSizeMib != expectedValues .MachineCfg .MemSizeMib {
461
- t .Errorf ("Got unexpected value for machine memory: expected: %d, Got %d" ,
462
- expectedValues .MachineCfg .MemSizeMib , m .cfg .MachineCfg .MemSizeMib )
463
- }
467
+ assert .Equal (t , expectedValues .MachineCfg .VcpuCount ,
468
+ m .machineConfig .VcpuCount , "CPU count should be equal" )
469
+
470
+ assert .Equal (t , expectedValues .MachineCfg .MemSizeMib , m .machineConfig .MemSizeMib , "memory..." )
464
471
}
465
472
466
473
func testCreateBootSource (ctx context.Context , t * testing.T , m * Machine , vmlinuxPath string ) {
@@ -582,7 +589,7 @@ func testShutdown(ctx context.Context, t *testing.T, m *Machine) {
582
589
func TestWaitForSocket (t * testing.T ) {
583
590
okClient := fctesting.MockClient {}
584
591
errClient := fctesting.MockClient {
585
- GetMachineConfigFn : func (params * ops.GetMachineConfigParams ) (* ops.GetMachineConfigOK , error ) {
592
+ GetMachineConfigurationFn : func (params * ops.GetMachineConfigurationParams ) (* ops.GetMachineConfigurationOK , error ) {
586
593
return nil , errors .New ("http error" )
587
594
},
588
595
}
@@ -663,8 +670,8 @@ func TestLogFiles(t *testing.T) {
663
670
}
664
671
665
672
opClient := fctesting.MockClient {
666
- GetMachineConfigFn : func (params * ops.GetMachineConfigParams ) (* ops.GetMachineConfigOK , error ) {
667
- return & ops.GetMachineConfigOK {
673
+ GetMachineConfigurationFn : func (params * ops.GetMachineConfigurationParams ) (* ops.GetMachineConfigurationOK , error ) {
674
+ return & ops.GetMachineConfigurationOK {
668
675
Payload : & models.MachineConfiguration {},
669
676
}, nil
670
677
},
0 commit comments