Skip to content

Commit 8e3c098

Browse files
authored
Merge pull request #434 from kzys/fix-debug-helper
Fix DebugHelper
2 parents b102a23 + 9f29dad commit 8e3c098

File tree

5 files changed

+10
-71
lines changed

5 files changed

+10
-71
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# express or implied. See the License for the specific language governing
1212
# permissions and limitations under the License.
1313

14-
SUBDIRS:=agent runtime internal examples firecracker-control/cmd/containerd eventbridge
14+
SUBDIRS:=agent runtime examples firecracker-control/cmd/containerd
1515
TEST_SUBDIRS:=$(addprefix test-,$(SUBDIRS))
1616
INTEG_TEST_SUBDIRS:=$(addprefix integ-test-,$(SUBDIRS))
1717

@@ -121,6 +121,7 @@ image: $(RUNC_BIN) agent-in-docker
121121
$(MAKE) -C tools/image-builder all-in-docker
122122

123123
test: $(TEST_SUBDIRS)
124+
go test ./... $(EXTRAGOARGS)
124125

125126
# test-in-docker runs all unit tests inside a docker container. Use "integ-test" to
126127
# run the integ-tests inside containers.

config/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ func LoadConfig(path string) (*Config, error) {
9494
},
9595
}
9696

97+
if err := json.Unmarshal(data, cfg); err != nil {
98+
return nil, errors.Wrapf(err, "failed to unmarshal config from %q", path)
99+
}
100+
97101
cfg.DebugHelper, err = debug.New(cfg.LogLevels...)
98102
if err != nil {
99103
return nil, err
100104
}
101105

102-
if err := json.Unmarshal(data, cfg); err != nil {
103-
return nil, errors.Wrapf(err, "failed to unmarshal config from %q", path)
104-
}
105-
106106
return cfg, nil
107107
}

config/config_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ func TestLoadConfigOverrides(t *testing.T) {
4747
"kernel_image_path":"%s",
4848
"root_drive":"%s",
4949
"cpu_count": %d,
50-
"cpu_template": "%s"
50+
"cpu_template": "%s",
51+
"log_levels": ["debug"]
5152
}`, overrideKernelArgs, overrideKernelPath, overrideRootfsPath, overrideCPUCount, overrideCPUTemplate)
5253
configFile, cleanup := createTempConfig(t, configContent)
5354
defer cleanup()
@@ -58,6 +59,8 @@ func TestLoadConfigOverrides(t *testing.T) {
5859
assert.Equal(t, overrideKernelPath, cfg.KernelImagePath, "expected overridden kernel path")
5960
assert.Equal(t, overrideRootfsPath, cfg.RootDrive, "expected overridden rootfs path")
6061
assert.Equal(t, overrideCPUTemplate, cfg.CPUTemplate, "expected overridden CPU template")
62+
63+
assert.True(t, cfg.DebugHelper.LogFirecrackerOutput())
6164
}
6265

6366
func createTempConfig(t *testing.T, contents string) (string, func()) {

eventbridge/Makefile

Lines changed: 0 additions & 35 deletions
This file was deleted.

internal/Makefile

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)