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
67
vendor/github.com/docker/go-units/CONTRIBUTING.md
generated
vendored
67
vendor/github.com/docker/go-units/CONTRIBUTING.md
generated
vendored
|
@ -1,67 +0,0 @@
|
|||
# Contributing to go-units
|
||||
|
||||
Want to hack on go-units? Awesome! Here are instructions to get you started.
|
||||
|
||||
go-units is a part of the [Docker](https://www.docker.com) project, and follows
|
||||
the same rules and principles. If you're already familiar with the way
|
||||
Docker does things, you'll feel right at home.
|
||||
|
||||
Otherwise, go read Docker's
|
||||
[contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md),
|
||||
[issue triaging](https://github.com/docker/docker/blob/master/project/ISSUE-TRIAGE.md),
|
||||
[review process](https://github.com/docker/docker/blob/master/project/REVIEWING.md) and
|
||||
[branches and tags](https://github.com/docker/docker/blob/master/project/BRANCHES-AND-TAGS.md).
|
||||
|
||||
### Sign your work
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the patch. Your
|
||||
signature certifies that you wrote the patch or otherwise have the right to pass
|
||||
it on as an open-source patch. The rules are pretty simple: if you can certify
|
||||
the below (from [developercertificate.org](http://developercertificate.org/)):
|
||||
|
||||
```
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
660 York Street, Suite 102,
|
||||
San Francisco, CA 94110 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
```
|
||||
|
||||
Then you just add a line to every git commit message:
|
||||
|
||||
Signed-off-by: Joe Smith <joe.smith@email.com>
|
||||
|
||||
Use your real name (sorry, no pseudonyms or anonymous contributions.)
|
||||
|
||||
If you set your `user.name` and `user.email` git configs, you can sign your
|
||||
commit automatically with `git commit -s`.
|
27
vendor/github.com/docker/go-units/MAINTAINERS
generated
vendored
27
vendor/github.com/docker/go-units/MAINTAINERS
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
# go-connections maintainers file
|
||||
#
|
||||
# This file describes who runs the docker/go-connections project and how.
|
||||
# This is a living document - if you see something out of date or missing, speak up!
|
||||
#
|
||||
# It is structured to be consumable by both humans and programs.
|
||||
# To extract its contents programmatically, use any TOML-compliant parser.
|
||||
#
|
||||
# This file is compiled into the MAINTAINERS file in docker/opensource.
|
||||
#
|
||||
[Org]
|
||||
[Org."Core maintainers"]
|
||||
people = [
|
||||
"calavera",
|
||||
]
|
||||
|
||||
[people]
|
||||
|
||||
# A reference list of all people associated with the project.
|
||||
# All other sections should refer to people by their canonical key
|
||||
# in the people section.
|
||||
|
||||
# ADD YOURSELF HERE IN ALPHABETICAL ORDER
|
||||
[people.calavera]
|
||||
Name = "David Calavera"
|
||||
Email = "david.calavera@gmail.com"
|
||||
GitHub = "calavera"
|
11
vendor/github.com/docker/go-units/circle.yml
generated
vendored
11
vendor/github.com/docker/go-units/circle.yml
generated
vendored
|
@ -1,11 +0,0 @@
|
|||
dependencies:
|
||||
post:
|
||||
# install golint
|
||||
- go get github.com/golang/lint/golint
|
||||
|
||||
test:
|
||||
pre:
|
||||
# run analysis before tests
|
||||
- go vet ./...
|
||||
- test -z "$(golint ./... | tee /dev/stderr)"
|
||||
- test -z "$(gofmt -s -l . | tee /dev/stderr)"
|
81
vendor/github.com/docker/go-units/duration_test.go
generated
vendored
81
vendor/github.com/docker/go-units/duration_test.go
generated
vendored
|
@ -1,81 +0,0 @@
|
|||
package units
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func ExampleHumanDuration() {
|
||||
fmt.Println(HumanDuration(450 * time.Millisecond))
|
||||
fmt.Println(HumanDuration(47 * time.Second))
|
||||
fmt.Println(HumanDuration(1 * time.Minute))
|
||||
fmt.Println(HumanDuration(3 * time.Minute))
|
||||
fmt.Println(HumanDuration(35 * time.Minute))
|
||||
fmt.Println(HumanDuration(35*time.Minute + 40*time.Second))
|
||||
fmt.Println(HumanDuration(1 * time.Hour))
|
||||
fmt.Println(HumanDuration(1*time.Hour + 45*time.Minute))
|
||||
fmt.Println(HumanDuration(3 * time.Hour))
|
||||
fmt.Println(HumanDuration(3*time.Hour + 59*time.Minute))
|
||||
fmt.Println(HumanDuration(3*time.Hour + 60*time.Minute))
|
||||
fmt.Println(HumanDuration(24 * time.Hour))
|
||||
fmt.Println(HumanDuration(24*time.Hour + 12*time.Hour))
|
||||
fmt.Println(HumanDuration(2 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(7 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(13*24*time.Hour + 5*time.Hour))
|
||||
fmt.Println(HumanDuration(2 * 7 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(2*7*24*time.Hour + 4*24*time.Hour))
|
||||
fmt.Println(HumanDuration(3 * 7 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(4 * 7 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(4*7*24*time.Hour + 3*24*time.Hour))
|
||||
fmt.Println(HumanDuration(1 * 30 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(1*30*24*time.Hour + 2*7*24*time.Hour))
|
||||
fmt.Println(HumanDuration(2 * 30 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(3*30*24*time.Hour + 1*7*24*time.Hour))
|
||||
fmt.Println(HumanDuration(5*30*24*time.Hour + 2*7*24*time.Hour))
|
||||
fmt.Println(HumanDuration(13 * 30 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(23 * 30 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(24 * 30 * 24 * time.Hour))
|
||||
fmt.Println(HumanDuration(24*30*24*time.Hour + 2*7*24*time.Hour))
|
||||
fmt.Println(HumanDuration(3*365*24*time.Hour + 2*30*24*time.Hour))
|
||||
}
|
||||
|
||||
func TestHumanDuration(t *testing.T) {
|
||||
// Useful duration abstractions
|
||||
day := 24 * time.Hour
|
||||
week := 7 * day
|
||||
month := 30 * day
|
||||
year := 365 * day
|
||||
|
||||
assertEquals(t, "Less than a second", HumanDuration(450*time.Millisecond))
|
||||
assertEquals(t, "47 seconds", HumanDuration(47*time.Second))
|
||||
assertEquals(t, "About a minute", HumanDuration(1*time.Minute))
|
||||
assertEquals(t, "3 minutes", HumanDuration(3*time.Minute))
|
||||
assertEquals(t, "35 minutes", HumanDuration(35*time.Minute))
|
||||
assertEquals(t, "35 minutes", HumanDuration(35*time.Minute+40*time.Second))
|
||||
assertEquals(t, "About an hour", HumanDuration(1*time.Hour))
|
||||
assertEquals(t, "About an hour", HumanDuration(1*time.Hour+45*time.Minute))
|
||||
assertEquals(t, "3 hours", HumanDuration(3*time.Hour))
|
||||
assertEquals(t, "3 hours", HumanDuration(3*time.Hour+59*time.Minute))
|
||||
assertEquals(t, "4 hours", HumanDuration(3*time.Hour+60*time.Minute))
|
||||
assertEquals(t, "24 hours", HumanDuration(24*time.Hour))
|
||||
assertEquals(t, "36 hours", HumanDuration(1*day+12*time.Hour))
|
||||
assertEquals(t, "2 days", HumanDuration(2*day))
|
||||
assertEquals(t, "7 days", HumanDuration(7*day))
|
||||
assertEquals(t, "13 days", HumanDuration(13*day+5*time.Hour))
|
||||
assertEquals(t, "2 weeks", HumanDuration(2*week))
|
||||
assertEquals(t, "2 weeks", HumanDuration(2*week+4*day))
|
||||
assertEquals(t, "3 weeks", HumanDuration(3*week))
|
||||
assertEquals(t, "4 weeks", HumanDuration(4*week))
|
||||
assertEquals(t, "4 weeks", HumanDuration(4*week+3*day))
|
||||
assertEquals(t, "4 weeks", HumanDuration(1*month))
|
||||
assertEquals(t, "6 weeks", HumanDuration(1*month+2*week))
|
||||
assertEquals(t, "8 weeks", HumanDuration(2*month))
|
||||
assertEquals(t, "3 months", HumanDuration(3*month+1*week))
|
||||
assertEquals(t, "5 months", HumanDuration(5*month+2*week))
|
||||
assertEquals(t, "13 months", HumanDuration(13*month))
|
||||
assertEquals(t, "23 months", HumanDuration(23*month))
|
||||
assertEquals(t, "24 months", HumanDuration(24*month))
|
||||
assertEquals(t, "2 years", HumanDuration(24*month+2*week))
|
||||
assertEquals(t, "3 years", HumanDuration(3*year+2*month))
|
||||
}
|
165
vendor/github.com/docker/go-units/size_test.go
generated
vendored
165
vendor/github.com/docker/go-units/size_test.go
generated
vendored
|
@ -1,165 +0,0 @@
|
|||
package units
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func ExampleBytesSize() {
|
||||
fmt.Println(BytesSize(1024))
|
||||
fmt.Println(BytesSize(1024 * 1024))
|
||||
fmt.Println(BytesSize(1048576))
|
||||
fmt.Println(BytesSize(2 * MiB))
|
||||
fmt.Println(BytesSize(3.42 * GiB))
|
||||
fmt.Println(BytesSize(5.372 * TiB))
|
||||
fmt.Println(BytesSize(2.22 * PiB))
|
||||
}
|
||||
|
||||
func ExampleHumanSize() {
|
||||
fmt.Println(HumanSize(1000))
|
||||
fmt.Println(HumanSize(1024))
|
||||
fmt.Println(HumanSize(1000000))
|
||||
fmt.Println(HumanSize(1048576))
|
||||
fmt.Println(HumanSize(2 * MB))
|
||||
fmt.Println(HumanSize(float64(3.42 * GB)))
|
||||
fmt.Println(HumanSize(float64(5.372 * TB)))
|
||||
fmt.Println(HumanSize(float64(2.22 * PB)))
|
||||
}
|
||||
|
||||
func ExampleFromHumanSize() {
|
||||
fmt.Println(FromHumanSize("32"))
|
||||
fmt.Println(FromHumanSize("32b"))
|
||||
fmt.Println(FromHumanSize("32B"))
|
||||
fmt.Println(FromHumanSize("32k"))
|
||||
fmt.Println(FromHumanSize("32K"))
|
||||
fmt.Println(FromHumanSize("32kb"))
|
||||
fmt.Println(FromHumanSize("32Kb"))
|
||||
fmt.Println(FromHumanSize("32Mb"))
|
||||
fmt.Println(FromHumanSize("32Gb"))
|
||||
fmt.Println(FromHumanSize("32Tb"))
|
||||
fmt.Println(FromHumanSize("32Pb"))
|
||||
}
|
||||
|
||||
func ExampleRAMInBytes() {
|
||||
fmt.Println(RAMInBytes("32"))
|
||||
fmt.Println(RAMInBytes("32b"))
|
||||
fmt.Println(RAMInBytes("32B"))
|
||||
fmt.Println(RAMInBytes("32k"))
|
||||
fmt.Println(RAMInBytes("32K"))
|
||||
fmt.Println(RAMInBytes("32kb"))
|
||||
fmt.Println(RAMInBytes("32Kb"))
|
||||
fmt.Println(RAMInBytes("32Mb"))
|
||||
fmt.Println(RAMInBytes("32Gb"))
|
||||
fmt.Println(RAMInBytes("32Tb"))
|
||||
fmt.Println(RAMInBytes("32Pb"))
|
||||
fmt.Println(RAMInBytes("32PB"))
|
||||
fmt.Println(RAMInBytes("32P"))
|
||||
}
|
||||
|
||||
func TestBytesSize(t *testing.T) {
|
||||
assertEquals(t, "1 KiB", BytesSize(1024))
|
||||
assertEquals(t, "1 MiB", BytesSize(1024*1024))
|
||||
assertEquals(t, "1 MiB", BytesSize(1048576))
|
||||
assertEquals(t, "2 MiB", BytesSize(2*MiB))
|
||||
assertEquals(t, "3.42 GiB", BytesSize(3.42*GiB))
|
||||
assertEquals(t, "5.372 TiB", BytesSize(5.372*TiB))
|
||||
assertEquals(t, "2.22 PiB", BytesSize(2.22*PiB))
|
||||
assertEquals(t, "1.049e+06 YiB", BytesSize(KiB*KiB*KiB*KiB*KiB*PiB))
|
||||
}
|
||||
|
||||
func TestHumanSize(t *testing.T) {
|
||||
assertEquals(t, "1 kB", HumanSize(1000))
|
||||
assertEquals(t, "1.024 kB", HumanSize(1024))
|
||||
assertEquals(t, "1 MB", HumanSize(1000000))
|
||||
assertEquals(t, "1.049 MB", HumanSize(1048576))
|
||||
assertEquals(t, "2 MB", HumanSize(2*MB))
|
||||
assertEquals(t, "3.42 GB", HumanSize(float64(3.42*GB)))
|
||||
assertEquals(t, "5.372 TB", HumanSize(float64(5.372*TB)))
|
||||
assertEquals(t, "2.22 PB", HumanSize(float64(2.22*PB)))
|
||||
assertEquals(t, "1e+04 YB", HumanSize(float64(10000000000000*PB)))
|
||||
}
|
||||
|
||||
func TestFromHumanSize(t *testing.T) {
|
||||
assertSuccessEquals(t, 32, FromHumanSize, "32")
|
||||
assertSuccessEquals(t, 32, FromHumanSize, "32b")
|
||||
assertSuccessEquals(t, 32, FromHumanSize, "32B")
|
||||
assertSuccessEquals(t, 32*KB, FromHumanSize, "32k")
|
||||
assertSuccessEquals(t, 32*KB, FromHumanSize, "32K")
|
||||
assertSuccessEquals(t, 32*KB, FromHumanSize, "32kb")
|
||||
assertSuccessEquals(t, 32*KB, FromHumanSize, "32Kb")
|
||||
assertSuccessEquals(t, 32*MB, FromHumanSize, "32Mb")
|
||||
assertSuccessEquals(t, 32*GB, FromHumanSize, "32Gb")
|
||||
assertSuccessEquals(t, 32*TB, FromHumanSize, "32Tb")
|
||||
assertSuccessEquals(t, 32*PB, FromHumanSize, "32Pb")
|
||||
|
||||
assertSuccessEquals(t, 32.5*KB, FromHumanSize, "32.5kB")
|
||||
assertSuccessEquals(t, 32.5*KB, FromHumanSize, "32.5 kB")
|
||||
assertSuccessEquals(t, 32, FromHumanSize, "32.5 B")
|
||||
|
||||
assertError(t, FromHumanSize, "")
|
||||
assertError(t, FromHumanSize, "hello")
|
||||
assertError(t, FromHumanSize, "-32")
|
||||
assertError(t, FromHumanSize, ".3kB")
|
||||
assertError(t, FromHumanSize, " 32 ")
|
||||
assertError(t, FromHumanSize, "32m b")
|
||||
assertError(t, FromHumanSize, "32bm")
|
||||
}
|
||||
|
||||
func TestRAMInBytes(t *testing.T) {
|
||||
assertSuccessEquals(t, 32, RAMInBytes, "32")
|
||||
assertSuccessEquals(t, 32, RAMInBytes, "32b")
|
||||
assertSuccessEquals(t, 32, RAMInBytes, "32B")
|
||||
assertSuccessEquals(t, 32*KiB, RAMInBytes, "32k")
|
||||
assertSuccessEquals(t, 32*KiB, RAMInBytes, "32K")
|
||||
assertSuccessEquals(t, 32*KiB, RAMInBytes, "32kb")
|
||||
assertSuccessEquals(t, 32*KiB, RAMInBytes, "32Kb")
|
||||
assertSuccessEquals(t, 32*MiB, RAMInBytes, "32Mb")
|
||||
assertSuccessEquals(t, 32*GiB, RAMInBytes, "32Gb")
|
||||
assertSuccessEquals(t, 32*TiB, RAMInBytes, "32Tb")
|
||||
assertSuccessEquals(t, 32*PiB, RAMInBytes, "32Pb")
|
||||
assertSuccessEquals(t, 32*PiB, RAMInBytes, "32PB")
|
||||
assertSuccessEquals(t, 32*PiB, RAMInBytes, "32P")
|
||||
|
||||
assertSuccessEquals(t, 32, RAMInBytes, "32.3")
|
||||
tmp := 32.3 * MiB
|
||||
assertSuccessEquals(t, int64(tmp), RAMInBytes, "32.3 mb")
|
||||
|
||||
assertError(t, RAMInBytes, "")
|
||||
assertError(t, RAMInBytes, "hello")
|
||||
assertError(t, RAMInBytes, "-32")
|
||||
assertError(t, RAMInBytes, " 32 ")
|
||||
assertError(t, RAMInBytes, "32m b")
|
||||
assertError(t, RAMInBytes, "32bm")
|
||||
}
|
||||
|
||||
func assertEquals(t *testing.T, expected, actual interface{}) {
|
||||
if expected != actual {
|
||||
t.Errorf("Expected '%v' but got '%v'", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
// func that maps to the parse function signatures as testing abstraction
|
||||
type parseFn func(string) (int64, error)
|
||||
|
||||
// Define 'String()' for pretty-print
|
||||
func (fn parseFn) String() string {
|
||||
fnName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
|
||||
return fnName[strings.LastIndex(fnName, ".")+1:]
|
||||
}
|
||||
|
||||
func assertSuccessEquals(t *testing.T, expected int64, fn parseFn, arg string) {
|
||||
res, err := fn(arg)
|
||||
if err != nil || res != expected {
|
||||
t.Errorf("%s(\"%s\") -> expected '%d' but got '%d' with error '%v'", fn, arg, expected, res, err)
|
||||
}
|
||||
}
|
||||
|
||||
func assertError(t *testing.T, fn parseFn, arg string) {
|
||||
res, err := fn(arg)
|
||||
if err == nil && res != -1 {
|
||||
t.Errorf("%s(\"%s\") -> expected error but got '%d'", fn, arg, res)
|
||||
}
|
||||
}
|
74
vendor/github.com/docker/go-units/ulimit_test.go
generated
vendored
74
vendor/github.com/docker/go-units/ulimit_test.go
generated
vendored
|
@ -1,74 +0,0 @@
|
|||
package units
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func ExampleParseUlimit() {
|
||||
fmt.Println(ParseUlimit("nofile=512:1024"))
|
||||
fmt.Println(ParseUlimit("nofile=1024"))
|
||||
fmt.Println(ParseUlimit("cpu=2:4"))
|
||||
fmt.Println(ParseUlimit("cpu=6"))
|
||||
}
|
||||
|
||||
func TestParseUlimitValid(t *testing.T) {
|
||||
u1 := &Ulimit{"nofile", 1024, 512}
|
||||
if u2, _ := ParseUlimit("nofile=512:1024"); *u1 != *u2 {
|
||||
t.Fatalf("expected %q, but got %q", u1, u2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseUlimitInvalidLimitType(t *testing.T) {
|
||||
if _, err := ParseUlimit("notarealtype=1024:1024"); err == nil {
|
||||
t.Fatalf("expected error on invalid ulimit type")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseUlimitBadFormat(t *testing.T) {
|
||||
if _, err := ParseUlimit("nofile:1024:1024"); err == nil {
|
||||
t.Fatal("expected error on bad syntax")
|
||||
}
|
||||
|
||||
if _, err := ParseUlimit("nofile"); err == nil {
|
||||
t.Fatal("expected error on bad syntax")
|
||||
}
|
||||
|
||||
if _, err := ParseUlimit("nofile="); err == nil {
|
||||
t.Fatal("expected error on bad syntax")
|
||||
}
|
||||
if _, err := ParseUlimit("nofile=:"); err == nil {
|
||||
t.Fatal("expected error on bad syntax")
|
||||
}
|
||||
if _, err := ParseUlimit("nofile=:1024"); err == nil {
|
||||
t.Fatal("expected error on bad syntax")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseUlimitHardLessThanSoft(t *testing.T) {
|
||||
if _, err := ParseUlimit("nofile=1024:1"); err == nil {
|
||||
t.Fatal("expected error on hard limit less than soft limit")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseUlimitInvalidValueType(t *testing.T) {
|
||||
if _, err := ParseUlimit("nofile=asdf"); err == nil {
|
||||
t.Fatal("expected error on bad value type, but got no error")
|
||||
} else if _, ok := err.(*strconv.NumError); !ok {
|
||||
t.Fatalf("expected error on bad value type, but got `%s`", err)
|
||||
}
|
||||
|
||||
if _, err := ParseUlimit("nofile=1024:asdf"); err == nil {
|
||||
t.Fatal("expected error on bad value type, but got no error")
|
||||
} else if _, ok := err.(*strconv.NumError); !ok {
|
||||
t.Fatalf("expected error on bad value type, but got `%s`", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUlimitStringOutput(t *testing.T) {
|
||||
u := &Ulimit{"nofile", 1024, 512}
|
||||
if s := u.String(); s != "nofile=512:1024" {
|
||||
t.Fatal("expected String to return nofile=512:1024, but got", s)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue