Skip to content

Commit 9b3bf5f

Browse files
committed
update
Signed-off-by: Zhonghu Xu <[email protected]>
1 parent 6ce9bca commit 9b3bf5f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pkg/bpf/bpf.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ func NewVersionMap(config *options.BpfConfig) *ebpf.Map {
210210
return nil
211211
}
212212

213+
log.Infof("create version map path %s", versionPath)
213214
if err := os.MkdirAll(versionPath,
214215
syscall.S_IRUSR|syscall.S_IWUSR|syscall.S_IXUSR|syscall.S_IRGRP|syscall.S_IXGRP); err != nil && !os.IsExist(err) {
215216
log.Errorf("mkdir failed %v", err)
@@ -223,7 +224,7 @@ func NewVersionMap(config *options.BpfConfig) *ebpf.Map {
223224
}
224225

225226
storeVersionInfo(m)
226-
log.Infof("kmesh start with Normal")
227+
log.Infof("store kmesh version successfully")
227228
restart.SetStartType(restart.Normal)
228229
return m
229230
}

pkg/bpf/bpf_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"kmesh.net/kmesh/daemon/options"
2929
"kmesh.net/kmesh/pkg/bpf/restart"
30+
"kmesh.net/kmesh/pkg/constants"
3031
)
3132

3233
func TestRestart(t *testing.T) {
@@ -71,6 +72,10 @@ func runTestNormal(t *testing.T) {
7172
if err := bpfLoader.Start(); err != nil {
7273
assert.ErrorIsf(t, err, nil, "bpfLoader start failed %v", err)
7374
}
75+
76+
versionPath := filepath.Join(config.BpfFsPath, constants.WorkloadVersionPath)
77+
_, err := os.Stat(versionPath)
78+
assert.NoError(t, err)
7479
assert.Equal(t, restart.Normal, restart.GetStartType(), "set kmesh start status failed")
7580
restart.SetExitType(restart.Normal)
7681
bpfLoader.Stop()
@@ -87,9 +92,9 @@ func runTestRestart(t *testing.T) {
8792
assert.Equal(t, restart.Normal, restart.GetStartType(), "set kmesh start status failed")
8893
restart.SetExitType(restart.Restart)
8994
if config.AdsEnabled() {
90-
versionPath = filepath.Join(config.BpfFsPath + "/bpf_kmesh/map/")
95+
versionPath = filepath.Join(config.BpfFsPath, constants.VersionPath)
9196
} else if config.WdsEnabled() {
92-
versionPath = filepath.Join(config.BpfFsPath + "/bpf_kmesh_workload/map/")
97+
versionPath = filepath.Join(config.BpfFsPath, constants.WorkloadVersionPath)
9398
}
9499
_, err := os.Stat(versionPath)
95100
assert.NoError(t, err)

0 commit comments

Comments
 (0)