Skip to content
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

bugfix: can't copy data with dr mode #2554

Merged
merged 1 commit into from
Dec 12, 2018

Conversation

rudyfly
Copy link
Collaborator

@rudyfly rudyfly commented Dec 12, 2018

Ⅰ. Describe what this PR did

use volume with dr mode, can't copy image's data to parent directory
when sub-directory has copied. It causes the volume directory is not
empty, so before copy image data, it need to sort mountpoint by the
string length of destination directory.

Ⅱ. Does this pull request fix one issue?

NONE

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

add ut: TestSortMountPoint
add integration test: TestRunCopyDataWithDR

Ⅳ. Describe how to verify it

run test TestRunCopyDataWithDR pass

Ⅴ. Special notes for reviews

Signed-off-by: Rudy Zhang rudyflyzhang@gmail.com

@rudyfly rudyfly requested review from HusterWan and fuweid December 12, 2018 06:12
@codecov
Copy link

codecov bot commented Dec 12, 2018

Codecov Report

Merging #2554 into master will decrease coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2554      +/-   ##
==========================================
- Coverage   69.15%   69.01%   -0.14%     
==========================================
  Files         278      278              
  Lines       18574    18581       +7     
==========================================
- Hits        12845    12824      -21     
- Misses       4260     4279      +19     
- Partials     1469     1478       +9
Flag Coverage Δ
#criv1alpha1test 31.09% <85.71%> (-0.14%) ⬇️
#criv1alpha2test 35.43% <85.71%> (-0.03%) ⬇️
#integrationtest 40.59% <100%> (+0.03%) ⬆️
#nodee2etest 32.53% <100%> (-0.05%) ⬇️
#unittest 26.79% <85.71%> (+0.02%) ⬆️
Impacted Files Coverage Δ
daemon/mgr/container_storage.go 60.94% <100%> (+0.62%) ⬆️
pkg/streams/utils.go 82.14% <0%> (-9.53%) ⬇️
daemon/mgr/snapshot.go 89.85% <0%> (-4.35%) ⬇️
ctrd/watch.go 81.69% <0%> (-2.82%) ⬇️
cri/v1alpha2/cri_wrapper.go 64.4% <0%> (-1.2%) ⬇️
ctrd/container.go 58.01% <0%> (-0.8%) ⬇️
cri/v1alpha1/cri.go 60.26% <0%> (-0.67%) ⬇️
cri/v1alpha2/cri.go 68.58% <0%> (-0.25%) ⬇️
daemon/mgr/container.go 58.44% <0%> (-0.22%) ⬇️

@pouchrobot pouchrobot added kind/bug This is bug report for project size/L labels Dec 12, 2018
@rudyfly rudyfly requested a review from yyb196 December 12, 2018 07:16
@fuweid
Copy link
Contributor

fuweid commented Dec 12, 2018

link to #2200

}

mounts = sortMountPoint(mounts)
if mounts[0].Destination != "/opt" || mounts[0].Source != "/pouch/volume5" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can prepare two arrays here. one is out of order, other one is in order. After sortMountPoint, use loop to check each item. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

res = command.PouchRun("exec", cname, "ls", "/var/spool")
res.Assert(c, icmd.Success)
if !strings.Contains(res.Stdout(), "mail") {
c.Fatal()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fatal for what?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 I forgot.

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to update test case.

@rudyfly
Copy link
Collaborator Author

rudyfly commented Dec 12, 2018

@fuweid I have modified test case, PTAL again. 🍵 ☕️

use volume with dr mode, can't copy image's data to parent directory
when sub-directory has copied. It causes the volume directory is not
empty, so before copy image data, it need to sort mountpoint by the
string length of destination directory.

Signed-off-by: Rudy Zhang <rudyflyzhang@gmail.com>
Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

wait for green CI

@fuweid fuweid merged commit 8d4eb1e into AliyunContainerService:master Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants