From ffd98424d8c5e9450a5d057c10e6e90c8b2d8a4a Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 14 Jan 2022 10:25:43 +0100 Subject: [PATCH 1/2] Correctly set log-level from config.toml This change contains a bugfix where the log-level (if specified in the config.toml file) would be assigned to config.Root instead of config.LogLevel. Signed-off-by: Evan Lezar --- .../config/toml.go | 2 +- .../config/toml_test.go | 52 +++++++++++-------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/cmd/nvidia-container-runtime.experimental/config/toml.go b/cmd/nvidia-container-runtime.experimental/config/toml.go index 7b8f3716..055ede1c 100644 --- a/cmd/nvidia-container-runtime.experimental/config/toml.go +++ b/cmd/nvidia-container-runtime.experimental/config/toml.go @@ -117,7 +117,7 @@ func (c tomlConfig) updateFromReader(cfg *Config, reader io.Reader) error { } if v, ok := section.GetStringFrom(toml, "log-level"); ok { - cfg.Root = v + cfg.LogLevel = v } } return nil diff --git a/cmd/nvidia-container-runtime.experimental/config/toml_test.go b/cmd/nvidia-container-runtime.experimental/config/toml_test.go index fee0c300..dbd29345 100644 --- a/cmd/nvidia-container-runtime.experimental/config/toml_test.go +++ b/cmd/nvidia-container-runtime.experimental/config/toml_test.go @@ -87,32 +87,42 @@ func TestUpdateFromReader(t *testing.T) { LogLevel: "info", }, }, + { + description: "log-level is set", + lines: []string{"nvidia-container-runtime.log-level=\"trace\""}, + expected: &Config{ + DebugFilePath: "/dev/null", + LogLevel: "trace", + }, + }, } - for i, tc := range testCases { - cfg := getDefaultConfig() + for _, tc := range testCases { + t.Run(tc.description, func(t *testing.T) { + cfg := getDefaultConfig() - c := tomlConfig{ - logger: logger, - sections: []tomlSection{ - {section: nvidiaContainerRuntimeConfigSection}, - }, - } - var reader io.Reader - if tc.readerError { - reader = iotest.ErrReader(fmt.Errorf("error")) - } else { - reader = strings.NewReader(strings.Join(tc.lines, "\n")) - } + c := tomlConfig{ + logger: logger, + sections: []tomlSection{ + {section: nvidiaContainerRuntimeConfigSection}, + }, + } + var reader io.Reader + if tc.readerError { + reader = iotest.ErrReader(fmt.Errorf("error")) + } else { + reader = strings.NewReader(strings.Join(tc.lines, "\n")) + } - err := c.updateFromReader(cfg, reader) + err := c.updateFromReader(cfg, reader) - if tc.expectedError { - require.Error(t, err, "%d: %v", i, tc.description) - } else { - require.NoError(t, err, "%d: %v", i, tc.description) - } - require.EqualValues(t, tc.expected, cfg, "%d: %v", i, tc.description) + if tc.expectedError { + require.Error(t, err) + } else { + require.NoError(t, err) + } + require.EqualValues(t, tc.expected, cfg) + }) } } From 6f0129bdf2416d417460b83b898d7ee6cac1b695 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 14 Jan 2022 12:03:43 +0100 Subject: [PATCH 2/2] Remove amazonlinux1 package builds from CI Signed-off-by: Evan Lezar --- .common-ci.yml | 4 ---- .gitlab-ci.yml | 7 ------- build/container/Makefile | 1 - 3 files changed, 12 deletions(-) diff --git a/.common-ci.yml b/.common-ci.yml index dcb90282..33e61894 100644 --- a/.common-ci.yml +++ b/.common-ci.yml @@ -35,10 +35,6 @@ stages: - build-all # Define the distribution targets -.dist-amazonlinux1: - variables: - DIST: amazonlinux1 - .dist-amazonlinux2: variables: DIST: amazonlinux2 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f716cae0..da446359 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -103,12 +103,6 @@ unit-tests: - ${ARTIFACTS_ROOT} # Define the package build targets -package-amazonlinux1-x86_64: - extends: - - .package-build - - .dist-amazonlinux1 - - .arch-x86_64 - package-amazonlinux2-aarch64: extends: - .package-build @@ -259,7 +253,6 @@ image-packaging: - .package-artifacts - .dist-packaging needs: - - package-amazonlinux1-x86_64 - package-amazonlinux2-aarch64 - package-amazonlinux2-x86_64 - package-centos7-ppc64le diff --git a/build/container/Makefile b/build/container/Makefile index 100c22c1..3bda4970 100644 --- a/build/container/Makefile +++ b/build/container/Makefile @@ -119,7 +119,6 @@ $(TEST_TARGETS): test-%: test-packaging: DIST = packaging test-packaging: @echo "Testing package image contents" - @$(DOCKER) run --rm $(IMAGE) test -d "/artifacts/packages/amazonlinux1/x86_64" || echo "Missing amazonlinux1/x86_64" @$(DOCKER) run --rm $(IMAGE) test -d "/artifacts/packages/amazonlinux2/aarch64" || echo "Missing amazonlinux2/aarch64" @$(DOCKER) run --rm $(IMAGE) test -d "/artifacts/packages/amazonlinux2/x86_64" || echo "Missing amazonlinux2/x86_64" @$(DOCKER) run --rm $(IMAGE) test -d "/artifacts/packages/centos7/ppc64le" || echo "Missing centos7/ppc64le"