-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat:Mount by API without makeConfig #1610
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1610 +/- ##
==========================================
- Coverage 61.44% 61.38% -0.06%
==========================================
Files 145 146 +1
Lines 48032 48040 +8
Branches 46007 46007
==========================================
- Hits 29512 29490 -22
- Misses 16963 16987 +24
- Partials 1557 1563 +6 |
Please add commit |
5984d8a
to
2b7539d
Compare
c27f8f6
to
b811523
Compare
smoke/Makefile
Outdated
test: build | ||
golangci-lint run | ||
sudo -E ./smoke.test -test.v -test.timeout 10m -test.parallel=16 -test.run=$(TESTS) | ||
sudo -E ./smoke.test -test.v -test.timeout 10m -test.parallel=16 -test.run=TestNativeLayer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why modify here.
smoke/tests/api_test.go
Outdated
ctx.PrepareWorkDir(t) | ||
defer ctx.Destroy(t) | ||
|
||
rootFs := texture.MakeLowerLayer(t, filepath.Join(ctx.Env.WorkDir, "root-fs")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"rootfs"
smoke/tests/tool/nydusd.go
Outdated
f, err := os.Open(config.ConfigPath) | ||
if err != nil { | ||
return err | ||
var tpl *template.Template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we modify this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to remove the makeConfig function so that the API can be used directly instead of first writing to a file and then using the API.
smoke/tests/tool/nydusd.go
Outdated
@@ -365,6 +371,23 @@ func (nydusd *Nydusd) Umount() error { | |||
return nil | |||
} | |||
|
|||
func (nydusd *Nydusd) UmountByAPI(point string) error { | |||
path := point | |||
// path: /mount1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove useless comments.
smoke/tests/tool/nydusd.go
Outdated
@@ -365,6 +371,23 @@ func (nydusd *Nydusd) Umount() error { | |||
return nil | |||
} | |||
|
|||
func (nydusd *Nydusd) UmountByAPI(point string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point -> subPath
smoke/tests/tool/nydusd.go
Outdated
@@ -365,6 +371,23 @@ func (nydusd *Nydusd) Umount() error { | |||
return nil | |||
} | |||
|
|||
func (nydusd *Nydusd) UmountByAPI(point string) error { | |||
path := point |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove useless assignment.
smoke/tests/tool/nydusd.go
Outdated
nydusd.VerifyByPath(t, expectedFileTree, nydusd.MountPath) | ||
} | ||
|
||
func (nydusd *Nydusd) VerifyByPath(t *testing.T, expectedFileTree map[string]*File, point string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point -> subPath
smoke/tests/tool/nydusd.go
Outdated
@@ -622,17 +645,20 @@ func (nydusd *Nydusd) GetInflightMetrics() (*InflightMetrics, error) { | |||
} | |||
|
|||
func (nydusd *Nydusd) Verify(t *testing.T, expectedFileTree map[string]*File) { | |||
nydusd.VerifyByPath(t, expectedFileTree, nydusd.MountPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the misunderstand, we should call nydusd.VerifyByPath(t, expectedFileTree, "")
here.
smoke/tests/tool/nydusd.go
Outdated
nydusd.VerifyByPath(t, expectedFileTree, nydusd.MountPath) | ||
} | ||
|
||
func (nydusd *Nydusd) VerifyByPath(t *testing.T, expectedFileTree map[string]*File, point string) { | ||
actualFiles := map[string]*File{} | ||
err := filepath.WalkDir(nydusd.MountPath, func(path string, _ fs.DirEntry, err error) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nydusd.MountPath
->
mountPath := filepath.Join(nydusd.MountPath, subPath)
ec35c6b
to
90feab4
Compare
smoke/tests/tool/nydusd.go
Outdated
if targetPath == "." || targetPath == ".." { | ||
pointMdr := strings.TrimPrefix(subPath, "/") | ||
targetPath = strings.TrimPrefix(targetPath, pointMdr+"/") | ||
if targetPath == "." || targetPath == ".." || targetPath == pointMdr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need to check targetPath == pointMdr
?
smoke/tests/tool/nydusd.go
Outdated
switch tplType { | ||
case NydusdConfigTpl: | ||
tpl = template.Must(template.New("").Parse(configTpl)) | ||
case NydusdOvlConfigTpl: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the case path is not used.
90feab4
to
eef495b
Compare
b043cfc
to
6135f08
Compare
Signed-off-by: fappy1234567 <[email protected]>
6135f08
to
6043273
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Details
Implement mounting through mountByAPI to evaluate its effectiveness
Omit the use of makeConfig