Skip to content

Commit

Permalink
Run TestPionE2ESimpleED25519 only on Go 1.13
Browse files Browse the repository at this point in the history
Conditionally build TestPionE2ESimpleED25519 in e2e_v113_test.go.
Once Go 1.12 is deprecated, move this test to e2e_test.go.
  • Loading branch information
at-wat committed Jan 11, 2020
1 parent 20c7570 commit 1bb35ee
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 37 deletions.
37 changes: 0 additions & 37 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package e2e

import (
"crypto/rand"
"crypto/tls"
"errors"
"io"
Expand All @@ -11,8 +10,6 @@ import (
"testing"
"time"

"golang.org/x/crypto/ed25519"

"github.com/pion/dtls/v2"
"github.com/pion/transport/test"
)
Expand Down Expand Up @@ -212,40 +209,6 @@ func TestPionE2ESimple(t *testing.T) {
}
}

func TestPionE2ESimpleED25519(t *testing.T) {
lim := test.TimeOut(time.Second * 30)
defer lim.Stop()

report := test.CheckRoutines(t)
defer report()

serverPort := randomPort(t)

for _, cipherSuite := range []dtls.CipherSuiteID{
dtls.TLS_ECDHE_ECDSA_WITH_AES_128_CCM,
dtls.TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8,
dtls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
} {
_, key, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
t.Fatal(err)
}
cert, err := dtls.SelfSign(key)
if err != nil {
t.Fatal(err)
}

cfg := &dtls.Config{
Certificates: []tls.Certificate{cert},
CipherSuites: []dtls.CipherSuiteID{cipherSuite},
InsecureSkipVerify: true,
ConnectTimeout: dtls.ConnectTimeoutOption(5 * time.Second),
}
assertE2ECommunication(cfg, cfg, serverPort, t)
}
}

func TestPionE2ESimplePSK(t *testing.T) {
lim := test.TimeOut(time.Second * 30)
defer lim.Stop()
Expand Down
52 changes: 52 additions & 0 deletions e2e/e2e_v113_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// +build go1.13

package e2e

import (
"crypto/rand"
"crypto/tls"
"testing"
"time"

"golang.org/x/crypto/ed25519"

"github.com/pion/dtls/v2"
"github.com/pion/transport/test"
)

// ED25519 is not supported in Go 1.12 crypto/x509.
// Once Go 1.12 is deprecated, move this test to e2e_test.go.

func TestPionE2ESimpleED25519(t *testing.T) {
lim := test.TimeOut(time.Second * 30)
defer lim.Stop()

report := test.CheckRoutines(t)
defer report()

serverPort := randomPort(t)

for _, cipherSuite := range []dtls.CipherSuiteID{
dtls.TLS_ECDHE_ECDSA_WITH_AES_128_CCM,
dtls.TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8,
dtls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
dtls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
} {
_, key, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
t.Fatal(err)
}
cert, err := dtls.SelfSign(key)
if err != nil {
t.Fatal(err)
}

cfg := &dtls.Config{
Certificates: []tls.Certificate{cert},
CipherSuites: []dtls.CipherSuiteID{cipherSuite},
InsecureSkipVerify: true,
ConnectTimeout: dtls.ConnectTimeoutOption(5 * time.Second),
}
assertE2ECommunication(cfg, cfg, serverPort, t)
}
}

0 comments on commit 1bb35ee

Please sign in to comment.