vendor: remove dep and use vndr
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
16f44674a4
commit
148e72d81e
16131 changed files with 73815 additions and 4235138 deletions
1
vendor/github.com/mistifyio/go-zfs/.gitignore
generated
vendored
1
vendor/github.com/mistifyio/go-zfs/.gitignore
generated
vendored
|
@ -1 +0,0 @@
|
|||
.vagrant
|
60
vendor/github.com/mistifyio/go-zfs/CONTRIBUTING.md
generated
vendored
60
vendor/github.com/mistifyio/go-zfs/CONTRIBUTING.md
generated
vendored
|
@ -1,60 +0,0 @@
|
|||
## How to Contribute ##
|
||||
|
||||
We always welcome contributions to help make `go-zfs` better. Please take a moment to read this document if you would like to contribute.
|
||||
|
||||
### Reporting issues ###
|
||||
|
||||
We use [Github issues](https://github.com/mistifyio/go-zfs/issues) to track bug reports, feature requests, and submitting pull requests.
|
||||
|
||||
If you find a bug:
|
||||
|
||||
* Use the GitHub issue search to check whether the bug has already been reported.
|
||||
* If the issue has been fixed, try to reproduce the issue using the latest `master` branch of the repository.
|
||||
* If the issue still reproduces or has not yet been reported, try to isolate the problem before opening an issue, if possible. Also provide the steps taken to reproduce the bug.
|
||||
|
||||
### Pull requests ###
|
||||
|
||||
We welcome bug fixes, improvements, and new features. Before embarking on making significant changes, please open an issue and ask first so that you do not risk duplicating efforts or spending time working on something that may be out of scope. For minor items, just open a pull request.
|
||||
|
||||
[Fork the project](https://help.github.com/articles/fork-a-repo), clone your fork, and add the upstream to your remote:
|
||||
|
||||
$ git clone git@github.com:<your-username>/go-zfs.git
|
||||
$ cd go-zfs
|
||||
$ git remote add upstream https://github.com/mistifyio/go-zfs.git
|
||||
|
||||
If you need to pull new changes committed upstream:
|
||||
|
||||
$ git checkout master
|
||||
$ git fetch upstream
|
||||
$ git merge upstream/master
|
||||
|
||||
Don' work directly on master as this makes it harder to merge later. Create a feature branch for your fix or new feature:
|
||||
|
||||
$ git checkout -b <feature-branch-name>
|
||||
|
||||
Please try to commit your changes in logical chunks. Ideally, you should include the issue number in the commit message.
|
||||
|
||||
$ git commit -m "Issue #<issue-number> - <commit-message>"
|
||||
|
||||
Push your feature branch to your fork.
|
||||
|
||||
$ git push origin <feature-branch-name>
|
||||
|
||||
[Open a Pull Request](https://help.github.com/articles/using-pull-requests) against the upstream master branch. Please give your pull request a clear title and description and note which issue(s) your pull request fixes.
|
||||
|
||||
* All Go code should be formatted using [gofmt](http://golang.org/cmd/gofmt/).
|
||||
* Every exported function should have [documentation](http://blog.golang.org/godoc-documenting-go-code) and corresponding [tests](http://golang.org/doc/code.html#Testing).
|
||||
|
||||
**Important:** By submitting a patch, you agree to allow the project owners to license your work under the [Apache 2.0 License](./LICENSE).
|
||||
|
||||
### Go Tools ###
|
||||
For consistency and to catch minor issues for all of go code, please run the following:
|
||||
* goimports
|
||||
* go vet
|
||||
* golint
|
||||
* errcheck
|
||||
|
||||
Many editors can execute the above on save.
|
||||
|
||||
----
|
||||
Guidelines based on http://azkaban.github.io/contributing.html
|
34
vendor/github.com/mistifyio/go-zfs/Vagrantfile
generated
vendored
34
vendor/github.com/mistifyio/go-zfs/Vagrantfile
generated
vendored
|
@ -1,34 +0,0 @@
|
|||
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
config.vm.synced_folder ".", "/home/vagrant/go/src/github.com/mistifyio/go-zfs", create: true
|
||||
|
||||
config.vm.provision "shell", inline: <<EOF
|
||||
cat << END > /etc/profile.d/go.sh
|
||||
export GOPATH=\\$HOME/go
|
||||
export PATH=\\$GOPATH/bin:/usr/local/go/bin:\\$PATH
|
||||
END
|
||||
|
||||
chown -R vagrant /home/vagrant/go
|
||||
|
||||
apt-get update
|
||||
apt-get install -y software-properties-common curl
|
||||
apt-add-repository --yes ppa:zfs-native/stable
|
||||
apt-get update
|
||||
apt-get install -y ubuntu-zfs
|
||||
|
||||
cd /home/vagrant
|
||||
curl -z go1.3.3.linux-amd64.tar.gz -L -O https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
|
||||
tar -C /usr/local -zxf /home/vagrant/go1.3.3.linux-amd64.tar.gz
|
||||
|
||||
cat << END > /etc/sudoers.d/go
|
||||
Defaults env_keep += "GOPATH"
|
||||
END
|
||||
|
||||
EOF
|
||||
|
||||
end
|
37
vendor/github.com/mistifyio/go-zfs/error_test.go
generated
vendored
37
vendor/github.com/mistifyio/go-zfs/error_test.go
generated
vendored
|
@ -1,37 +0,0 @@
|
|||
package zfs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestError(t *testing.T) {
|
||||
var tests = []struct {
|
||||
err error
|
||||
debug string
|
||||
stderr string
|
||||
}{
|
||||
// Empty error
|
||||
{nil, "", ""},
|
||||
// Typical error
|
||||
{errors.New("exit status foo"), "/sbin/foo bar qux", "command not found"},
|
||||
// Quoted error
|
||||
{errors.New("exit status quoted"), "\"/sbin/foo\" bar qux", "\"some\" 'random' `quotes`"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
// Generate error from tests
|
||||
zErr := Error{
|
||||
Err: test.err,
|
||||
Debug: test.debug,
|
||||
Stderr: test.stderr,
|
||||
}
|
||||
|
||||
// Verify output format is consistent, so that any changes to the
|
||||
// Error method must be reflected by the test
|
||||
if str := zErr.Error(); str != fmt.Sprintf("%s: %q => %s", test.err, test.debug, test.stderr) {
|
||||
t.Fatalf("unexpected Error string: %v", str)
|
||||
}
|
||||
}
|
||||
}
|
359
vendor/github.com/mistifyio/go-zfs/zfs_test.go
generated
vendored
359
vendor/github.com/mistifyio/go-zfs/zfs_test.go
generated
vendored
|
@ -1,359 +0,0 @@
|
|||
package zfs_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mistifyio/go-zfs"
|
||||
)
|
||||
|
||||
func sleep(delay int) {
|
||||
time.Sleep(time.Duration(delay) * time.Second)
|
||||
}
|
||||
|
||||
func pow2(x int) int64 {
|
||||
return int64(math.Pow(2, float64(x)))
|
||||
}
|
||||
|
||||
//https://github.com/benbjohnson/testing
|
||||
// assert fails the test if the condition is false.
|
||||
func assert(tb testing.TB, condition bool, msg string, v ...interface{}) {
|
||||
if !condition {
|
||||
_, file, line, _ := runtime.Caller(1)
|
||||
fmt.Printf("\033[31m%s:%d: "+msg+"\033[39m\n\n", append([]interface{}{filepath.Base(file), line}, v...)...)
|
||||
tb.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
// ok fails the test if an err is not nil.
|
||||
func ok(tb testing.TB, err error) {
|
||||
if err != nil {
|
||||
_, file, line, _ := runtime.Caller(1)
|
||||
fmt.Printf("\033[31m%s:%d: unexpected error: %s\033[39m\n\n", filepath.Base(file), line, err.Error())
|
||||
tb.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
// equals fails the test if exp is not equal to act.
|
||||
func equals(tb testing.TB, exp, act interface{}) {
|
||||
if !reflect.DeepEqual(exp, act) {
|
||||
_, file, line, _ := runtime.Caller(1)
|
||||
fmt.Printf("\033[31m%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\033[39m\n\n", filepath.Base(file), line, exp, act)
|
||||
tb.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func zpoolTest(t *testing.T, fn func()) {
|
||||
tempfiles := make([]string, 3)
|
||||
for i := range tempfiles {
|
||||
f, _ := ioutil.TempFile("/tmp/", "zfs-")
|
||||
defer f.Close()
|
||||
err := f.Truncate(pow2(30))
|
||||
ok(t, err)
|
||||
tempfiles[i] = f.Name()
|
||||
defer os.Remove(f.Name())
|
||||
}
|
||||
|
||||
pool, err := zfs.CreateZpool("test", nil, tempfiles...)
|
||||
ok(t, err)
|
||||
defer pool.Destroy()
|
||||
ok(t, err)
|
||||
fn()
|
||||
|
||||
}
|
||||
|
||||
func TestDatasets(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
_, err := zfs.Datasets("")
|
||||
ok(t, err)
|
||||
|
||||
ds, err := zfs.GetDataset("test")
|
||||
ok(t, err)
|
||||
equals(t, zfs.DatasetFilesystem, ds.Type)
|
||||
equals(t, "", ds.Origin)
|
||||
assert(t, ds.Logicalused > 0, "Logicalused is not greater than 0")
|
||||
})
|
||||
}
|
||||
|
||||
func TestSnapshots(t *testing.T) {
|
||||
|
||||
zpoolTest(t, func() {
|
||||
snapshots, err := zfs.Snapshots("")
|
||||
ok(t, err)
|
||||
|
||||
for _, snapshot := range snapshots {
|
||||
equals(t, zfs.DatasetSnapshot, snapshot.Type)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestFilesystems(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
f, err := zfs.CreateFilesystem("test/filesystem-test", nil)
|
||||
ok(t, err)
|
||||
|
||||
filesystems, err := zfs.Filesystems("")
|
||||
ok(t, err)
|
||||
|
||||
for _, filesystem := range filesystems {
|
||||
equals(t, zfs.DatasetFilesystem, filesystem.Type)
|
||||
}
|
||||
|
||||
ok(t, f.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateFilesystemWithProperties(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
props := map[string]string{
|
||||
"compression": "lz4",
|
||||
}
|
||||
|
||||
f, err := zfs.CreateFilesystem("test/filesystem-test", props)
|
||||
ok(t, err)
|
||||
|
||||
equals(t, "lz4", f.Compression)
|
||||
|
||||
filesystems, err := zfs.Filesystems("")
|
||||
ok(t, err)
|
||||
|
||||
for _, filesystem := range filesystems {
|
||||
equals(t, zfs.DatasetFilesystem, filesystem.Type)
|
||||
}
|
||||
|
||||
ok(t, f.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestVolumes(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
v, err := zfs.CreateVolume("test/volume-test", uint64(pow2(23)), nil)
|
||||
ok(t, err)
|
||||
|
||||
// volumes are sometimes "busy" if you try to manipulate them right away
|
||||
sleep(1)
|
||||
|
||||
equals(t, zfs.DatasetVolume, v.Type)
|
||||
volumes, err := zfs.Volumes("")
|
||||
ok(t, err)
|
||||
|
||||
for _, volume := range volumes {
|
||||
equals(t, zfs.DatasetVolume, volume.Type)
|
||||
}
|
||||
|
||||
ok(t, v.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestSnapshot(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
f, err := zfs.CreateFilesystem("test/snapshot-test", nil)
|
||||
ok(t, err)
|
||||
|
||||
filesystems, err := zfs.Filesystems("")
|
||||
ok(t, err)
|
||||
|
||||
for _, filesystem := range filesystems {
|
||||
equals(t, zfs.DatasetFilesystem, filesystem.Type)
|
||||
}
|
||||
|
||||
s, err := f.Snapshot("test", false)
|
||||
ok(t, err)
|
||||
|
||||
equals(t, zfs.DatasetSnapshot, s.Type)
|
||||
|
||||
equals(t, "test/snapshot-test@test", s.Name)
|
||||
|
||||
ok(t, s.Destroy(zfs.DestroyDefault))
|
||||
|
||||
ok(t, f.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestClone(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
f, err := zfs.CreateFilesystem("test/snapshot-test", nil)
|
||||
ok(t, err)
|
||||
|
||||
filesystems, err := zfs.Filesystems("")
|
||||
ok(t, err)
|
||||
|
||||
for _, filesystem := range filesystems {
|
||||
equals(t, zfs.DatasetFilesystem, filesystem.Type)
|
||||
}
|
||||
|
||||
s, err := f.Snapshot("test", false)
|
||||
ok(t, err)
|
||||
|
||||
equals(t, zfs.DatasetSnapshot, s.Type)
|
||||
equals(t, "test/snapshot-test@test", s.Name)
|
||||
|
||||
c, err := s.Clone("test/clone-test", nil)
|
||||
ok(t, err)
|
||||
|
||||
equals(t, zfs.DatasetFilesystem, c.Type)
|
||||
|
||||
ok(t, c.Destroy(zfs.DestroyDefault))
|
||||
|
||||
ok(t, s.Destroy(zfs.DestroyDefault))
|
||||
|
||||
ok(t, f.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestSendSnapshot(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
f, err := zfs.CreateFilesystem("test/snapshot-test", nil)
|
||||
ok(t, err)
|
||||
|
||||
filesystems, err := zfs.Filesystems("")
|
||||
ok(t, err)
|
||||
|
||||
for _, filesystem := range filesystems {
|
||||
equals(t, zfs.DatasetFilesystem, filesystem.Type)
|
||||
}
|
||||
|
||||
s, err := f.Snapshot("test", false)
|
||||
ok(t, err)
|
||||
|
||||
file, _ := ioutil.TempFile("/tmp/", "zfs-")
|
||||
defer file.Close()
|
||||
err = file.Truncate(pow2(30))
|
||||
ok(t, err)
|
||||
defer os.Remove(file.Name())
|
||||
|
||||
err = s.SendSnapshot(file)
|
||||
ok(t, err)
|
||||
|
||||
ok(t, s.Destroy(zfs.DestroyDefault))
|
||||
|
||||
ok(t, f.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestChildren(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
f, err := zfs.CreateFilesystem("test/snapshot-test", nil)
|
||||
ok(t, err)
|
||||
|
||||
s, err := f.Snapshot("test", false)
|
||||
ok(t, err)
|
||||
|
||||
equals(t, zfs.DatasetSnapshot, s.Type)
|
||||
equals(t, "test/snapshot-test@test", s.Name)
|
||||
|
||||
children, err := f.Children(0)
|
||||
ok(t, err)
|
||||
|
||||
equals(t, 1, len(children))
|
||||
equals(t, "test/snapshot-test@test", children[0].Name)
|
||||
|
||||
ok(t, s.Destroy(zfs.DestroyDefault))
|
||||
ok(t, f.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestListZpool(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
pools, err := zfs.ListZpools()
|
||||
ok(t, err)
|
||||
equals(t, "test", pools[0].Name)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
func TestRollback(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
f, err := zfs.CreateFilesystem("test/snapshot-test", nil)
|
||||
ok(t, err)
|
||||
|
||||
filesystems, err := zfs.Filesystems("")
|
||||
ok(t, err)
|
||||
|
||||
for _, filesystem := range filesystems {
|
||||
equals(t, zfs.DatasetFilesystem, filesystem.Type)
|
||||
}
|
||||
|
||||
s1, err := f.Snapshot("test", false)
|
||||
ok(t, err)
|
||||
|
||||
_, err = f.Snapshot("test2", false)
|
||||
ok(t, err)
|
||||
|
||||
s3, err := f.Snapshot("test3", false)
|
||||
ok(t, err)
|
||||
|
||||
err = s3.Rollback(false)
|
||||
ok(t, err)
|
||||
|
||||
err = s1.Rollback(false)
|
||||
assert(t, err != nil, "should error when rolling back beyond most recent without destroyMoreRecent = true")
|
||||
|
||||
err = s1.Rollback(true)
|
||||
ok(t, err)
|
||||
|
||||
ok(t, s1.Destroy(zfs.DestroyDefault))
|
||||
|
||||
ok(t, f.Destroy(zfs.DestroyDefault))
|
||||
})
|
||||
}
|
||||
|
||||
func TestDiff(t *testing.T) {
|
||||
zpoolTest(t, func() {
|
||||
fs, err := zfs.CreateFilesystem("test/origin", nil)
|
||||
ok(t, err)
|
||||
|
||||
linkedFile, err := os.Create(filepath.Join(fs.Mountpoint, "linked"))
|
||||
ok(t, err)
|
||||
|
||||
movedFile, err := os.Create(filepath.Join(fs.Mountpoint, "file"))
|
||||
ok(t, err)
|
||||
|
||||
snapshot, err := fs.Snapshot("snapshot", false)
|
||||
ok(t, err)
|
||||
|
||||
unicodeFile, err := os.Create(filepath.Join(fs.Mountpoint, "i ❤ unicode"))
|
||||
ok(t, err)
|
||||
|
||||
err = os.Rename(movedFile.Name(), movedFile.Name()+"-new")
|
||||
ok(t, err)
|
||||
|
||||
err = os.Link(linkedFile.Name(), linkedFile.Name()+"_hard")
|
||||
ok(t, err)
|
||||
|
||||
inodeChanges, err := fs.Diff(snapshot.Name)
|
||||
ok(t, err)
|
||||
equals(t, 4, len(inodeChanges))
|
||||
|
||||
equals(t, "/test/origin/", inodeChanges[0].Path)
|
||||
equals(t, zfs.Directory, inodeChanges[0].Type)
|
||||
equals(t, zfs.Modified, inodeChanges[0].Change)
|
||||
|
||||
equals(t, "/test/origin/linked", inodeChanges[1].Path)
|
||||
equals(t, zfs.File, inodeChanges[1].Type)
|
||||
equals(t, zfs.Modified, inodeChanges[1].Change)
|
||||
equals(t, 1, inodeChanges[1].ReferenceCountChange)
|
||||
|
||||
equals(t, "/test/origin/file", inodeChanges[2].Path)
|
||||
equals(t, "/test/origin/file-new", inodeChanges[2].NewPath)
|
||||
equals(t, zfs.File, inodeChanges[2].Type)
|
||||
equals(t, zfs.Renamed, inodeChanges[2].Change)
|
||||
|
||||
equals(t, "/test/origin/i ❤ unicode", inodeChanges[3].Path)
|
||||
equals(t, zfs.File, inodeChanges[3].Type)
|
||||
equals(t, zfs.Created, inodeChanges[3].Change)
|
||||
|
||||
ok(t, movedFile.Close())
|
||||
ok(t, unicodeFile.Close())
|
||||
ok(t, linkedFile.Close())
|
||||
ok(t, snapshot.Destroy(zfs.DestroyForceUmount))
|
||||
ok(t, fs.Destroy(zfs.DestroyForceUmount))
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue