Skip to content

Refactor and add tests coverage on package runconfig#14134

Merged
LK4D4 merged 1 commit intomoby:masterfrom
vdemeester:runconfig-test-coverage
Jul 1, 2015
Merged

Refactor and add tests coverage on package runconfig#14134
LK4D4 merged 1 commit intomoby:masterfrom
vdemeester:runconfig-test-coverage

Conversation

@vdemeester
Copy link
Copy Markdown
Member

After opts, this is another big one — probably a little too big.. It's the time for runconfig to get covered 🐸.

What this PR does is :

  • A small re-organization of existing tests (putting the parsing one into parse_test.go, the merging one into merge_test.go, and so on).
  • Add compare_test.go for more extensive testing of the Compare config method.
  • Update config_test.go to test Entrypoint and Command structs (that might be overkill but… oh well 😺).
  • Add exec_test.go to test ParseExec (which is in exec.go).
  • Add hostconfig_test.go for hostconfig.go tests, with fixtures (similar to what was done with config_test.go).
  • Update parse_test.go to cover more cases. As some of some parse thingy are calling the opts package and some aren't I tried to limit test case for those shared validation cases. I'll use the data gathered by those PR to update the issue I created about the need to centralize some of the checks (Proposal : centralize validations / checks between cli, api & builder #13824).

There is a few FIXME in there, question I was asking myself and not really able to answer. I'll comment on them directly in this PR.

# Before
+ go test -test.timeout=30m github.com/docker/docker/runconfig
PASS
coverage: 54.6% of statements
# After
+ go test -test.timeout=30m github.com/docker/docker/runconfig
PASS
coverage: 94.8% of statements

It's probably gonna be a little tricky to merge, because some PRs might changes these files a bit (like #14133) — but I'll rebase, fix or remove tests if needed (or even split this PR into severals).

Thanks for the reviews :)

Signed-off-by: Vincent Demeester vincent@sbr.pm

@vdemeester vdemeester force-pushed the runconfig-test-coverage branch 2 times, most recently from d3b690f to c85927d Compare June 23, 2015 18:43
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It felt weird that always:2 was failing (expected) but not always:2:1.

@calavera
Copy link
Copy Markdown
Contributor

LGTM

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@vdemeester vdemeester force-pushed the runconfig-test-coverage branch from c85927d to d4aec5f Compare July 1, 2015 08:17
@vdemeester
Copy link
Copy Markdown
Member Author

Just rebased it to fix conflicts with the move of package nat to pkg/nat.

/ping @duglin @runcom @LK4D4 @cpuguy83 for reviews 😊

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jul 1, 2015

@vdemeester Pls create issues about weird things that you've found.
LGTM

LK4D4 added a commit that referenced this pull request Jul 1, 2015
Refactor and add tests coverage on package runconfig
@LK4D4 LK4D4 merged commit be5e149 into moby:master Jul 1, 2015
@vdemeester
Copy link
Copy Markdown
Member Author

Will do 😉

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.

5 participants