From 823a56f7a84c1c8bec1e75e8e30d7ce1a263a286 Mon Sep 17 00:00:00 2001 From: wang yan Date: Fri, 24 Apr 2020 22:51:31 +0800 Subject: [PATCH] Add optional parameter to disable cookie Add a optional parameter OCI_DISABLE_COOKIE to set the http client cookie jar to nil. This parameter can disable save cookies in api contacting. Signed-off-by: wang yan --- conformance/README.md | 2 ++ conformance/setup.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/conformance/README.md b/conformance/README.md index 6673e705..655a5de2 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -20,6 +20,7 @@ export OCI_NAMESPACE="myorg/myrepo" export OCI_USERNAME="myuser" export OCI_PASSWORD="mypass" export OCI_DEBUG="true" +export OCI_DISABLE_COOKIE="true" ``` Lastly, run the tests: @@ -157,6 +158,7 @@ docker run --rm \ -e OCI_USERNAME="myuser" \ -e OCI_PASSWORD="mypass" \ -e OCI_DEBUG="true" \ + -e OCI_DISABLE_COOKIE="true" \ conformance:latest ``` diff --git a/conformance/setup.go b/conformance/setup.go index a6f5d2fb..22818e9d 100644 --- a/conformance/setup.go +++ b/conformance/setup.go @@ -132,6 +132,7 @@ func init() { password := os.Getenv("OCI_PASSWORD") authScope := os.Getenv(envVarAuthScope) debug := os.Getenv("OCI_DEBUG") == "true" + disableCookie := os.Getenv("OCI_DISABLE_COOKIE") == "true" for envVar, enableTest := range testMap { if os.Getenv(envVar) == envTrue { @@ -152,6 +153,9 @@ func init() { } client.SetLogger(logger) + if disableCookie { + client.SetCookieJar(nil) + } config := imagespec.Image{ Architecture: "amd64",