mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 17:22:33 +00:00
unit-test: add nolint comment to avoid unused warning
since all generic* could bring unused linter warnings, which lead to CI crash, we add nolint comment to avoid them. Fixes: #1200 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
This commit is contained in:
parent
3ec56eaf9f
commit
1b967a4a6a
@ -52,9 +52,9 @@ const (
|
||||
kernelPropertyCorrect = "Kernel property value correct"
|
||||
|
||||
// these refer to fields in the procCPUINFO file
|
||||
genericCPUFlagsTag = "flags"
|
||||
genericCPUVendorField = "vendor_id"
|
||||
genericCPUModelField = "model name"
|
||||
genericCPUFlagsTag = "flags" // nolint: varcheck, unused
|
||||
genericCPUVendorField = "vendor_id" // nolint: varcheck, unused
|
||||
genericCPUModelField = "model name" // nolint: varcheck, unused
|
||||
)
|
||||
|
||||
// variables rather than consts to allow tests to modify them
|
||||
|
@ -121,12 +121,12 @@ func normalizeArmModel(model string) string {
|
||||
return model
|
||||
}
|
||||
|
||||
func getCPUDetails() (vendor, model string, err error) {
|
||||
if vendor, model, err := genericGetCPUDetails(); err == nil {
|
||||
func getCPUDetails() (string, string, error) {
|
||||
vendor, model, err := genericGetCPUDetails()
|
||||
if err == nil {
|
||||
vendor = normalizeArmVendor(vendor)
|
||||
model = normalizeArmModel(model)
|
||||
return vendor, model, err
|
||||
} else {
|
||||
return vendor, model, err
|
||||
}
|
||||
|
||||
return vendor, model, err
|
||||
}
|
||||
|
@ -27,12 +27,14 @@ type testModuleData struct {
|
||||
contents string
|
||||
}
|
||||
|
||||
// nolint: structcheck, unused
|
||||
type testCPUData struct {
|
||||
vendorID string
|
||||
flags string
|
||||
expectError bool
|
||||
}
|
||||
|
||||
// nolint: structcheck, unused
|
||||
type testCPUDetail struct {
|
||||
contents string
|
||||
expectedVendor string
|
||||
@ -145,6 +147,7 @@ func makeCPUInfoFile(path, vendorID, flags string) error {
|
||||
return ioutil.WriteFile(path, contents.Bytes(), testFileMode)
|
||||
}
|
||||
|
||||
// nolint: unused
|
||||
func genericTestGetCPUDetails(t *testing.T, validVendor string, validModel string, validContents string, data []testCPUDetail) {
|
||||
tmpdir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
|
@ -244,6 +244,7 @@ func getExpectedAgentDetails(config oci.RuntimeConfig) (AgentInfo, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// nolint: unused
|
||||
func genericGetExpectedHostDetails(tmpdir string, expectedVendor string, expectedModel string) (HostInfo, error) {
|
||||
type filesToCreate struct {
|
||||
file string
|
||||
|
@ -1407,6 +1407,7 @@ func (q *qemu) resizeMemory(reqMemMB uint32, memoryBlockSizeMB uint32) (uint32,
|
||||
}
|
||||
|
||||
// genericAppendBridges appends to devices the given bridges
|
||||
// nolint: unused
|
||||
func genericAppendBridges(devices []govmmQemu.Device, bridges []types.PCIBridge, machineType string) []govmmQemu.Device {
|
||||
bus := defaultPCBridgeBus
|
||||
switch machineType {
|
||||
@ -1438,6 +1439,7 @@ func genericAppendBridges(devices []govmmQemu.Device, bridges []types.PCIBridge,
|
||||
return devices
|
||||
}
|
||||
|
||||
// nolint: unused
|
||||
func genericBridges(number uint32, machineType string) []types.PCIBridge {
|
||||
var bridges []types.PCIBridge
|
||||
var bt types.PCIType
|
||||
@ -1470,6 +1472,7 @@ func genericBridges(number uint32, machineType string) []types.PCIBridge {
|
||||
return bridges
|
||||
}
|
||||
|
||||
// nolint: unused
|
||||
func genericMemoryTopology(memoryMb, hostMemoryMb uint64, slots uint8, memoryOffset uint32) govmmQemu.Memory {
|
||||
// image NVDIMM device needs memory space 1024MB
|
||||
// See https://github.com/clearcontainers/runtime/issues/380
|
||||
|
Loading…
Reference in New Issue
Block a user