Merge lp://staging/~themue/golxc/001-added-sudo-and-first-test into lp://staging/golxc
Proposed by
Frank Mueller
Status: | Merged |
---|---|
Merged at revision: | 2 |
Proposed branch: | lp://staging/~themue/golxc/001-added-sudo-and-first-test |
Merge into: | lp://staging/golxc |
Diff against target: |
797 lines (+417/-191) 4 files modified
export_test.go (+6/-0) golxc.go (+156/-191) golxc_test.go (+247/-0) golxc_test.sh (+8/-0) |
To merge this branch: | bzr merge lp://staging/~themue/golxc/001-added-sudo-and-first-test |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Frank Mueller | Pending | ||
Review via email: mp+134956@code.staging.launchpad.net |
Description of the change
golxc: add first container tests
The package now has the first functions for the
testing of the container. Two external scripts
help to perform the tests as a root.
To post a comment you must log in.
lots of comments but nothing major.
i'm not familiar with lxc, so all superficial, i'm afraid.
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go
File golxc.go (right):
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode9
golxc.go:9: // Frank Mueller <email address hidden>
do we need individual attributions?
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode29
golxc.go:29: ContainerStarting = 1 << iota
you can omit the "1 << iota" from here and the following constants.
however, ISTM that there's no particular reason for these to be bit
masks. the only place that we make use of their bitmask nature is in the
unexported Container.wait, and it would be just as easy (actually
easier, i think) to create a bitmask explicitly there.
also, how about:
type State uint
and using that as the state type, perhaps renaming the constants to
StateRunning, etc.
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode52
golxc.go:52: var go2state = map[int]string{
if the states weren't bitmasks, this could just be []string and you'd
get the same result.
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode82
golxc.go:82: var go2log = map[int]string{
[]string
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode111
golxc.go:111: outbuf, _, err := run("lxc-ls", args...)
run("lxc-ls", "-1")
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode113
golxc.go:113: log.Fatalf("cannot list containers: %v", err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode117
golxc.go:117: containers := []*Container{}
containers := make([]*Container, len(names)) ?
and then containers[i] = New(name) below.
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode142
golxc.go:142: "-t", template,
you could add "--" here unconditionally.
then the below lines could be simply:
args = append(args, tmplArgs)
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode150
golxc.go:150: log.Fatalf("cannot create container %q: %v", c.name, err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode173
golxc.go:173: log.Fatalf("cannot start container %q: %v", c.name, err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode189
golxc.go:189: log.Fatalf("cannot stop container %q: %v", c.name, err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode212
golxc.go:212: log.Fatalf("cannot clone container %q: %v", c.name, err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode231
golxc.go:231: log.Fatalf("cannot freeze container %q: %v", c.name, err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode250
golxc.go:250: log.Fatalf("cannot unfreeze container %q: %v", c.name,
err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode269
golxc.go:269: log.Fatalf("cannot destroy container %q: %v", c.name, err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode282
golxc.go:282: log.Fatalf("cannot retrieve container info for %q: %v",
c.name, err)
d
https:/ /codereview. appspot. com/6852065/ diff/6001/ golxc.go# newcode289
golxc.go:289: return -1, -1, err
a m...