Skip to content

Commit

Permalink
minor fixes for tests to run
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Lockart <[email protected]>
  • Loading branch information
alam0rt committed Nov 18, 2024
1 parent 5a51c20 commit 96934b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions pkg/config/engine/containerd/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,17 @@ func New(opts ...Option) (engine.Interface, error) {
return nil, fmt.Errorf("failed to load config: %v", err)
}

useLegacyConfig := b.configVersion == 1

cfg := &Config{
Tree: tomlConfig,
Logger: b.logger,
RuntimeType: b.runtimeType,
UseDefaultRuntimeName: b.useLegacyConfig,
UseDefaultRuntimeName: useLegacyConfig,
ContainerAnnotations: b.containerAnnotations,
}

version, err := cfg.parseVersion(b.useLegacyConfig)
version, err := cfg.parseVersion(useLegacyConfig)
if err != nil {
return nil, fmt.Errorf("failed to parse config version: %v", err)
}
Expand Down
12 changes: 6 additions & 6 deletions tools/container/runtime/containerd/config_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

const (
runtimeType = "runtime_type"
runtimeTypeV3 = "runtime_type"
)

func TestUpdateV3ConfigDefaultRuntime(t *testing.T) {
Expand Down Expand Up @@ -78,7 +78,7 @@ func TestUpdateV3ConfigDefaultRuntime(t *testing.T) {
v3 := &containerd.ConfigV3{
Logger: logger,
Tree: cfg,
RuntimeType: runtimeType,
RuntimeType: runtimeTypeV3,
}

err = o.UpdateConfig(v3)
Expand Down Expand Up @@ -201,7 +201,7 @@ func TestUpdateV3Config(t *testing.T) {
v3 := &containerd.ConfigV3{
Logger: logger,
Tree: cfg,
RuntimeType: runtimeType,
RuntimeType: runtimeTypeV3,
ContainerAnnotations: []string{"cdi.k8s.io/*"},
}

Expand Down Expand Up @@ -354,7 +354,7 @@ func TestUpdateV3ConfigWithRuncPresent(t *testing.T) {
v3 := &containerd.ConfigV3{
Logger: logger,
Tree: cfg,
RuntimeType: runtimeType,
RuntimeType: runtimeTypeV3,
ContainerAnnotations: []string{"cdi.k8s.io/*"},
}

Expand Down Expand Up @@ -426,7 +426,7 @@ func TestRevertV3Config(t *testing.T) {

v3 := &containerd.ConfigV3{
Tree: cfg,
RuntimeType: runtimeType,
RuntimeType: runtimeTypeV3,
}

err = o.RevertConfig(v3)
Expand All @@ -442,7 +442,7 @@ func TestRevertV3Config(t *testing.T) {

func runtimeMapV3(binary string) map[string]interface{} {
return map[string]interface{}{
"runtime_type": runtimeType,
"runtime_type": runtimeTypeV3,
"runtime_root": "",
"runtime_engine": "",
"privileged_without_host_devices": false,
Expand Down

0 comments on commit 96934b2

Please sign in to comment.