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

Add unit testing #14

Merged
merged 4 commits into from
Jan 12, 2016
Merged

Add unit testing #14

merged 4 commits into from
Jan 12, 2016

Conversation

dmcgowan
Copy link
Member

Update the unit testing to check the resources from the manifest.
Add support for Linux device info (needed for testing but support for device numbers may be dropped altogether in the future).
Fix bug with absolute symlinks getting wrong target in created Resource.

Creating digest from bytes can no longer throw an error in the latest digest package version.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Absolute symlinks were using the original path instead of the target path.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
uidStr := strconv.Itoa(r.uid)
gidStr := strconv.Itoa(r.uid)
switch r.kind {
case rfile:
Copy link
Member

Choose a reason for hiding this comment

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

So, it would be nice to get rid of these test types. I actually made them before the advent of the default package schema. I think this use case could be filled in with a declarative resource struct, coupled with a method that will select the correct wrapping type:

r, err := Declare(Resource{
    Kind: RegularFile,
    Path: "/foo",
})

And for inline declarations for making tests:

[]Resource{
    MustDeclare(Resource{
        Kind: RegularFile,
        Path: "/foo",
    }),
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Created issue #15 to track this

@stevvooe
Copy link
Member

LGTM

My comment is really to inform refactoring of test code. Accepting this as is.

@stevvooe stevvooe closed this Jan 12, 2016
@stevvooe stevvooe reopened this Jan 12, 2016
stevvooe added a commit that referenced this pull request Jan 12, 2016
@stevvooe stevvooe merged commit b1806fd into containerd:master Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants