mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +00:00
runtime: pkg: fix govet fieldalignment
Fix structures alignment Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
2b80091e14
commit
31de8eb75b
@ -29,10 +29,10 @@ func SetLogger(logger *logrus.Entry) {
|
|||||||
|
|
||||||
// KataMonitor is monitor agent
|
// KataMonitor is monitor agent
|
||||||
type KataMonitor struct {
|
type KataMonitor struct {
|
||||||
|
sandboxCache *sandboxCache
|
||||||
containerdAddr string
|
containerdAddr string
|
||||||
containerdConfigFile string
|
containerdConfigFile string
|
||||||
containerdStatePath string
|
containerdStatePath string
|
||||||
sandboxCache *sandboxCache
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKataMonitor create and return a new KataMonitor instance
|
// NewKataMonitor create and return a new KataMonitor instance
|
||||||
|
@ -44,6 +44,7 @@ func TestComposeSocketAddress(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
url string
|
url string
|
||||||
err bool
|
err bool
|
||||||
|
@ -28,12 +28,6 @@ const (
|
|||||||
type Constraints struct {
|
type Constraints struct {
|
||||||
Issue string
|
Issue string
|
||||||
|
|
||||||
UID int
|
|
||||||
|
|
||||||
// Not ideal: set when UID needs to be checked. This allows
|
|
||||||
// a test for UID 0 to be detected.
|
|
||||||
UIDSet bool
|
|
||||||
|
|
||||||
// DistroName is the name of a distro in all lower-case letters.
|
// DistroName is the name of a distro in all lower-case letters.
|
||||||
DistroName string
|
DistroName string
|
||||||
|
|
||||||
@ -44,8 +38,14 @@ type Constraints struct {
|
|||||||
// KernelVersion is the version of a particular kernel.
|
// KernelVersion is the version of a particular kernel.
|
||||||
KernelVersion string
|
KernelVersion string
|
||||||
|
|
||||||
|
UID int
|
||||||
|
|
||||||
// Operator is the operator to apply to one of the constraints.
|
// Operator is the operator to apply to one of the constraints.
|
||||||
Operator Operator
|
Operator Operator
|
||||||
|
|
||||||
|
// Not ideal: set when UID needs to be checked. This allows
|
||||||
|
// a test for UID 0 to be detected.
|
||||||
|
UIDSet bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constraint is a function that operates on a Constraints object to set
|
// Constraint is a function that operates on a Constraints object to set
|
||||||
@ -54,23 +54,23 @@ type Constraint func(c *Constraints)
|
|||||||
|
|
||||||
// TestConstraint records details about test constraints.
|
// TestConstraint records details about test constraints.
|
||||||
type TestConstraint struct {
|
type TestConstraint struct {
|
||||||
Debug bool
|
|
||||||
|
|
||||||
// Effective user ID of running test
|
|
||||||
ActualEUID int
|
|
||||||
|
|
||||||
DistroName string
|
DistroName string
|
||||||
DistroVersion string
|
DistroVersion string
|
||||||
KernelVersion string
|
KernelVersion string
|
||||||
|
|
||||||
|
// Optionally used to record an issue number that relates to the
|
||||||
|
// constraint.
|
||||||
|
Issue string
|
||||||
|
|
||||||
// Used to record all passed and failed constraints in
|
// Used to record all passed and failed constraints in
|
||||||
// human-readable form.
|
// human-readable form.
|
||||||
Passed []Result
|
Passed []Result
|
||||||
Failed []Result
|
Failed []Result
|
||||||
|
|
||||||
// Optionally used to record an issue number that relates to the
|
Debug bool
|
||||||
// constraint.
|
|
||||||
Issue string
|
// Effective user ID of running test
|
||||||
|
ActualEUID int
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKataTest creates a new TestConstraint object and is the main interface
|
// NewKataTest creates a new TestConstraint object and is the main interface
|
||||||
|
@ -27,12 +27,14 @@ const (
|
|||||||
skipUnknownDistroName = "skipping test as cannot determine distro name"
|
skipUnknownDistroName = "skipping test as cannot determine distro name"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testDataUID struct {
|
type testDataUID struct {
|
||||||
uid int
|
uid int
|
||||||
op Operator
|
op Operator
|
||||||
c Constraints
|
c Constraints
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testDataDistro struct {
|
type testDataDistro struct {
|
||||||
distro string
|
distro string
|
||||||
op Operator
|
op Operator
|
||||||
@ -341,6 +343,7 @@ func testGetKernelVersion() (version string, err error) {
|
|||||||
func TestOperatorString(t *testing.T) {
|
func TestOperatorString(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
op Operator
|
op Operator
|
||||||
value string
|
value string
|
||||||
@ -473,6 +476,7 @@ func TestGetKernelVersion(t *testing.T) {
|
|||||||
func TestConstraintHandleDistroName(t *testing.T) {
|
func TestConstraintHandleDistroName(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
distro string
|
distro string
|
||||||
op Operator
|
op Operator
|
||||||
@ -568,6 +572,7 @@ func TestConstraintHandleDistroVersion(t *testing.T) {
|
|||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.NotEqual(distroVersion, higherVersion)
|
assert.NotEqual(distroVersion, higherVersion)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
version string
|
version string
|
||||||
op Operator
|
op Operator
|
||||||
@ -623,6 +628,7 @@ func TestConstraintHandleDistroVersion(t *testing.T) {
|
|||||||
func TestConstraintHandleVersionType(t *testing.T) {
|
func TestConstraintHandleVersionType(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
versionName string
|
versionName string
|
||||||
currentVersion string
|
currentVersion string
|
||||||
@ -791,6 +797,7 @@ func TestConstraintHandleKernelVersion(t *testing.T) {
|
|||||||
newerPatch, err := semverBumpVersion(ver, false, false, true)
|
newerPatch, err := semverBumpVersion(ver, false, false, true)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
version string
|
version string
|
||||||
op Operator
|
op Operator
|
||||||
@ -852,6 +859,7 @@ func TestConstraintHandleKernelVersion(t *testing.T) {
|
|||||||
func TestConstraintHandleUID(t *testing.T) {
|
func TestConstraintHandleUID(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
uid int
|
uid int
|
||||||
op Operator
|
op Operator
|
||||||
@ -897,6 +905,7 @@ func TestConstraintHandleUID(t *testing.T) {
|
|||||||
func TestConstraintHandleResults(t *testing.T) {
|
func TestConstraintHandleResults(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
result Result
|
result Result
|
||||||
err error
|
err error
|
||||||
@ -1330,6 +1339,7 @@ func TestConstraintNotValidDistroVersion(t *testing.T) {
|
|||||||
func TestConstraintConstraintValid(t *testing.T) {
|
func TestConstraintConstraintValid(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
fn Constraint
|
fn Constraint
|
||||||
valid bool
|
valid bool
|
||||||
@ -1522,6 +1532,7 @@ func TestConstraintConstraintValid(t *testing.T) {
|
|||||||
func TestEvalIntVersion(t *testing.T) {
|
func TestEvalIntVersion(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
currentVer string
|
currentVer string
|
||||||
op Operator
|
op Operator
|
||||||
@ -1627,6 +1638,7 @@ func TestEvalIntVersion(t *testing.T) {
|
|||||||
func TestEvalFloatVersion(t *testing.T) {
|
func TestEvalFloatVersion(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
currentVer string
|
currentVer string
|
||||||
op Operator
|
op Operator
|
||||||
@ -1742,6 +1754,7 @@ func TestEvalFloatVersion(t *testing.T) {
|
|||||||
func TestEvalSemverVersion(t *testing.T) {
|
func TestEvalSemverVersion(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
currentVer string
|
currentVer string
|
||||||
op Operator
|
op Operator
|
||||||
|
@ -11,10 +11,6 @@ import "strconv"
|
|||||||
type RuntimeConfigOptions struct {
|
type RuntimeConfigOptions struct {
|
||||||
Hypervisor string
|
Hypervisor string
|
||||||
HypervisorPath string
|
HypervisorPath string
|
||||||
DefaultVCPUCount uint32
|
|
||||||
DefaultMaxVCPUCount uint32
|
|
||||||
DefaultMemSize uint32
|
|
||||||
DefaultMsize9p uint32
|
|
||||||
DefaultGuestHookPath string
|
DefaultGuestHookPath string
|
||||||
KernelPath string
|
KernelPath string
|
||||||
ImagePath string
|
ImagePath string
|
||||||
@ -28,8 +24,15 @@ type RuntimeConfigOptions struct {
|
|||||||
AgentTraceType string
|
AgentTraceType string
|
||||||
SharedFS string
|
SharedFS string
|
||||||
VirtioFSDaemon string
|
VirtioFSDaemon string
|
||||||
|
JaegerEndpoint string
|
||||||
|
JaegerUser string
|
||||||
|
JaegerPassword string
|
||||||
PFlash []string
|
PFlash []string
|
||||||
PCIeRootPort uint32
|
PCIeRootPort uint32
|
||||||
|
DefaultVCPUCount uint32
|
||||||
|
DefaultMaxVCPUCount uint32
|
||||||
|
DefaultMemSize uint32
|
||||||
|
DefaultMsize9p uint32
|
||||||
DisableBlock bool
|
DisableBlock bool
|
||||||
EnableIOThreads bool
|
EnableIOThreads bool
|
||||||
HotplugVFIOOnRootBus bool
|
HotplugVFIOOnRootBus bool
|
||||||
@ -42,9 +45,6 @@ type RuntimeConfigOptions struct {
|
|||||||
AgentDebug bool
|
AgentDebug bool
|
||||||
AgentTrace bool
|
AgentTrace bool
|
||||||
EnablePprof bool
|
EnablePprof bool
|
||||||
JaegerEndpoint string
|
|
||||||
JaegerUser string
|
|
||||||
JaegerPassword string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerIDTestDataType is a type used to test Container and Sandbox ID's.
|
// ContainerIDTestDataType is a type used to test Container and Sandbox ID's.
|
||||||
|
@ -55,21 +55,21 @@ type tomlConfig struct {
|
|||||||
Hypervisor map[string]hypervisor
|
Hypervisor map[string]hypervisor
|
||||||
Agent map[string]agent
|
Agent map[string]agent
|
||||||
Runtime runtime
|
Runtime runtime
|
||||||
Factory factory
|
|
||||||
Netmon netmon
|
|
||||||
Image image
|
Image image
|
||||||
|
Netmon netmon
|
||||||
|
Factory factory
|
||||||
}
|
}
|
||||||
|
|
||||||
type image struct {
|
type image struct {
|
||||||
ServiceOffload bool `toml:"service_offload"`
|
|
||||||
Provision string `toml:"provision"`
|
Provision string `toml:"provision"`
|
||||||
|
ServiceOffload bool `toml:"service_offload"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type factory struct {
|
type factory struct {
|
||||||
Template bool `toml:"enable_template"`
|
|
||||||
TemplatePath string `toml:"template_path"`
|
TemplatePath string `toml:"template_path"`
|
||||||
VMCacheNumber uint `toml:"vm_cache_number"`
|
|
||||||
VMCacheEndpoint string `toml:"vm_cache_endpoint"`
|
VMCacheEndpoint string `toml:"vm_cache_endpoint"`
|
||||||
|
VMCacheNumber uint `toml:"vm_cache_number"`
|
||||||
|
Template bool `toml:"enable_template"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type hypervisor struct {
|
type hypervisor struct {
|
||||||
|
@ -39,6 +39,7 @@ var (
|
|||||||
jaegerPassword = "jaeger_password1"
|
jaegerPassword = "jaeger_password1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testRuntimeConfig struct {
|
type testRuntimeConfig struct {
|
||||||
RuntimeConfig oci.RuntimeConfig
|
RuntimeConfig oci.RuntimeConfig
|
||||||
RuntimeConfigFile string
|
RuntimeConfigFile string
|
||||||
@ -1574,6 +1575,7 @@ func TestCheckNetNsConfig(t *testing.T) {
|
|||||||
func TestCheckFactoryConfig(t *testing.T) {
|
func TestCheckFactoryConfig(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
type testData struct {
|
type testData struct {
|
||||||
factoryEnabled bool
|
factoryEnabled bool
|
||||||
expectError bool
|
expectError bool
|
||||||
|
@ -57,6 +57,7 @@ func TestEnsureDir(t *testing.T) {
|
|||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
defer os.RemoveAll(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
|
// nolint: govet
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
before func()
|
before func()
|
||||||
path string
|
path string
|
||||||
|
Loading…
Reference in New Issue
Block a user