PROTON-1655: [go] TestAuthPlain fails when SASL_IMPL is none

Added electron.SASLExtended() check for extended SASL support.
Skip tests that can't be run without extended support when it is not available.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/91195b58
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/91195b58
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/91195b58

Branch: refs/heads/go1
Commit: 91195b58019a1be801e4fc9d8fd0a3f7ab433f3e
Parents: a1ceb2f
Author: Alan Conway <acon...@redhat.com>
Authored: Mon Oct 30 17:14:26 2017 -0400
Committer: Alan Conway <acon...@redhat.com>
Committed: Mon Oct 30 17:14:26 2017 -0400

----------------------------------------------------------------------
 .../bindings/go/src/qpid.apache.org/electron/auth_test.go |  9 +++++++++
 .../go/src/qpid.apache.org/electron/connection.go         |  8 ++++++++
 .../bindings/go/src/qpid.apache.org/proton/wrappers.go    | 10 ++++++++++
 3 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/91195b58/proton-c/bindings/go/src/qpid.apache.org/electron/auth_test.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/auth_test.go 
b/proton-c/bindings/go/src/qpid.apache.org/electron/auth_test.go
index 73a9299..9eb48c0 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/auth_test.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/auth_test.go
@@ -57,6 +57,9 @@ func TestAuthAnonymous(t *testing.T) {
 }
 
 func TestAuthPlain(t *testing.T) {
+       if !SASLExtended() {
+               t.Skip()
+       }
        fatalIf(t, configureSASL())
        got, err := testAuthClientServer(t,
                []ConnectionOption{SASLAllowInsecure(true), 
SASLAllowedMechs("PLAIN"), User("fred@proton"), Password([]byte("xxx"))},
@@ -66,6 +69,9 @@ func TestAuthPlain(t *testing.T) {
 }
 
 func TestAuthBadPass(t *testing.T) {
+       if !SASLExtended() {
+               t.Skip()
+       }
        fatalIf(t, configureSASL())
        _, err := testAuthClientServer(t,
                []ConnectionOption{SASLAllowInsecure(true), 
SASLAllowedMechs("PLAIN"), User("fred@proton"), Password([]byte("yyy"))},
@@ -76,6 +82,9 @@ func TestAuthBadPass(t *testing.T) {
 }
 
 func TestAuthBadUser(t *testing.T) {
+       if !SASLExtended() {
+               t.Skip()
+       }
        fatalIf(t, configureSASL())
        _, err := testAuthClientServer(t,
                []ConnectionOption{SASLAllowInsecure(true), 
SASLAllowedMechs("PLAIN"), User("foo@bar"), Password([]byte("yyy"))},

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/91195b58/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go 
b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
index 267ee1e..2749b2b 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
@@ -374,6 +374,14 @@ func GlobalSASLConfigDir(dir string) { globalSASLConfigDir 
= dir }
 //
 func GlobalSASLConfigName(dir string) { globalSASLConfigName = dir }
 
+// Do we support extended SASL negotiation?
+// All implementations of Proton support ANONYMOUS and EXTERNAL on both
+// client and server sides and PLAIN on the client side.
+//
+// Extended SASL implememtations use an external library (Cyrus SASL)
+// to support other mechanisms beyond these basic ones.
+func SASLExtended() bool { return proton.SASLExtended() }
+
 var (
        globalSASLConfigName string
        globalSASLConfigDir  string

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/91195b58/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go 
b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go
index 879ad53..09f3e65 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers.go
@@ -448,3 +448,13 @@ func (t Transport) Push(bytes []byte) int {
 func (t Transport) SASL() SASL {
        return SASL{C.pn_sasl(t.pn)}
 }
+
+// Do we support extended SASL negotiation?
+// All implementations of Proton support ANONYMOUS and EXTERNAL on both
+// client and server sides and PLAIN on the client side.
+//
+// Extended SASL implememtations use an external library (Cyrus SASL)
+// to support other mechanisms beyond these basic ones.
+func SASLExtended() bool {
+       return bool(C.pn_sasl_extended())
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to