Merge lp://staging/~thumper/golxc/mockable into lp://staging/golxc

Proposed by Tim Penhey
Status: Merged
Merged at revision: 5
Proposed branch: lp://staging/~thumper/golxc/mockable
Merge into: lp://staging/golxc
Diff against target: 1504 lines (+1044/-91)
8 files modified
COPYING (+674/-0)
COPYING.LESSER (+165/-0)
LICENSE (+15/-0)
config.go (+3/-0)
export_test.go (+5/-2)
golxc.go (+133/-45)
golxc_test.go (+46/-44)
network.go (+3/-0)
To merge this branch: bzr merge lp://staging/~thumper/golxc/mockable
Reviewer Review Type Date Requested Status
Frank Mueller (community) Approve
Ian Booth Approve
Review via email: mp+169317@code.staging.launchpad.net

Description of the change

Provide interfaces around the core parts.

In order to provide meaningful tests around code that is using golxc
without shelling out to real lxc commands, we need to depend only on
interfaces. The two main package level functions, New and List are
now methods on a ContainerFactory. The instances themselves implement
Container. Since this is now an interface, added methods for getting
and setting the log file and level.

Also, Create now takes a config file option. I found through trial
and error that if you specify a mount point in the config file, and
only pass that config file through at Start time, the mount
fails. However passing exactly the same config file through at Create
time, and not at Start time has it succeed.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Please take a look.

lp://staging/~thumper/golxc/mockable updated
7. By Tim Penhey

Add license files and headers.

Revision history for this message
Tim Penhey (thumper) wrote :

Also added license files and headers.

Revision history for this message
Tim Penhey (thumper) wrote :

Also, perhaps we could change ownership of trunk to ~juju-core?

Revision history for this message
Ian Booth (wallyworld) wrote :

Trivials:

English:
931 + // Clone creates a copy of the container, it gets the given name.
932 + Clone(name string) (Container, error)

Perhaps: // Clone creates a copy of the container, giving the copy the specified name.

962 + // LogLevel returns the current logging level, this is only used if the
963 + // LogFile is not "".
964 + LogLevel() LogLevel

Perhaps: // LogLevel returns the current logging level (only used if the LogFile is not "").

Also, some comments have "." at the end, others don't.

 +// ContainerFactory represents the methods used to create Containers.
971 +type ContainerFactory interface {
972 + // New returns a container instance which can then be used for operations
973 + // like Create(), Start(), Stop() or Destroy().
974 + New(string) Container
975 + List() ([]Container, error)
976 +}

Please add a comment for List(). I know there's one on the method implementation, but the interface is where you really want to see the comment.

review: Approve
Revision history for this message
Tim Penhey (thumper) wrote :

On 14/06/13 12:51, Ian Booth wrote:
> Review: Approve
>
> Trivials:
>
> English:
> 931 + // Clone creates a copy of the container, it gets the given name.
> 932 + Clone(name string) (Container, error)
>
> Perhaps: // Clone creates a copy of the container, giving the copy the specified name.

Done.

> 962 + // LogLevel returns the current logging level, this is only used if the
> 963 + // LogFile is not "".
> 964 + LogLevel() LogLevel
>
> Perhaps: // LogLevel returns the current logging level (only used if the LogFile is not "").
>
> Also, some comments have "." at the end, others don't.

I think they should be valid sentences.

> +// ContainerFactory represents the methods used to create Containers.
> 971 +type ContainerFactory interface {
> 972 + // New returns a container instance which can then be used for operations
> 973 + // like Create(), Start(), Stop() or Destroy().
> 974 + New(string) Container
> 975 + List() ([]Container, error)
> 976 +}
>
> Please add a comment for List(). I know there's one on the method implementation, but the interface is where you really want to see the comment.

Done.

lp://staging/~thumper/golxc/mockable updated
8. By Tim Penhey

Comment fixes.

9. By Tim Penhey

Fix the tests.

Revision history for this message
Frank Mueller (themue) wrote :

In a discussion we decided to just wrap the needed LXC commands inside juju-core, but it's nice to see this package alive and with these good changes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: