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

test: aggregate update test cases to reduce CI time #2607

Merged
merged 1 commit into from
Dec 26, 2018

Conversation

allencloud
Copy link
Collaborator

Signed-off-by: Allen Sun allensun.shl@alibaba-inc.com

Ⅰ. Describe what this PR did

aggregate update test cases to reduce CI time.

Since several test cases in PouchUpdateSuite is quite similar, we could aggregate all of them to be just one test case TestUpdateContainerNormalOption. In this test case, we only create and run one container which will definitely save lots of travis CI integration test time.

see:

	command.PouchRun("update",
		// cpu related update
		"--cpu-shares", "2000",
		"--cpu-period", "1500",
		"--cpu-quota", "1100",
		"--cpuset-cpus", "1",
		"--cpuset-mems", "1",
		// memory related update
		"-m", "500M",
		// env related update
		// adding a new env
		"--env", "foo=bar",
		// label related update
		"--label", "foo=bar",
		name,
	).Assert(c, icmd.Success)

Ⅱ. Does this pull request fix one issue?

this is related to #1184.

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

no need

Ⅳ. Describe how to verify it

none

Ⅴ. Special notes for reviews

none

@codecov
Copy link

codecov bot commented Dec 24, 2018

Codecov Report

Merging #2607 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2607      +/-   ##
==========================================
- Coverage   69.46%   69.43%   -0.04%     
==========================================
  Files         279      279              
  Lines       18833    18833              
==========================================
- Hits        13083    13076       -7     
- Misses       4281     4290       +9     
+ Partials     1469     1467       -2
Flag Coverage Δ
#criv1alpha1test 31.89% <ø> (+0.19%) ⬆️
#criv1alpha2test 36.27% <ø> (+0.1%) ⬆️
#integrationtest 41.11% <ø> (-0.11%) ⬇️
#nodee2etest 33.19% <ø> (-0.04%) ⬇️
#unittest 26.76% <ø> (ø) ⬆️
Impacted Files Coverage Δ
daemon/mgr/system.go 67.93% <0%> (-5.35%) ⬇️
daemon/mgr/snapshot.go 89.85% <0%> (-4.35%) ⬇️
daemon/mgr/events.go 96.29% <0%> (-3.71%) ⬇️
ctrd/image.go 76.95% <0%> (-2.18%) ⬇️
ctrd/client.go 68.45% <0%> (-2.02%) ⬇️
ctrd/watch.go 83.09% <0%> (-1.41%) ⬇️
cri/v1alpha2/cri_wrapper.go 65.59% <0%> (-1.21%) ⬇️
daemon/mgr/container_utils.go 83.33% <0%> (-0.6%) ⬇️
cri/v1alpha2/cri.go 69.3% <0%> (ø) ⬆️
daemon/mgr/container.go 59.21% <0%> (+0.21%) ⬆️
... and 4 more

@chuanchang
Copy link
Contributor

@allencloud I gave a testing in ubuntu 16.04, I go different error as follows:

My failure:

#go test -v -check.f PouchUpdateSuite.TestUpdateContainerNormalOption
=== RUN   Test

----------------------------------------------------------------------
FAIL: cli_update_test.go:40: PouchUpdateSuite.TestUpdateContainerNormalOption

cli_update_test.go:77:
    command.PouchRun("update",
        // cpu related update
        "--cpu-shares", "2000",
        "--cpu-period", "1500",
        "--cpu-quota", "1100",
        "--cpuset-cpus", "1",
        "--cpuset-mems", "1",
        // memory related update
        "-m", "500M",
        // env related update
        // adding a new env
        "--env", "foo=bar",
        // label related update
        "--label", "foo=bar",
        name,
    ).Assert(c, icmd.Success)
/root/Workspace/go/src/github.com/alibaba/pouch/vendor/github.com/gotestyourself/gotestyourself/icmd/command.go:61:
    t.Fatalf("at %s:%d - %s\n", filepath.Base(file), line, err.Error())
... Error: at cli_update_test.go:77 - 
Command:  /usr/local/bin/pouch update --cpu-shares 2000 --cpu-period 1500 --cpu-quota 1100 --cpuset-cpus 1 --cpuset-mems 1 -m 500M --env foo=bar --label foo=bar TestUpdateContainerNormalOption
ExitCode: 1
Error:    exit status 1
Stdout:   
Stderr:   Error: {"message":"failed to update resource: runc did not terminate sucessfully: failed to write 1 to cpuset.cpus: write /sys/fs/cgroup/cpuset,cpu,cpuacct/default/ec01b5649c8ea26bee4eecc34b9a37e8acb58f54621b77c9fe08dd96835d922d/cpuset.cpus: invalid argument\n: unknown"}



Failures:
ExitCode was 1 expected 0
Expected no error


OOPS: 0 passed, 1 FAILED
--- FAIL: Test (2.21s)
FAIL
exit status 1
FAIL    github.com/alibaba/pouch/test   17.334s

Travis CI failure:

FAIL: /home/travis/gopath/src/github.com/alibaba/pouch/test/cli_update_test.go:40: PouchUpdateSuite.TestUpdateContainerNormalOption
/home/travis/gopath/src/github.com/alibaba/pouch/test/cli_update_test.go:77:
    command.PouchRun("update",
        // cpu related update
        "--cpu-shares", "2000",
        "--cpu-period", "1500",
        "--cpu-quota", "1100",
        "--cpuset-cpus", "1",
        "--cpuset-mems", "1",
        // memory related update
        "-m", "500M",
        // env related update
        // adding a new env
        "--env", "foo=bar",
        // label related update
        "--label", "foo=bar",
        name,
    ).Assert(c, icmd.Success)
/home/travis/gopath/src/github.com/alibaba/pouch/vendor/github.com/gotestyourself/gotestyourself/icmd/command.go:61:
    t.Fatalf("at %s:%d - %s\n", filepath.Base(file), line, err.Error())
... Error: at cli_update_test.go:77 - 
Command:  /usr/local/bin/pouch update --cpu-shares 2000 --cpu-period 1500 --cpu-quota 1100 --cpuset-cpus 1 --cpuset-mems 1 -m 500M --env foo=bar --label foo=bar TestUpdateContainerNormalOption
ExitCode: 1
Error:    exit status 1
Stdout:   
Stderr:   Error: {"message":"failed to update resource: runc did not terminate sucessfully: failed to write 1 to cpuset.mems: write /sys/fs/cgroup/cpuset/default/04a280b593f6ee33e515d458f956539c059a49e6d83efbdae5ed5eb00e7738d1/cpuset.mems: invalid argument\n: unknown"}

@allencloud
Copy link
Collaborator Author

I will come to take a look at this. Thanks a lot for your feedback. @chuanchang

Signed-off-by: Allen Sun <allensun.shl@alibaba-inc.com>
@chuanchang
Copy link
Contributor

LGTM

@allencloud allencloud merged commit 7e4c899 into AliyunContainerService:master Dec 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants