summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/containers/common/pkg/auth/auth.go31
-rw-r--r--vendor/github.com/containers/common/pkg/auth/cli.go11
-rw-r--r--vendor/github.com/containers/common/pkg/config/config.go10
-rw-r--r--vendor/github.com/containers/common/pkg/config/default.go2
-rw-r--r--vendor/github.com/onsi/gomega/.travis.yml2
-rw-r--r--vendor/github.com/onsi/gomega/CHANGELOG.md8
-rw-r--r--vendor/github.com/onsi/gomega/gomega_dsl.go33
-rw-r--r--vendor/github.com/onsi/gomega/matchers.go19
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go42
-rw-r--r--vendor/github.com/onsi/gomega/matchers/panic_matcher.go76
-rw-r--r--vendor/modules.txt4
11 files changed, 213 insertions, 25 deletions
diff --git a/vendor/github.com/containers/common/pkg/auth/auth.go b/vendor/github.com/containers/common/pkg/auth/auth.go
index 4e0400d23..1aa9f8b31 100644
--- a/vendor/github.com/containers/common/pkg/auth/auth.go
+++ b/vendor/github.com/containers/common/pkg/auth/auth.go
@@ -34,9 +34,32 @@ func CheckAuthFile(authfile string) error {
return nil
}
+// systemContextWithOptions returns a version of sys
+// updated with authFile and certDir values (if they are not "").
+// NOTE: this is a shallow copy that can be used and updated, but may share
+// data with the original parameter.
+func systemContextWithOptions(sys *types.SystemContext, authFile, certDir string) *types.SystemContext {
+ if sys != nil {
+ copy := *sys
+ sys = &copy
+ } else {
+ sys = &types.SystemContext{}
+ }
+
+ if authFile != "" {
+ sys.AuthFilePath = authFile
+ }
+ if certDir != "" {
+ sys.DockerCertPath = certDir
+ }
+ return sys
+}
+
// Login implements a “log in” command with the provided opts and args
// reading the password from opts.Stdin or the options in opts.
func Login(ctx context.Context, systemContext *types.SystemContext, opts *LoginOptions, args []string) error {
+ systemContext = systemContextWithOptions(systemContext, opts.AuthFile, opts.CertDir)
+
var (
server string
err error
@@ -172,6 +195,11 @@ func getUserAndPass(opts *LoginOptions, password, userFromAuthFile string) (stri
// Logout implements a “log out” command with the provided opts and args
func Logout(systemContext *types.SystemContext, opts *LogoutOptions, args []string) error {
+ if err := CheckAuthFile(opts.AuthFile); err != nil {
+ return err
+ }
+ systemContext = systemContextWithOptions(systemContext, opts.AuthFile, "")
+
var (
server string
err error
@@ -194,9 +222,6 @@ func Logout(systemContext *types.SystemContext, opts *LogoutOptions, args []stri
}
server = getRegistryName(args[0])
}
- if err := CheckAuthFile(opts.AuthFile); err != nil {
- return err
- }
if opts.All {
if err := config.RemoveAllAuthentication(systemContext); err != nil {
diff --git a/vendor/github.com/containers/common/pkg/auth/cli.go b/vendor/github.com/containers/common/pkg/auth/cli.go
index 3384b0731..ab033681d 100644
--- a/vendor/github.com/containers/common/pkg/auth/cli.go
+++ b/vendor/github.com/containers/common/pkg/auth/cli.go
@@ -7,16 +7,19 @@ import (
)
// LoginOptions represents common flags in login
-// caller should define bool or optionalBool fields for flags --get-login and --tls-verify
+// In addition, the caller should probably provide a --tls-verify flag (that affects the provided
+// *types.SystemContest)
type LoginOptions struct {
// CLI flags managed by the FlagSet returned by GetLoginFlags
+ // Callers that use GetLoginFlags should not need to touch these values at all; callers that use
+ // other CLI frameworks should set them based on user input.
AuthFile string
CertDir string
Password string
Username string
StdinPassword bool
+ GetLoginSet bool
// Options caller can set
- GetLoginSet bool // set to true if --get-login is explicitly set
Stdin io.Reader // set to os.Stdin
Stdout io.Writer // set to os.Stdout
AcceptUnspecifiedRegistry bool // set to true if allows login with unspecified registry
@@ -25,10 +28,11 @@ type LoginOptions struct {
// LogoutOptions represents the results for flags in logout
type LogoutOptions struct {
// CLI flags managed by the FlagSet returned by GetLogoutFlags
+ // Callers that use GetLogoutFlags should not need to touch these values at all; callers that use
+ // other CLI frameworks should set them based on user input.
AuthFile string
All bool
// Options caller can set
- Stdin io.Reader // set to os.Stdin
Stdout io.Writer // set to os.Stdout
AcceptUnspecifiedRegistry bool // set to true if allows logout with unspecified registry
}
@@ -41,6 +45,7 @@ func GetLoginFlags(flags *LoginOptions) *pflag.FlagSet {
fs.StringVarP(&flags.Password, "password", "p", "", "Password for registry")
fs.StringVarP(&flags.Username, "username", "u", "", "Username for registry")
fs.BoolVar(&flags.StdinPassword, "password-stdin", false, "Take the password from stdin")
+ fs.BoolVar(&flags.GetLoginSet, "get-login", false, "Return the current login user for the registry")
return &fs
}
diff --git a/vendor/github.com/containers/common/pkg/config/config.go b/vendor/github.com/containers/common/pkg/config/config.go
index 0f17c27c9..611284476 100644
--- a/vendor/github.com/containers/common/pkg/config/config.go
+++ b/vendor/github.com/containers/common/pkg/config/config.go
@@ -442,16 +442,6 @@ func readConfigFromFile(path string, config *Config) (*Config, error) {
if err != nil {
return nil, fmt.Errorf("unable to decode configuration %v: %v", path, err)
}
- if config.Engine.VolumePath != "" {
- config.Engine.VolumePathSet = true
- }
- if config.Engine.StaticDir != "" {
- config.Engine.StaticDirSet = true
- }
- if config.Engine.TmpDir != "" {
- config.Engine.TmpDirSet = true
- }
-
return config, err
}
diff --git a/vendor/github.com/containers/common/pkg/config/default.go b/vendor/github.com/containers/common/pkg/config/default.go
index ec52ff706..7debd2984 100644
--- a/vendor/github.com/containers/common/pkg/config/default.go
+++ b/vendor/github.com/containers/common/pkg/config/default.go
@@ -479,6 +479,8 @@ func (c *Config) PidsLimit() int64 {
cgroup2, _ := cgroupv2.Enabled()
if cgroup2 {
return c.Containers.PidsLimit
+ } else {
+ return 0
}
}
return sysinfo.GetDefaultPidsLimit()
diff --git a/vendor/github.com/onsi/gomega/.travis.yml b/vendor/github.com/onsi/gomega/.travis.yml
index c6391855a..072fdd2db 100644
--- a/vendor/github.com/onsi/gomega/.travis.yml
+++ b/vendor/github.com/onsi/gomega/.travis.yml
@@ -1,8 +1,8 @@
language: go
go:
- - 1.12.x
- 1.13.x
+ - 1.14.x
- gotip
env:
diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md
index 3e9b5961b..35adfb8d7 100644
--- a/vendor/github.com/onsi/gomega/CHANGELOG.md
+++ b/vendor/github.com/onsi/gomega/CHANGELOG.md
@@ -1,3 +1,11 @@
+## 1.10.0
+
+### Features
+- Add HaveHTTPStatusMatcher (#378) [f335c94]
+- Changed matcher for content-type in VerifyJSONRepresenting (#377) [6024f5b]
+- Make ghttp usable with x-unit style tests (#376) [c0be499]
+- Implement PanicWith matcher (#381) [f8032b4]
+
## 1.9.0
### Features
diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go
index 0ab35bc7a..65e837e20 100644
--- a/vendor/github.com/onsi/gomega/gomega_dsl.go
+++ b/vendor/github.com/onsi/gomega/gomega_dsl.go
@@ -24,7 +24,7 @@ import (
"github.com/onsi/gomega/types"
)
-const GOMEGA_VERSION = "1.9.0"
+const GOMEGA_VERSION = "1.10.0"
const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil.
If you're using Ginkgo then you probably forgot to put your assertion in an It().
@@ -252,7 +252,7 @@ func Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion {
return ConsistentlyWithOffset(0, actual, intervals...)
}
-// ConsistentlyWithOffset operates like Consistnetly but takes an additional
+// ConsistentlyWithOffset operates like Consistently but takes an additional
// initial argument to indicate an offset in the call stack. This is useful when building helper
// functions that contain matchers. To learn more, read about `ExpectWithOffset`.
func ConsistentlyWithOffset(offset int, actual interface{}, intervals ...interface{}) AsyncAssertion {
@@ -432,3 +432,32 @@ func toDuration(input interface{}) time.Duration {
panic(fmt.Sprintf("%v is not a valid interval. Must be time.Duration, parsable duration string or a number.", input))
}
+
+// Gomega describes the essential Gomega DSL. This interface allows libraries
+// to abstract between the standard package-level function implementations
+// and alternatives like *WithT.
+type Gomega interface {
+ Expect(actual interface{}, extra ...interface{}) Assertion
+ Eventually(actual interface{}, intervals ...interface{}) AsyncAssertion
+ Consistently(actual interface{}, intervals ...interface{}) AsyncAssertion
+}
+
+type globalFailHandlerGomega struct{}
+
+// DefaultGomega supplies the standard package-level implementation
+var Default Gomega = globalFailHandlerGomega{}
+
+// Expect is used to make assertions. See documentation for Expect.
+func (globalFailHandlerGomega) Expect(actual interface{}, extra ...interface{}) Assertion {
+ return Expect(actual, extra...)
+}
+
+// Eventually is used to make asynchronous assertions. See documentation for Eventually.
+func (globalFailHandlerGomega) Eventually(actual interface{}, extra ...interface{}) AsyncAssertion {
+ return Eventually(actual, extra...)
+}
+
+// Consistently is used to make asynchronous assertions. See documentation for Consistently.
+func (globalFailHandlerGomega) Consistently(actual interface{}, extra ...interface{}) AsyncAssertion {
+ return Consistently(actual, extra...)
+}
diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go
index 11f5b1070..16218d4c5 100644
--- a/vendor/github.com/onsi/gomega/matchers.go
+++ b/vendor/github.com/onsi/gomega/matchers.go
@@ -390,6 +390,16 @@ func Panic() types.GomegaMatcher {
return &matchers.PanicMatcher{}
}
+//PanicWith succeeds if actual is a function that, when invoked, panics with a specific value.
+//Actual must be a function that takes no arguments and returns no results.
+//
+//By default PanicWith uses Equal() to perform the match, however a
+//matcher can be passed in instead:
+// Expect(fn).Should(PanicWith(MatchRegexp(`.+Foo$`)))
+func PanicWith(expected interface{}) types.GomegaMatcher {
+ return &matchers.PanicMatcher{Expected: expected}
+}
+
//BeAnExistingFile succeeds if a file exists.
//Actual must be a string representing the abs path to the file being checked.
func BeAnExistingFile() types.GomegaMatcher {
@@ -408,6 +418,15 @@ func BeADirectory() types.GomegaMatcher {
return &matchers.BeADirectoryMatcher{}
}
+//HaveHTTPStatus succeeds if the Status or StatusCode field of an HTTP response matches.
+//Actual must be either a *http.Response or *httptest.ResponseRecorder.
+//Expected must be either an int or a string.
+// Expect(resp).Should(HaveHTTPStatus(http.StatusOK)) // asserts that resp.StatusCode == 200
+// Expect(resp).Should(HaveHTTPStatus("404 Not Found")) // asserts that resp.Status == "404 Not Found"
+func HaveHTTPStatus(expected interface{}) types.GomegaMatcher {
+ return &matchers.HaveHTTPStatusMatcher{Expected: expected}
+}
+
//And succeeds only if all of the given matchers succeed.
//The matchers are tried in order, and will fail-fast if one doesn't succeed.
// Expect("hi").To(And(HaveLen(2), Equal("hi"))
diff --git a/vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go
new file mode 100644
index 000000000..3ce4800b7
--- /dev/null
+++ b/vendor/github.com/onsi/gomega/matchers/have_http_status_matcher.go
@@ -0,0 +1,42 @@
+package matchers
+
+import (
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+
+ "github.com/onsi/gomega/format"
+)
+
+type HaveHTTPStatusMatcher struct {
+ Expected interface{}
+}
+
+func (matcher *HaveHTTPStatusMatcher) Match(actual interface{}) (success bool, err error) {
+ var resp *http.Response
+ switch a := actual.(type) {
+ case *http.Response:
+ resp = a
+ case *httptest.ResponseRecorder:
+ resp = a.Result()
+ default:
+ return false, fmt.Errorf("HaveHTTPStatus matcher expects *http.Response or *httptest.ResponseRecorder. Got:\n%s", format.Object(actual, 1))
+ }
+
+ switch e := matcher.Expected.(type) {
+ case int:
+ return resp.StatusCode == e, nil
+ case string:
+ return resp.Status == e, nil
+ }
+
+ return false, fmt.Errorf("HaveHTTPStatus matcher must be passed an int or a string. Got:\n%s", format.Object(matcher.Expected, 1))
+}
+
+func (matcher *HaveHTTPStatusMatcher) FailureMessage(actual interface{}) (message string) {
+ return format.Message(actual, "to have HTTP status", matcher.Expected)
+}
+
+func (matcher *HaveHTTPStatusMatcher) NegatedFailureMessage(actual interface{}) (message string) {
+ return format.Message(actual, "not to have HTTP status", matcher.Expected)
+}
diff --git a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go b/vendor/github.com/onsi/gomega/matchers/panic_matcher.go
index 640f4db1a..adc8cee63 100644
--- a/vendor/github.com/onsi/gomega/matchers/panic_matcher.go
+++ b/vendor/github.com/onsi/gomega/matchers/panic_matcher.go
@@ -8,7 +8,8 @@ import (
)
type PanicMatcher struct {
- object interface{}
+ Expected interface{}
+ object interface{}
}
func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) {
@@ -28,7 +29,21 @@ func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error)
defer func() {
if e := recover(); e != nil {
matcher.object = e
- success = true
+
+ if matcher.Expected == nil {
+ success = true
+ return
+ }
+
+ valueMatcher, valueIsMatcher := matcher.Expected.(omegaMatcher)
+ if !valueIsMatcher {
+ valueMatcher = &EqualMatcher{Expected: matcher.Expected}
+ }
+
+ success, err = valueMatcher.Match(e)
+ if err != nil {
+ err = fmt.Errorf("PanicMatcher's value matcher failed with:\n%s%s", format.Indent, err.Error())
+ }
}
}()
@@ -38,9 +53,62 @@ func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error)
}
func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "to panic")
+ if matcher.Expected == nil {
+ // We wanted any panic to occur, but none did.
+ return format.Message(actual, "to panic")
+ }
+
+ if matcher.object == nil {
+ // We wanted a panic with a specific value to occur, but none did.
+ switch matcher.Expected.(type) {
+ case omegaMatcher:
+ return format.Message(actual, "to panic with a value matching", matcher.Expected)
+ default:
+ return format.Message(actual, "to panic with", matcher.Expected)
+ }
+ }
+
+ // We got a panic, but the value isn't what we expected.
+ switch matcher.Expected.(type) {
+ case omegaMatcher:
+ return format.Message(
+ actual,
+ fmt.Sprintf(
+ "to panic with a value matching\n%s\nbut panicked with\n%s",
+ format.Object(matcher.Expected, 1),
+ format.Object(matcher.object, 1),
+ ),
+ )
+ default:
+ return format.Message(
+ actual,
+ fmt.Sprintf(
+ "to panic with\n%s\nbut panicked with\n%s",
+ format.Object(matcher.Expected, 1),
+ format.Object(matcher.object, 1),
+ ),
+ )
+ }
}
func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1)))
+ if matcher.Expected == nil {
+ // We didn't want any panic to occur, but one did.
+ return format.Message(actual, fmt.Sprintf("not to panic, but panicked with\n%s", format.Object(matcher.object, 1)))
+ }
+
+ // We wanted a to ensure a panic with a specific value did not occur, but it did.
+ switch matcher.Expected.(type) {
+ case omegaMatcher:
+ return format.Message(
+ actual,
+ fmt.Sprintf(
+ "not to panic with a value matching\n%s\nbut panicked with\n%s",
+ format.Object(matcher.Expected, 1),
+ format.Object(matcher.object, 1),
+ ),
+ )
+ default:
+ return format.Message(actual, "not to panic with", matcher.Expected)
+ }
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index da97b24fe..b638d1ad0 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -82,7 +82,7 @@ github.com/containers/buildah/pkg/secrets
github.com/containers/buildah/pkg/supplemented
github.com/containers/buildah/pkg/umask
github.com/containers/buildah/util
-# github.com/containers/common v0.11.0
+# github.com/containers/common v0.11.1
github.com/containers/common/pkg/apparmor
github.com/containers/common/pkg/auth
github.com/containers/common/pkg/capabilities
@@ -375,7 +375,7 @@ github.com/onsi/ginkgo/reporters/stenographer
github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable
github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty
github.com/onsi/ginkgo/types
-# github.com/onsi/gomega v1.9.0
+# github.com/onsi/gomega v1.10.0
github.com/onsi/gomega
github.com/onsi/gomega/format
github.com/onsi/gomega/gbytes